constants in kernel module (SUMMARY)

Marc SCHAEFER (schaefer@alphanet.ch)
Sun, 19 Apr 1998 16:47:53 +0200


The original question was:
> in a device driver, I have declared:
> static const unsigned char buffer[] = { 'a', 'b', 'c', 'd' };
>
> If I pass virt_to_bus(buffer) to a PCI DMA, I get garbage. If
> I kmalloc() and memcpy() the const buffer to that kmalloc()ed
> memory, and pass do virt_to_bus(kmalloced_memory) to the PCI
> DMA, it works like a charm (ix86 architecture).

Non immediately pertaining answers, but anyway interesting
information:
- for ISA DMA, the memory MUST be located below 16MB (GPF_DMA to
kmalloc()). Constants might not be located there. This does not
look to be a problem with the PCI bus.

PCI information:
- Some PCI devices will need 4 or 8 bytes or even stronger alignment
constraints.
- The constant data could span two different non contiguous pages
and thus only the beginning would be seen (well, I see nothing really).

Unresolved points:
- groudier@club-internet.fr say that virt_to_bus() is not needed
on driver space, which is allocated through vmalloc(). Maybe
this is true on x86 because there virt_to_bus(x) == (x), but
I doubt this is true in the general case.

Thank you to all the people who answered my question.

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