[Altosdev-kernel] Drivers (more)
Status: Planning
Brought to you by:
dozz
From: Kernel P. <rzh...@he...> - 2002-04-01 22:19:27
|
Hello, AltOsDev. So.. I've been thinking on the drivers model for quite a while, but haven't come up with anything. How are we going to write drivers?? I suggest something like what I've seen in FreeBSD (don't know about Linux). A driver is declared by some magic macro (like DRIVER_MODULE([...])) right in the C-source. I have no clue how it works, but somehow it does =) . (If anyone is interested, I can post a link to FreeBSD drivers programming guide.) The thing is, that we can define this macro in such a way, so that it produces an exportable (global) symbol. So, when we load the driver, we can easily find the its description. This description (defined by the above-mentioned DRIVER_MODULE or something) is basically a structure which lists the name of the driver and pointers to the list of methods it allows (open, close, ioctl, etc.). This seems rather easy. Well, now the hardest part starts. First, how do we organise the info about drivers inside the kernel (in run-time, I mean)? Say, we have loaded a PCI bus driver, which has found that there are 5 devices attached to it. How is this information going to be passed to the kernel? (It's also clear now the we have to maintain a tree-like structure for the list of drivers. Or am I wrong?) Then.. suppose we have a bunch of drivers loaded now, that represent the physical devices. But we also need virtual devices (I mean, non-physical, or not strictly phisical), like a console, various partitions on the harddrive etc. How are they going to be loaded and assigned to the correct device? I guess we wouldn't like to reinvent a wheel, so if you are familiar with any existing implementation of this, please tell me. New ideas are also welcome. Also.. I have no clue of how to support non-self-enumerating buses (like ISA), but I don't think that's a problem right now, as we don't have any drivers at all. Then.. I guess we would have to write a simple statically-linked C library for the drivers (because drivers are executables, and cannot import anything from the kernel). It would also provide the means of IPC transparent to the driver. Suggestions are welcome.. HEY, GUYS, WAKE UP!!!!!!!! =)) -- Regards, Kernel Panic mailto:rzh...@he... |