narmstrong changed the topic of #linux-amlogic to: Amlogic mainline kernel development discussion - our wiki http://linux-meson.com/ - ml linux-amlogic@lists.infradead.org - official channel moved from Freenode - publicly logged on https://libera.irclog.whitequark.org/linux-amlogic
jkl has quit [Quit: Gone.]
jkl has joined #linux-amlogic
jacobk has joined #linux-amlogic
jacobk has quit [Ping timeout: 248 seconds]
camus has joined #linux-amlogic
jacobk has joined #linux-amlogic
vagrantc has quit [Quit: leaving]
gabes has quit [Quit: The Lounge - https://thelounge.chat]
gabes has joined #linux-amlogic
ebach has joined #linux-amlogic
f_|catgirl has joined #linux-amlogic
<f_|catgirl> Hey all
f_|catgirl is now known as f_
<f_> I said I'm going to explain
<f_> See this?
<f_> if ((DAT_d900a000 == 0xf) && (DAT_d900a2ca == 0)) {
<f_> DAT_d900a000 = 3;
<f_> ^ this is equivalent to, in Amlogic's "coding style", wr_reg(0xd900a000, 3)
<f_> if I recall correctly
<f_> I completly overlooked this before
<f_> Now. Why am I showing this? Well, you may recall that there's a serial_puts call after this:
<f_> serial_puts((byte *)(s_Rank0_only_d9009240 + (long)(int)(DAT_d900a000 - 1) * 0xd));
<f_> I originally assumed that it just printed "Rank0 only" but it doesn't.
<f_> You see, strings are actually pointers to char arrays, in C
<f_> And "Rank0 only" is at 0xD9009240
ebach has quit [Ping timeout: 265 seconds]
<f_> But then they add the result of (<contents of 0xD900A000> - 1) * 13
<f_> But you may recall that 0xD900A000 is being written to earlier on, and set to 3.
<f_> So: 0xd9009240 + (3 - 1) * 13 = 0xd900925a
<f_> So serial_puts is supposed to, in this case, print all contents of the char array found at address 0xD900925A
<f_> Which just so happens to be "Rank0+1 diff"
<f_> That's what actually gets printed!
* f_ looks at Amlogic staff.
<f_> Nice obfuscation attempt. Too bad I figured out how it worked :P
<tetrakist> Congrats. :)
<f_> Thanks!
<f_> Now let's go further and see what changes they made after making it (bl2) proprietary.
<f_> We can already see that they did lots of changes to DDR init.
<f_> e.g. ddr_init() used to just run lots of DDR-related functions. Now it does other stuff as well.
<f_> narmstrong: And since you thought that was all interesting I'll push Ghidra project files somewhere.
<f_> So that people interested can see what I did.
<tetrakist> f_: Thanks!
<f_> tetrakist: So you're interested?
<f_> great :P
<tetrakist> I'm interested in everything, but personally don't have the knowledge or time at the moment to do anything with them. But I strongly believe in encouraging work such as your own. :)
<tetrakist> I may have to dive into learning how to use Ghidra later this year.
<f_> Keep in mind I'm a total n00b at reverse-engineering and Ghidra :P
<f_> But so far so good!
<tetrakist> Well, that's encouraging, I suppose, seeing as I am too. Though I think you have a bit more experience close to the hardware than I do. I hope to work fixing that as well.
<f_> Yeah I think I have more experience close to the hardware ¯\_(ツ)_/¯ I guess
<tetrakist> Heh, your libreboot work is certainly appreciated. :)
* f_ checks if tetrakist is in #libreboot.
<f_> tetrakist: Unfourtunately I only have an Amlogic S905 set-top box from 2016 and that's what I'm using to test. Newer SoCs such as the S905X will still have to use blobs...
<f_> (although I suspect they kept using the same codebase since 2015)
<tetrakist> f_: I'm willing to donate some hardware if you will find it useful.
<f_> No need to, but thanks!, I'll probably get some hardware myself.
<f_> (set-top boxes)
<tetrakist> To be honest, my interest in some of the "set-top" TV sticks is what led me in a convoluted path to this channel.
<f_> There's a LOT of Amlogic set-top boxes on the market, so it's not that hard to find one.
<f_> tetrakist: Me too! I originally wanted to get mainline linux running on my set-top box, then wanted mainline U-Boot, and now I want a fully libre boot, and here we are :P
<tetrakist> Yes. I was looking at the S905Y4 "X98 500" and the S905Y2 "X96S" TV sticks...
<f_> I have an S905 Videostrong KII Pro
<f_> Quite a nice set-top box to be honest (apart from the stock Android OS, of course :P)
<tetrakist> I'm quite curious about the possibility of getting linux running on some of these android projectors. But I haven't seen much work towards that end.
<tetrakist> I'm fascinated by "high-mobility" systems that are small and contained.
<f_> I do hope my work is going to be useful for other stuff like.....an Amlogic MNT Reform laptop or a russian manufacturer which just so happens to chime in here from time to time :)
* f_ looks at SberDevices.
<tetrakist> Do you have a particular interest in Amlogic devices, or is that just because it was what was in your set-top box?
<f_> Before, no. But now I do think Amlogic devices are quite nice and I love working with those.
<tetrakist> Well-architected systems are a joy to work with, in any area.
<f_> I learned a lot of stuff while hacking my set-top box! Before I didn't even know how to sign U-Boot for running it as a primary bootloader, now I'm literally porting TF-A BL2!
<tetrakist> Now if you started streaming you could be the next Asahi Lina. :P
<f_> ¯\_(ツ)_/¯ I would need to become a VTuber in that case
<tetrakist> I was also interested in Amlogic because of some descriptions of them targeting low-power implementations.
<tetrakist> Did you see https://beepberry.sqfmi.com/ ?
<f_> Nope.
<tetrakist> The form-factor is very interesting to me, but I suspect that the Raspberry Pi Zero will be a bit power-hungry.
<f_> "or any other compatible SBCs (e.g. Radxa Zero, MQ-Pro)"
<f_> I see at least one Amlogic-powered SBC here
<tetrakist> Ah yes. The Radxa.
<f_> Looks nice though.
<tetrakist> I guess I was too focused on the Pi to spot that.
<f_> Oh it also uses a Blackberry keyboard =)
<tetrakist> yes!
<tetrakist> Do you know what the status is regarding minimizing power usage on the S905Y2 running linux?
<f_> I don't. Sorry.
<tetrakist> Bleh, it's sold out. heh.
<tetrakist> Well, I guess that gives me time to get a radxa zero.
<tetrakist> Anyways... Nice talking with you. Keep up the good work. I'll probably grab one of those TV sticks in a few weeks and see what I can get done on it... At least I know one more person who I can ask questions. ;)
<f_> =)
ebach has joined #linux-amlogic
<f_> narmstrong: What's even funnier, is the fact that despite the fact that DDR init changed more than anything else, it didn't change too much either!
<f_> I guess they just added LPDDR init
<f_> these are all register write operations!
ebach has quit [Ping timeout: 240 seconds]
<f_> So we now know where the DRAM gets initialised.
jacobk has quit [Ping timeout: 248 seconds]
f_ has quit [Remote host closed the connection]
f_|catgirl has joined #linux-amlogic
f_|catgirl is now known as f_
<f_> Sorry for disconnecting
<f_> Here's what we have now.
<f_> Only FUN_d9008d58() hasn't been named yet!
<f_> Lots of unnamed functions...
<f_> I think they use all registers defined in those header files: https://git.vitali64.duckdns.org/archive/amlogic-bl2.git/tree/plat/gxb/ddr
<f_> Those: ddr_pctl_define.h, ddr_pub_define.h, dmc_define.h, mmc_define.h, sec_mmc_define.h
<f_> Remember this?
<f_> serial_puts((byte *)(s_Rank0_only_d9009240 + (long)(int)(DAT_d900a000 - 1) * 0xd));
<f_> They do the exact same thing with most strings!
<f_> (in ddr_init())
<f_> pbVar3 = (byte *)(s_LPDDR_chl:_d900941f + 2);
<f_> So much obfuscation!!
<f_> Literally
<f_> pbVar3 = (char *)("LPDDR chl: " + 2);
elastic_dog has quit [Ping timeout: 240 seconds]
elastic_dog has joined #linux-amlogic
f_ has quit [Quit: zzz]
f_|catgirl has joined #linux-amlogic
f_|catgirl is now known as f_
f_[xmpp] has quit [Ping timeout: 250 seconds]
f_[xmpp] has joined #linux-amlogic
<f_> At this point I think I should be able to rewrite DDR init.
<f_> I think
<f_> I THINK
<f_> I'll start with DMC init, since it the very least Amlogic was kind enough to document that.
f_ has quit [Read error: Connection reset by peer]
buzzmarshall has joined #linux-amlogic