On 1/31/07, Roman Mashak <mrv@xxxxxxxxxxxxx> wrote:
Hello, Rajat! You wrote to "Roman Mashak" <mrv@xxxxxxxxxxxxx> on Wed, 31 Jan 2007 11:00:12 +0530: RJ> The actual request for resources is delayed till the device open time RJ> because no one would actually be using those resources prior to opening RJ> the device. If we allocate the resources at initialization time only, RJ> we would be wasting precious resources without needing them, despite RJ> the same resources could have been used by some other device in use, RJ> while our device has yet not been "opened". I guess it's true for non-PCI devices only, isn't it? Because firmware arranges all necessary resources and stores them in the registers of PCI devices, prior the kernel run.
Yes you are right about the firware. Lets talk about IRQ. The firmware only finds out which irq lines a device can use and sets in its config space, an IRQ number that this device will use i.e. the IRQ that the device should generate when it wants to interrupt the CPU. So, from device's perspective it is set which IRQ should it generate, but the kernel is yet not aware of it. In fact, the kernel only allocates this IRQ to this device (or rather hooks the ISR to this IRQ number) when you call request_irq(). In a scenario where the IRQs are not shared, that IRQ could be used by another device till your device needs it. And hence the need for delay in IRQ allocation from kernel's perspecive. Regards, Rajat -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/