as i got acpica working, i was wondering about the possibility to write device drivers as an aml method associated with a device
as acpica come also with a compiler, and seem to be able to add methods in a namespace, as aml seem to have functions to handle conditions, port io, interupt handling, ressource mapping, access to pci configuration space, wouldn't it be possible to handle most of the device initialisation code with an aml method instead of programming it in asm, and then adding those device initialisation method in the namespace at runtime after a pci scan for the detected device
i don't know if there could be a lot of advantage about doing that, but it could make driver code totally portable, and cpu independant, and device initialisation code doesn't have to be super fast either, anyway there is always plenty of delaying and waiting in device initialisation, so it wouldn't make a big difference to execute some aml code, and the driver code could use directly all the ressource informations from the acpi tables regarding io, interupt etc, and could probably also be synchronised with the acpi hardware access
writing drivers in aml
Re: writing drivers in aml
I've considered this as well. Something else you should keep in mind... There's nothing that says that you couldn't compile your AML code to native code Just-In-Time. This should take care of any performance issues you may have trying to run "interpreted" driver code.
Project: OZone
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
Source: GitHub
Current Task: LIB/OBJ file support
"The more they overthink the plumbing, the easier it is to stop up the drain." - Montgomery Scott
Re: writing drivers in aml
But the initialization is just a small part of driver's job. So the low level code is still required. And what about initialization for a specific environment? I mean there are possible many initial values in device registers and a particular set of values is environment dependent. For example a ps2 controller has mouse and keyboard parts, but if user uses USB mouse, then initialization of mouse part is useless, and if user uses USB keyboard, then all the ps2 controller is useless.h0bby1 wrote:wouldn't it be possible to handle most of the device initialisation code with an aml method instead of programming it in asm