[comp.sys.hp] iomap functionality

segedy@cspi.UUCP (Cathy Segedy) (09/29/90)

Hello!
	I have a challenging question for everyone.  (If its not a challenge,
then you are the one who has the answer for me!)
	I have a device on an HP-9000, 300 series, VME bus.  It has memory
on it.  Following the rules of the game, it has a seperate device in /dev
to get at the memory.  This is a device with major number 10.  So, I
open the device, and I do an ioctl(fd,IOMAPMAP,&addr);
	If addr is 0, I get some memory which the iomap function inside the
driver has chosen to give me.
	If addr is an address outside of my program, I get some memory
back.
	However, if addr is the address of either a fortran common block or
a C global array, ie, inside my data space, I get a message about there not
being enough space to do the mapping.

	Can anyone help me out?
					thanks!  cathy segedy, CSPI
decvax!cspi!segedy
apollo!cspi!segedy

stroyan@hpfcso.HP.COM (Mike Stroyan) (10/03/90)

>	I have a device on an HP-9000, 300 series, VME bus.  It has memory
>on it.  Following the rules of the game, it has a seperate device in /dev
>to get at the memory.  This is a device with major number 10.  So, I
>open the device, and I do an ioctl(fd,IOMAPMAP,&addr);
>	If addr is 0, I get some memory which the iomap function inside the
>driver has chosen to give me.
>	If addr is an address outside of my program, I get some memory
>back.
>	However, if addr is the address of either a fortran common block or
>a C global array, ie, inside my data space, I get a message about there not
>being enough space to do the mapping.

You misunderstand what IOMAPMAP is about.  The ioctl doesn't need "memory".
It needs addresses.  The call sets up a mapping between virtual addresses
in your process and physical addresses on the device.  If you specify an
addr of zero, then the system picks an address just above the top of the
highest malloc'd area.  If you specify a non-zero addr, then it must be
the base of a range of virtual addresses that are not mapped to any
physical addresses.  The ioctl cannot cover up virtual addresses that
have already been mapped to physical addresses.

Mike Stroyan, mike_stroyan@fc.hp.com