On Thu, Jul 12, 2007 at 05:13:38PM +0700, Darmawan Salihun wrote:
As for the EPIA board, well, where is that base specified? In a PCI config register or where?
The base is in a PCI config register. Relevant code as follows:
base = pci_read_word(dev, 0x88) & 0xFF80; val = inb(base + 0x4D); val |= 0x80; outb(val, base + 0x4D);
Ok! Put all of board_enable.c in the kernel driver and add some way for the app to call any function in the board_pciid_enables list, in the kernel driver. Sort of RPC but over a app/kernel split instead of over a network.
Then compile board_enable.c also into the app, but not to call any of the functions (which would fail anyway) but only to get the same board_pciid_enables list. The struct may have to be extended to have a unique index for each entry so that the driver and app can agree on which function is which.
All of the device detection should be done where it is easiest to do it. Since the driver will need to do safe PCI accesses for board enables perhaps it makes sense to contain all PCI accesses in the driver.
On the other hand, perhaps the app will need to do some PCI accesses to choose the right board_enable function and then it's better to do most of them in the app.
What do you think?
Another general matter, make sure the app and driver can exchange version numbers. That way both the driver and the app could have compatiblity code in order to be backwards compatible.
I would like the app to exit with an error message if it can't agree with the kernel driver on a "protocol version" that both of them support. Need not be fancy right now, a simple two-way version check is plenty good.
//Peter