* DEC Unix and memory mapped IO
@ 1997-12-17 5:00 Rob Carter
1997-12-18 5:00 ` Monty Brandenberg
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Rob Carter @ 1997-12-17 5:00 UTC (permalink / raw)
Hello All,
I have a question concerning memory mapped IO and DEC Unix. I have
done some programming under VMS with D/A, A/D cards and parallel
interfaces and have used memory mapping using the SYS$CRMPSC system
service to create a global mapped section into IO address space and
then reading and writing into the registers on the cards. I have done
this on VAXen with QBus and also on an Alpha Station 200 running
OpenVMS on the ISA bus.
Now comes the question. We also have an Alpha Station 200 running
Digital Unix. Is it also possible to use the same techniques to access
card registers? We have the full DEC OSF/1 documentation set and I
have had a look through the Device Driver manuals, but I have not found
any examples of how to do this. I have found the documentation on the
mmap() function but am not sure if this is the way to proceed. If
anyone has done this succesfully I would appreciate any hints they
could give.
Thanks in advance
Rob Carter
--
Rob Carter Physical Chemistry Institute
Tel: +41-1-63-54486 University of Zuerich
E-mail: carter@pci.unizh.ch Switzerland.
Reply hazy; come back later.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: DEC Unix and memory mapped IO
1997-12-17 5:00 DEC Unix and memory mapped IO Rob Carter
@ 1997-12-18 5:00 ` Monty Brandenberg
1997-12-18 5:00 ` Monty Brandenberg
1997-12-18 5:00 ` Monty Brandenberg
2 siblings, 0 replies; 4+ messages in thread
From: Monty Brandenberg @ 1997-12-18 5:00 UTC (permalink / raw)
To: Rob Carter
Rob Carter wrote:
>
> Now comes the question. We also have an Alpha Station 200 running
> Digital Unix. Is it also possible to use the same techniques to access
> card registers? We have the full DEC OSF/1 documentation set and I
> have had a look through the Device Driver manuals, but I have not found
> any examples of how to do this. I have found the documentation on the
> mmap() function but am not sure if this is the way to proceed. If
> anyone has done this succesfully I would appreciate any hints they
> could give.
>
Broadly, there are two ways to go about this:
1. Use devsw.mmap() as you've discovered. In Digital Unix, the
mmap syscall creates the requested process virtual address range
managed by a mach memory object which is backed by information
associating it with your device driver (via major/minor ids on
the file descriptor). The pages are not valid, however. Later,
as your process touches those pages, the system fields the resulting
address translation traps and this code invokes your driver's
mmap interface to translate an offset into a physical page number
(or -1 if you want to raise an error). The ppn is used to construct
a suitable pte for the faulting instruction which is then
restarted. This happens once per page per process.
2. Use devsw.ioctl(). Create your own private interface to perform
device mappings. The downside is that not all of the interesting
interfaces are documented yet (vm_map_region, some others). The plus
side is that it allows an opportunity to do further optimizations
such as using 'BigPage' hints in the Alpha architecture to map
huge chunks of address space with a single pte. Demand support!
In all cases keep in mind:
1. The docs formally declare mmap 'unsupported on some hardware'
so there's the disclaimer.
2. Deal with security issues such as authentication and authorization
and identifying what device structures are suitable for a process
and which are not (clue: dma registers are not).
3. Handle process exit. devsw.close() is invoked only on last
close. So process info can become stale.
4. Understand the architecture. On alpha, this means sparse and
dense address space mappings for I/O devices (pre-ev6). Also
understand the data synchronization requirements in the Alpha
arch manual. This is a *very* good section to read.
m
--
Monty Brandenberg Consulting for:
MCB, Inc. Digital Equipment Corp.
45 Putnam Avenue mcbinc@world.std.com montyb@eng.pko.dec.com
Cambridge, MA 02139 617.864.6907 508.493.2702
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: DEC Unix and memory mapped IO
1997-12-17 5:00 DEC Unix and memory mapped IO Rob Carter
1997-12-18 5:00 ` Monty Brandenberg
1997-12-18 5:00 ` Monty Brandenberg
@ 1997-12-18 5:00 ` Monty Brandenberg
2 siblings, 0 replies; 4+ messages in thread
From: Monty Brandenberg @ 1997-12-18 5:00 UTC (permalink / raw)
To: Rob Carter
Rob Carter wrote:
>
> Now comes the question. We also have an Alpha Station 200 running
> Digital Unix. Is it also possible to use the same techniques to access
> card registers? We have the full DEC OSF/1 documentation set and I
> have had a look through the Device Driver manuals, but I have not found
> any examples of how to do this. I have found the documentation on the
> mmap() function but am not sure if this is the way to proceed. If
> anyone has done this succesfully I would appreciate any hints they
> could give.
>
Broadly, there are two ways to go about this:
1. Use devsw.mmap() as you've discovered. In Digital Unix, the
mmap syscall creates the requested process virtual address range
managed by a mach memory object which is backed by information
associating it with your device driver (via major/minor ids on
the file descriptor). The pages are not valid, however. Later,
as your process touches those pages, the system fields the resulting
address translation traps and this code invokes your driver's
mmap interface to translate an offset into a physical page number
(or -1 if you want to raise an error). The ppn is used to construct
a suitable pte for the faulting instruction which is then
restarted. This happens once per page per process.
2. Use devsw.ioctl(). Create your own private interface to perform
device mappings. The downside is that not all of the interesting
interfaces are documented yet (vm_map_region, some others). The plus
side is that it allows an opportunity to do further optimizations
such as using 'BigPage' hints in the Alpha architecture to map
huge chunks of address space with a single pte. Demand support!
In all cases keep in mind:
1. The docs formally declare mmap 'unsupported on some hardware'
so there's the disclaimer.
2. Deal with security issues such as authentication and authorization
and identifying what device structures are suitable for a process
and which are not (clue: dma registers are not).
3. Handle process exit. devsw.close() is invoked only on last
close. So process info can become stale.
4. Understand the architecture. On alpha, this means sparse and
dense address space mappings for I/O devices (pre-ev6). Also
understand the data synchronization requirements in the Alpha
arch manual. This is a *very* good section to read.
m
--
Monty Brandenberg Consulting for:
MCB, Inc. Digital Equipment Corp.
45 Putnam Avenue mcbinc@world.std.com montyb@eng.pko.dec.com
Cambridge, MA 02139 617.864.6907 508.493.2702
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: DEC Unix and memory mapped IO
1997-12-17 5:00 DEC Unix and memory mapped IO Rob Carter
1997-12-18 5:00 ` Monty Brandenberg
@ 1997-12-18 5:00 ` Monty Brandenberg
1997-12-18 5:00 ` Monty Brandenberg
2 siblings, 0 replies; 4+ messages in thread
From: Monty Brandenberg @ 1997-12-18 5:00 UTC (permalink / raw)
To: Rob Carter
Rob Carter wrote:
>
> Now comes the question. We also have an Alpha Station 200 running
> Digital Unix. Is it also possible to use the same techniques to access
> card registers? We have the full DEC OSF/1 documentation set and I
> have had a look through the Device Driver manuals, but I have not found
> any examples of how to do this. I have found the documentation on the
> mmap() function but am not sure if this is the way to proceed. If
> anyone has done this succesfully I would appreciate any hints they
> could give.
>
Broadly, there are two ways to go about this:
1. Use devsw.mmap() as you've discovered. In Digital Unix, the
mmap syscall creates the requested process virtual address range
managed by a mach memory object which is backed by information
associating it with your device driver (via major/minor ids on
the file descriptor). The pages are not valid, however. Later,
as your process touches those pages, the system fields the resulting
address translation traps and this code invokes your driver's
mmap interface to translate an offset into a physical page number
(or -1 if you want to raise an error). The ppn is used to construct
a suitable pte for the faulting instruction which is then
restarted. This happens once per page per process.
2. Use devsw.ioctl(). Create your own private interface to perform
device mappings. The downside is that not all of the interesting
interfaces are documented yet (vm_map_region, some others). The plus
side is that it allows an opportunity to do further optimizations
such as using 'BigPage' hints in the Alpha architecture to map
huge chunks of address space with a single pte. Demand support!
In all cases keep in mind:
1. The docs formally declare mmap 'unsupported on some hardware'
so there's the disclaimer.
2. Deal with security issues such as authentication and authorization
and identifying what device structures are suitable for a process
and which are not (clue: dma registers are not).
3. Handle process exit. devsw.close() is invoked only on last
close. So process info can become stale.
4. Understand the architecture. On alpha, this means sparse and
dense address space mappings for I/O devices (pre-ev6). Also
understand the data synchronization requirements in the Alpha
arch manual. This is a *very* good section to read.
m
--
Monty Brandenberg Consulting for:
MCB, Inc. Digital Equipment Corp.
45 Putnam Avenue mcbinc@world.std.com montyb@eng.pko.dec.com
Cambridge, MA 02139 617.864.6907 508.493.2702
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~1997-12-18 5:00 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
1997-12-17 5:00 DEC Unix and memory mapped IO Rob Carter
1997-12-18 5:00 ` Monty Brandenberg
1997-12-18 5:00 ` Monty Brandenberg
1997-12-18 5:00 ` Monty Brandenberg
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox