Re: Can I get 200M contiguous physical memory?

From: linux-os
Date: Thu Mar 10 2005 - 15:48:23 EST


On Thu, 10 Mar 2005, Nate Edel wrote:

From: "Arjan van de Ven" <arjan@xxxxxxxxxxxxx>
To: "Jason Luo" <abcd.bpmf@xxxxxxxxx>
A data acquisition card. In DMA mode, the card need 200M contiguous
memory for DMA.

(or want to reserve memory at the boot commandline and then do really
really evil hacks)

Such as booting the machine with "mem=(real memory - 200)M" and then just doing an ioremap of the top 200M of memory.

It's not the most elegant way of doing things given that it requires user intervention at boot time, but I'm not sure it counts as a "really evil hack." Code-wise it's very simple - there's sample code in a couple of the in-RAM MTD(*) drivers you can use as a model. I'm not sure if this method will translate easily to non-x86 platforms if that's an issue.

(* /drivers/mtd/devices/slram.c and /drivers/mtd/devices/mtdram.c ; I'm not sure which of these is more up to date.) -

It doesn't require user-intervention either you can put a "mem="
statement in your boot configuration. Here's some GRUB stuff:

# grub.conf generated by anaconda
#
# Note that you do not have to rerun grub after making changes to this file
# NOTICE: You do not have a /boot partition. This means that
# all kernel and initrd paths are relative to /, eg.
# root (hd0,0)
# kernel /boot/vmlinuz-version ro root=/dev/hda1
# initrd /boot/initrd-version.img
#boot=/dev/hda
default=1
timeout=10
splashimage=(hd0,0)/boot/grub/splash.xpm.gz
title Fedora Core (2.6.11)
root (hd0,0)
kernel /boot/vmlinuz-2.6.11 ro root=LABEL=/ mem=768m rhgb
initrd /boot/initrd-2.6.11.img

[SNIPPED...]

Also, You should NEVER require 200 MB of contiguous memory! The Bus-
Master controllers (all of them) provide for scatter-lists. You just
need to know how to program them. You just get the bus address of
every page in an allocated buffer. You just put those addresses in
the linked-list.

Even the old ISA DMA controller can only do 128k (64k words) at
a time. Therefore, you only need 128k of physical memory locked
down at any one time.

Cheers,
Dick Johnson
Penguin : Linux version 2.6.10 on an i686 machine (5537.79 BogoMips).
Notice : All mail here is now cached for review by Dictator Bush.
98.36% of all statistics are fiction.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/