Re: 2.0.30 device handling problems

Alan Cox (alan@lxorguk.ukuu.org.uk)
Tue, 9 Jun 1998 20:46:22 +0100 (BST)


> 1) Even after I set the IRQ line value with the following function call,
> pcibios_write_config_byte(Bus, DevFn, PCI_INTERRUPT_LINE, 0xa);

Whoa, you shouldnt be setting it. The PC bios sets it for you, just
read it back. To start with setting it won't always work out quite as
you expect. IRQ/pin mappings are constrained by the hardware

> 2) Within the driver, I wish to use memory mapped register addresses.
> IO mapped registers are not available. The moment I use the memory
> mapped address of the register, I receive segmentation violation signal.

Yep.

> It is impossible to believe that people do not use memory mapped i/o.
> I did not find a right kind of example device driver that could
> demonstrate how. I set the memory mode access in the following manner

Two ways. Firstly a user process can open /dev/mem and mmap() the device
directly into user space. This may be good considering #3. It means it
has to run as root while it opens the memory to get access but it keeps
the kernel out of the way

> 3) Astronomical data comes in astronomical quantity as well; something like
> 8-10 MBytes/sec sustained all through. It is not undesirable to

> user buffer. I do not know how to specify the physical addresses of
> user memory for example in a DMA. I know how to create a shared memory
> and lock it into the memory so that the physical addresses remain fixed.
> Any help or a good reference would go a long way.

The sound driver does this. It allocates a block of kernel memory then maps
it into the users process. The bus sees it at virt_to_bus(address) and
user programs see it at what ever address they mmap the buffer.

> Is it possible to allocate several of 128K chunks of memory within
> a device driver to hold tha data coming from several ports, worth
> a fraction of a second?

If you have a big machine yes. You can also use vmalloc to get a block
the kernel sees as what big chunk but which isnt in reality that way when
viewed from the device (its a chain of 4K buffers). The 2.1.x bttv driver
does this as this tv capture card can capture into arbitary buffers.

Alan

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu