# How to write a driver for a device in ACPI BUS



## Rajesh (Jul 17, 2018)

Hi, 

I am trying to write a driver for a UART device in ACPI BUS.  As part of this, I added a new table "uart_acpi_ids" in uart_bus_acpi.c with the devices ACPI ID.  Then in the "uart_acpi_probe",  in addition to existing ISA_PNP_PROBE, I added the part to do ACPI_ID_PROBE with the newly added uart_acpi_ids list.  With these changes compilation fails saying "ACPI_ID_PROBE" not defined.  I couldn't see the ACPI_ID_PROBE definition in the source.  I tried including the following header files, but compilation fails saying opt_acpi.h not found.

#include "opt_acpi.h"
#include <contrib/dev/acpica/include/acpi.h>
#include <contrib/dev/acpica/include/accommon.h>
#include <dev/acpica/acpivar.h>

Questions :
1) Why "uart_bus_acpi.c" has ISA ID table and lookup things? and where does that ISA ID's come from? 
2) Where is ACPI_ID_PROBE defined?  (Likewise, I don't see ISA_PNP_PROBE defined, so where are these macros/functions defined)
3) I see the opt_acpi.h in multiple directories of /usr/obj/<src_path>/sys/<CUSTOM KERNEL>/modules path.  So, how are these option file headers generated and what I could be missing for the compilation to fail?


----------



## Phishfry (Jul 18, 2018)

This is certainly an advanced topic for the forum.
I would suggest you consider asking on the mailing lists.
There you will get a much more help from programmers.

Nevermind:
I see you found it already.
https://lists.freebsd.org/pipermail/freebsd-drivers/2018-July/002093.html

There are also loads of developers that hang out on certain IRC channels too.


----------



## Rajesh (Jul 19, 2018)

Yes Phishfry, I haven't received response from the mailing list.  I have posted in ACPI mailing list also, but no luck there too.

https://lists.freebsd.org/pipermail/freebsd-acpi/2018-July/009477.html

I have never used IRC channels so far (even not sure how to use them). I think, it's high time I explore and start using them. Any good suggestions for responsive channels?


----------

