EmbeddedControl implementation research #348
Replies: 4 comments 6 replies
|
Thanks for your interest @TabulateJarl8! I'll bump this across to "discussions" since it's fairly open-ended. |
|
Hello again! You're right - Region Handlers aren't fully implemented yet, but I think if you do a "find all references" for You're definitely welcome to take a stab at it - if you've got something you want to discuss then open a draft PR and assign me, or mention me somewhere and we can talk about it in more detail. I'm not sure if you'd consider it "far in the weeds" or not - in some ways it'll be higher level than a lot of OS stuff, but you might also end up thinking about some crazy hardware details 🤷 Before talking about specific documentation, a warning - I've found that AI can be a bit confused dealing with ACPI stuff, probably because of the lack of available docs. So take its suggestions with a pinch of salt. Sadly, the documentation is a bit lacking. The main ACPI spec does have a bit of stuff about operation regions (this is probably the place to start, alongside here) but it's not the easiest to read and doesn't go into a great deal of detail about the Embedded Control region. That'd be my starting point anyway. You might also be able to find a chip specification or developer guide for whichever bit of your motherboard it is... btw, what are you trying to run on? If it gives some idea of the signals it needs then you might be able to understand more about how your code should work. Other than that, there'll just be a certain about of "try it and see" I'm afraid. Good luck 😄 (but feel free to ask questions. I'll do my best, but the OSDev Forum gets more views and has some smarter folks looking at it so might be worth a try) |
|
Hey @TabulateJarl8! I haven't got to implementing embedded controller bits yet, and as you note custom region handlers are still WIP (but I would like to get them working sooner rather than later; they shouldn't be too tricky I'm hoping!). The embedded controller I think has a spec and is relatively generic. There are two ways of discovering one, either through a static ECDT table or via the AML namespace. You then read and write registers as you're told to via that, and execute various AML methods to indicate you've received events from the EC. I think the issue is that handling the EC properly (which I think is fairly asynchronous) requires a fair amount of other kernel infrastructure, so parts at least are outside the scope of this crate. A good place to potentially start would be Managarm's EC driver - I don't think many other 'hobby' kernels have good support yet, but I haven't looked too closely yet. |
|
I've been poking around this crate and the ACPI spec for a few hours and a few things came up that I was curious about/wanted a sanity check on:
Just as a note - I noticed the |
Uh oh!
There was an error while loading. Please reload this page.
Hey! I was working on getting S5 sleep in my operating system, and my machine's AML seems to be running stuff from the embedded controller region when the
\_PTSmethod is executed. I noticed aNoHandlerForRegionAccess(EmbeddedControl)error, and after digging through the source code it seems to me that this just isn't implemented yet.It doesn't seem particularly simple to implement to me (although I haven't looked too far into it), so I was wondering if there's any resources or spec research that might be useful for someone trying to implement this. I am interested in contributing to more Rust osdev, so I'd be happy to do some research or aid in the implementation if that's something not too far in the weeds
All reactions