writing drivers in aml

Discussions on more advanced topics such as monolithic vs micro-kernels, transactional memory models, and paging vs segmentation should go here. Use this forum to expand and improve the wiki!
Post Reply
h0bby1
Member
Member
Posts: 240
Joined: Wed Aug 21, 2013 7:08 am

writing drivers in aml

Post by h0bby1 »

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
User avatar
SpyderTL
Member
Member
Posts: 1074
Joined: Sun Sep 19, 2010 10:05 pm

Re: writing drivers in aml

Post by SpyderTL »

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
embryo

Re: writing drivers in aml

Post by embryo »

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
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.
Post Reply