accesio / APCI

Currently supported and recommended PCI drivers
6 stars 8 forks source link

Issues compiling against linux kernel 2.6.37 #12

Closed Davide-1998 closed 9 months ago

Davide-1998 commented 1 year ago

Good evening, I tried compiling the driver using the distro Slitaz 4.0 having the linux kernel 2.6.37, the result was a compile error as soon as make was run in the APCI folder. The error statement is:

apci_fops.c: In function mmap_apci
apci_fops.c:554:11 error: implicit declaration of function dma_mmap_coherent

In tracing back the error I found out that in earlier version of the linux kernel, like the 6.2.x, the header include/linux/dma-mapping.h contains the declaration of such function and in kernel/dma/mapping.c there is the implementation of dma_mmap_attrs which is required by it. Obviously, the 2.6.37 lacks such header declaration and the mapping.c file. In order to make the driver compile I added to my dma_mapping.h header the partial declaration of these functions (only the chunks in the dma-mapping.h of the 6.2 kernel). Unfortunately, even tough the driver compiles, loading the driver into the kernel, through the command make install, fails due to an unknown symbol being dma_mmap_attrs that is exported in kernel/dma/mapping.c. Lastly, the compiler gave me an error also in apci_dev.c:668 that was fixed by lowering the check on the kernel version of line 667 to my current kernel version.

This said, I wanted to know if the driver fully supports the linux kernel 2.6.x being the functions added in dma-mapping.h yet to be fully declared, task which raised a lot of problems especially into undefined functions spread across many files in the kernel. Also, I am interested in any fix available for this issue, if any.

One last note: all the paths written are relative to the kernel source code.

Regards.

jdolanIV commented 1 year ago

2.6.37 is a very old kernel. The last release I see for SliTaz is April 2012. https://www.slitaz.org/en/about/ If it is not possible to move a newer kernel, and you don't need dma, then you could try removing everything related to dma and mmap. The driver is very old. I think pieces of it were done in the 2.4 kernel. I expect if you keep commenting things out you will get to a point where it will handle IRQs and do register I/O. If you let us know which product you are using and your use case, we might be able to lend our experience.

-- Jay

Davide-1998 commented 1 year ago

Good morning, the product I am going to use is the 104-COM-8S board, https://accesio.com/product/104-com-8s/.

jdolanIV commented 1 year ago

The COM boards don't use the APCI driver. They use the serial port driver that is part of the kernel. The 104 bus is not plug and play so you will need to configure everything manually. To my knowledge ACCES has never worked on getting this particular use case working, but @JHentges may know of someone who has tried. The setserial command https://tldp.org/HOWTO/Serial-HOWTO-11.html is where I would start. Information for configuring the card's base address and the information you will need to construct the setserial command is in the manual. https://accesio.com/MANUALS/104-COM-8S.pdf If possible I recommend moving to a newer kernel. If you encounter any kernel bugs it will be unlikely that you'll be able to get any support. -- Jay