Hi Everyone,
First I'd like to appologise if my query is glaringly obvious. I'm
reasonable new to this, but every that I have read (including the Linux
Device Drivers book) seems to suggest that what I am doing should
work...
I am attempting to allocate a large buffer for DMA transfers in a driver
I am working on. I understand that the kernel normally will not allocate
block of coherent memory larger than 128KB, the suggested solution seems
to be to compile the driver into the kernel and allocate memory at boot
using alloc_bootmem. When attempting this I receive a kernel panic:
=========================================
Loading driver.
bootmem alloc of 4096 bytes failed!
Kernel panic - not syncing: Out of memory
=========================================
This is using:
kernel version 2.6.20
gcc version 4.1.1 20070105 (Red Hat 4.1.1-51)
The config is based on the default i386 config + one extra option to
cause my driver to be compiled in.
The offending code is listed below,
Thank you for any help in advance,
Martyn
=========================================
#include <linux/version.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/bootmem.h>
void *buffer;
static int __init universeII_init(void)
{
printk(KERN_INFO "Loading driver.\n");
buffer = alloc_bootmem(PAGE_SIZE);
return 0;
}
static void __exit universeII_exit(void)
{
if (buffer != NULL) {
free_bootmem((unsigned long)buffer, PAGE_SIZE);
}
printk(KERN_INFO "Driver removed.\n");
}
MODULE_DESCRIPTION("alloc_bootmem_x Test");
MODULE_AUTHOR("Martyn Welch <[email protected]>");
MODULE_LICENSE("GPL");
/** Register initilisation function */
module_init(universeII_init);
/** Register cleanup function */
module_exit(universeII_exit);
________________________________________________________________________
This e-mail has been scanned for all viruses by Star.The service is powered by MessageLabs.
________________________________________________________________________
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[Index of Archives]
[Kernel Newbies]
[Netfilter]
[Bugtraq]
[Photo]
[Stuff]
[Gimp]
[Yosemite News]
[MIPS Linux]
[ARM Linux]
[Linux Security]
[Linux RAID]
[Video 4 Linux]
[Linux for the blind]
[Linux Resources]