Home | History | Annotate | Download | only in common
History log of /src/sys/arch/alpha/common/bus_dma.c
RevisionDateAuthorComments
 1.74  26-Jul-2022  andvar s/functin/function/ in copy pasted comment.
 1.73  19-Jul-2021  thorpej There is already a fast-path in pmap_extract() for the kernel pmap, so
don't bother doing a conditional for kernel vs. user-space here.

KASSERT() that pmap_extract() succeeds; it is a programming error if
it does not, and it's not a great idea to insert a garbage address
into the SGMAP page table.
 1.72  07-May-2021  thorpej Liberally sprinkle static around to get more symbols out of the
global namespace. A small bit of const poisoning in the TC code.
 1.71  18-Nov-2020  thorpej branches: 1.71.4;
malloc(9) -> kmem(9)
 1.70  11-Oct-2020  thorpej branches: 1.70.2;
Add some bus_dma instrumentation.
 1.69  02-Oct-2012  christos move common/bus_dma/ -> dev/bus_dma/
 1.68  01-Jul-2011  dyoung branches: 1.68.2; 1.68.12;
#include <sys/bus.h> instead of <machine/bus.h>.
 1.67  21-Aug-2009  thorpej Use bus_dmamem common.
 1.66  04-Jun-2008  ad vm_page: put TAILQ_ENTRY into a union with LIST_ENTRY, so we can use both.
 1.65  28-Apr-2008  martin branches: 1.65.2;
Remove clause 3 and 4 from TNF licenses
 1.64  04-Mar-2007  yamt branches: 1.64.40; 1.64.42; 1.64.44;
fix fallout from caddr_t changes.
 1.63  04-Mar-2007  christos Kill caddr_t; there will be some MI fallout, but it will be fixed shortly.
 1.62  01-Mar-2006  yamt branches: 1.62.20;
merge yamt-uio_vmspace branch.

- use vmspace rather than proc or lwp where appropriate.
the latter is more natural to specify an address space.
(and less likely to be abused for random purposes.)
- fix a swdmover race.
 1.61  11-Dec-2005  christos branches: 1.61.2; 1.61.4; 1.61.6;
merge ktrace-lwp.
 1.60  24-Nov-2005  yamt bus_dmamem_map: honour BUS_DMA_NOWAIT. noted by Manuel Bouyer.
bus_space_map: always do NOWAIT allocation as it used to be before yamt-km.

we have too many copies!
 1.59  30-Jul-2005  mhitch branches: 1.59.6;
Check for stale flags in the DMA map. This was causing crashes on an ES40
with more than 1GB of memory due to a bug in one of the drivers. From
Jason Thorpe.
 1.58  01-Apr-2005  yamt branches: 1.58.2;
merge yamt-km branch.
- don't use managed mappings/backing objects for wired memory allocations.
save some resources like pv_entry. also fix (most of) PR/27030.
- simplify kernel memory management API.
- simplify pmap bootstrap of some ports.
- some related cleanups.
 1.57  09-Mar-2005  matt branches: 1.57.2;
Add a dm_maxsegsz public member to bus_dmamap_t. This allows a user of the API
to select the maximum segment size for each bus_dmamap_load (up to the maxsegsz
supplied to bus_dmamap_create). dm_maxsegsz is reset to the value supplied to
bus_dmamap_create when the dmamap is unloaded.
 1.56  09-Mar-2005  simonb Add an extra `i' to notifes/notifed.
 1.55  29-Jun-2003  fvdl branches: 1.55.2; 1.55.10; 1.55.12;
Back out the lwp/ktrace changes. They contained a lot of colateral damage,
and need to be examined and discussed more.
 1.54  28-Jun-2003  darrenr Pass lwp pointers throughtout the kernel, as required, so that the lwpid can
be inserted into ktrace records. The general change has been to replace
"struct proc *" with "struct lwp *" in various function prototypes, pass
the lwp through and use l_proc to get the process pointer when needed.

Bump the kernel rev up to 1.6V
 1.53  09-Apr-2003  thorpej Add support for using cached mbuf and cluster phys addrs.
 1.52  01-Apr-2003  thorpej Use PAGE_SIZE rather than NBPG.
 1.51  09-Oct-2002  nathanw In _bus_dmamem_alloc_range(), respect the high end of the caller's range.
 1.50  02-Jun-2002  drochner move initialization of the "struct pglist" returned by uvm_pglistalloc()
from the calling code into uvm_pglistalloc() itself for consistency
and easier error handling
 1.49  26-Apr-2002  thorpej branches: 1.49.2;
Keep track of which DMA window was actually used to map the
request (not always the passed in DMA tag if we try direct-map
and then fall back to sgmap-mapped). Use the actual window
when performing dmamap_sync and dmamap_unload operations.

Fixes DMA resource leak on systems with 2G+ RAM. Thanks to
Matt Thomas for help debugging this.
 1.48  10-Sep-2001  chris Update pmap_update to now take the updated pmap as an argument.
This will allow improvements to the pmaps so that they can more easily defer expensive operations, eg tlb/cache flush, til the last possible moment.

Currently this is a no-op on most platforms, so they should see no difference.

Reviewed by Jason.
 1.47  12-Jul-2001  thorpej branches: 1.47.2; 1.47.4;
bzero -> memset
 1.46  26-May-2001  chs branches: 1.46.2;
replace vm_page_t with struct vm_page *.
 1.45  24-Apr-2001  thorpej Sprinkle pmap_update() calls after calls to:
- pmap_enter()
- pmap_remove()
- pmap_protect()
- pmap_kenter_pa()
- pmap_kremove()
as described in pmap(9).

These calls are relatively conservative. It may be possible to
optimize these a little more.
 1.44  21-Mar-2001  soren s/vm_page_alloc_memory/uvm_pglistalloc/ in panic message.
 1.43  03-Jan-2001  thorpej branches: 1.43.2;
Some more slight cleanup.
 1.42  03-Jan-2001  thorpej Fix a couple of comments.
 1.41  03-Jan-2001  thorpej ANSI'ify.
 1.40  17-Jul-2000  thorpej When computing the segment size, consider the maximum segment
size in the DMA map.
 1.39  29-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.38  26-Jun-2000  mrg remove/move more mach vm header files:

<vm/pglist.h> -> <uvm/uvm_pglist.h>
<vm/vm_inherit.h> -> <uvm/uvm_inherit.h>
<vm/vm_kern.h> -> into <uvm/uvm_extern.h>
<vm/vm_object.h> -> nothing
<vm/vm_pager.h> -> into <uvm/uvm_pager.h>

also includes a bunch of <vm/vm_page.h> include removals (due to redudancy
with <vm/vm.h>), and a scattering of other similar headers.
 1.37  26-Jun-2000  simonb Change the kernel mmap interface so that the offset to map is an
"off_t" and the return value is a "paddr_t" to allow mappings
at offsets past 2^31 bytes. Somewhat inspired by FreeBSD, which
only changed the offset to a "vm_offset_t".

Includes updates for the i386, pc532 and sh3 mmmmap from Jason Thorpe.
 1.36  06-Feb-2000  thorpej branches: 1.36.4;
Implement an internal DMA map flag which prevents coalescing of
adjacent DMA segments.
 1.35  20-Jan-2000  mjacob fix misspelling
 1.34  08-Dec-1999  thorpej Slight changes so that bounce buffers can be implemented for the Jensen.
 1.33  13-Nov-1999  thorpej Update for pmap_enter() API change.
 1.32  12-Sep-1999  chs branches: 1.32.2; 1.32.4; 1.32.8;
eliminate the PMAP_NEW option by making it required for all ports.
ports which previously had no support for PMAP_NEW now implement
the pmap_k* interfaces as wrappers around the non-k versions.
 1.31  08-Jul-1999  thorpej Change the pmap_extract() interface to:
boolean_t pmap_extract(pmap_t, vaddr_t, paddr_t *);
This makes it possible for the pmap to map physical address 0.
 1.30  25-May-1999  thorpej bus_dmamem_map() maps DMA safe memory, which is usually one or more
managed pages, into KVA space. Since the pages are managed, we should
use pmap_enter(), not pmap_kenter_pa().

Also, when entering the mappings, enter with an access_type of
VM_PROT_READ | VM_PROT_WRITE. We do this for a couple of reasons:

(1) On systems that have H/W mod/ref attributes, the hardware
may not be able to track mod/ref done by a bus master.

(2) On systems that have to do mod/ref emulation, this prevents
a mod/ref page fault from potentially happening while in an
interrupt context, which can be problematic.

This latter change is fairly important if we ever want to be able to
transfer DMA-safe memory pages to anonymous memory objects; we will need
to know that the pages are modified, or else data could be lost!

Note that while the pages are unowned (i.e. "just DMA-safe memory pages"),
they won't consume any swap resources, as the mappings are wired, and
the pages aren't on the active or inactive queues.
 1.29  26-Mar-1999  mycroft branches: 1.29.2; 1.29.4;
Changes for modified pmap_enter() API:
* Map the message buffer with access_type = VM_PROT_READ|VM_PROT_WRITE `just
because'.
* Map the file system buffers with access_type = VM_PROT_READ|VM_PROT_WRITE to
avoid possible problems with pagemove().
* Do not use VM_PROT_EXEC with either of the above.
* Map pages for /dev/mem with access_type = prot. Also, DO NOT use
pmap_kenter() for this, as we DO NOT want to lose modification information.
* Map pages in dumpsys() with VM_PROT_READ.
* Map pages in m68k mappedcopyin()/mappedcopyout() and writeback() with
access_type = prot.
* For now, bus_dma*(), pmap_map(), vmapbuf(), and similar functions still use
access_type = 0. This should probably be revisited.
 1.28  24-Mar-1999  mrg completely remove Mach VM support. all that is left is the all the
header files as UVM still uses (most of) these.
 1.27  21-Sep-1998  thorpej Make bus_dmamap_load_uio() work, from Kevin Lahey <kml@nas.nasa.gov>.
 1.26  17-Aug-1998  thorpej Some internal cleanup; pass a tag around, not individual arguments.
 1.25  14-Aug-1998  thorpej vm_offset_t -> {paddr_t,vaddr_t}, vm_size_t -> vsize_t
 1.24  17-Jul-1998  thorpej Implement bus_dmamap_load_uio().
 1.23  03-Jun-1998  thorpej Allow the DMA tag to specify a boundary contraint. If the device has a
more strict boundary, the map will use it, otherwise the map will inherit
the tag's, unless the tag's constraint is 0 (no boundary constraint).
 1.22  03-Jun-1998  thorpej Sync the bus_dmamap_load back-end functions between alpha and i386. (only
slight, unnecessary differences)
 1.21  29-May-1998  matt more optimizations
 1.20  29-May-1998  matt Add boundary checks to _bus_dma_load...
 1.19  13-May-1998  thorpej Add support for chaining DMA windows together, for falling back on
SGMAPs if a direct-mapped window fails.
 1.18  07-May-1998  thorpej Simplify the direct-mapped DMA case somewhat by adding a window base
member to the DMA tag, and calling the direct-mapped back-ends directly,
rather than through chipset-specific front-ends which pass the window
base as an additional argument.
 1.17  17-Mar-1998  thorpej Use pmap_kenter_pa() in _bus_dmamem_map() if PMAP_NEW.
 1.16  24-Feb-1998  thorpej Add support for UVM.
 1.15  11-Feb-1998  thorpej Use kernel_map in bus_dmamem_{map,free}().
 1.14  11-Feb-1998  thorpej Use M_DMAMAP where appropriate.
 1.13  04-Feb-1998  thorpej Flush the CPU write buffer in _bus_dmamap_sync().
 1.12  04-Feb-1998  thorpej Add offset and length parameters to bus_dmamap_sync(), used for specifiying
partial syncs of a DMA mapping.
 1.11  04-Feb-1998  thorpej Change the last argument of bus_dmamap_sync() from bus_dmasync_op_t to int,
and allow more than one synchronization operation to be specified in
a single call. Dissallow mixing of PRE and POST operations.
 1.10  04-Feb-1998  thorpej Add dm_mapsize to bus_dmamap_t and rename BUS_DMAMEM_NOSYNC toBUS_DMA_COHERENT.
 1.9  27-Jan-1998  thorpej Implement bus_dmamap_load_mbuf().
 1.8  19-Jan-1998  thorpej If mapping only one segment of DMA memory into KVA space, use K0SEG.
 1.7  09-Jan-1998  thorpej Use avail_start/avail_end.
 1.6  05-Sep-1997  thorpej Implement bus_dmamem_mmap().
 1.5  02-Sep-1997  thorpej Remove references to vm_pmap.
 1.4  02-Sep-1997  thorpej Nuke the idea of <machine/options.h>. It completely defeats the purpose
of fine-grain option dependencies.
 1.3  25-Aug-1997  thorpej Protect access to kmem_map with splimp()/splx(). From Chuck Cranor.
 1.2  06-Jun-1997  thorpej branches: 1.2.2; 1.2.6;
Pull thorpej-bus-dma branch into mainline.
 1.1  05-Jun-1997  thorpej branches: 1.1.2;
file bus_dma.c was initially added on branch thorpej-bus-dma.
 1.1.2.2  06-Jun-1997  thorpej Right, that's a bonk on the head! Zero-length arrays aren't legal
in C. Make the bus_dmamap_t variable-length array size 1, and compensate
for the size screw in _bus_dmamap_create(). Pointed out by Chris Demetriou.
 1.1.2.1  05-Jun-1997  thorpej Move the Alpha bus dma support functions into their own file. Suggested
by Chris Demetriou <cgd@netbsd.org>.
 1.2.6.3  06-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.6.2  04-Sep-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.6.1  27-Aug-1997  thorpej Update marc-pcmcia branch from trunk.
 1.2.2.2  07-Jun-1997  cgd syng thorpej-bus-dma changes with alpha-nwscons branch
 1.2.2.1  06-Jun-1997  cgd file bus_dma.c was added on branch alpha-nwscons on 1997-06-07 04:42:53 +0000
 1.29.4.2  02-Aug-1999  thorpej Update from current.
 1.29.4.1  21-Jun-1999  thorpej Sync w/ -current.
 1.29.2.1  06-Feb-2000  he Pull up revision 1.36 (requested by thorpej):
Fix host->device DMA data corruption problem on DEC Miata
workstations.
 1.32.8.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.32.4.1  14-Nov-1999  fvdl Sync with -current.
 1.32.2.3  27-Mar-2001  bouyer Sync with HEAD.
 1.32.2.2  05-Jan-2001  bouyer Sync with HEAD
 1.32.2.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
A i386 GENERIC kernel compiles without the siop, ahc and bha drivers
(will be updated later). i386 IDE/ATAPI and ncr work, as well as
sparc/esp_sbus. alpha should work as well (untested yet).
siop, ahc and bha will be updated once I've updated the branch to current
-current, as well as machine-dependant code.
 1.36.4.3  27-Apr-2002  he Pull up revision 1.49 (requested by thorpej):
Fix a DMA resource leak on Alpha systems with more than 1GB of
RAM.
 1.36.4.2  18-Jul-2000  thorpej Pull up rev. 1.40:
When computing the segment size, consider the maximum segment
size in the DMA map.
 1.36.4.1  30-Jun-2000  simonb Pull up mmap paddr_t/off_t changes from trunk.
 1.43.2.2  21-Jun-2001  nathanw Catch up to -current.
 1.43.2.1  09-Apr-2001  nathanw Catch up with -current.
 1.46.2.3  23-Jun-2002  jdolecek catch up with -current on kqueue branch
 1.46.2.2  13-Sep-2001  thorpej Update the kqueue branch to HEAD.
 1.46.2.1  03-Aug-2001  lukem update to -current
 1.47.4.1  01-Oct-2001  fvdl Catch up with -current.
 1.47.2.4  18-Oct-2002  nathanw Catch up to -current.
 1.47.2.3  20-Jun-2002  nathanw Catch up to -current.
 1.47.2.2  21-Sep-2001  nathanw Catch up to -current.
 1.47.2.1  12-Jul-2001  nathanw file bus_dma.c was added on branch nathanw_sa on 2001-09-21 22:34:56 +0000
 1.49.2.1  09-Jul-2002  gehenna catch up with -current.
 1.55.12.2  19-Mar-2005  yamt sync with head. xen and whitespace. xen part is not finished.
 1.55.12.1  25-Jan-2005  yamt convert alpha to new apis.
 1.55.10.1  29-Apr-2005  kent sync with -current
 1.55.2.6  11-Dec-2005  christos Sync with head.
 1.55.2.5  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.55.2.4  01-Apr-2005  skrll Sync with HEAD.
 1.55.2.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.55.2.2  18-Sep-2004  skrll Sync with HEAD.
 1.55.2.1  02-Jul-2003  darrenr Apply the aborted ktrace-lwp changes to a specific branch. This is just for
others to review, I'm concerned that patch fuziness may have resulted in some
errant code being generated but I'll look at that later by comparing the diff
from the base to the branch with the file I attempt to apply to it. This will,
at the very least, put the changes in a better context for others to review
them and attempt to tinker with removing passing of 'struct lwp' through
the kernel.
 1.57.2.1  04-Aug-2005  tron Pull up revision 1.59 (requested by thorpej in ticket #635):
Check for stale flags in the DMA map. This was causing crashes on an
ES40
with more than 1GB of memory due to a bug in one of the drivers. From
Jason Thorpe.
 1.58.2.2  03-Sep-2007  yamt sync with head.
 1.58.2.1  21-Jun-2006  yamt sync with head.
 1.59.6.1  29-Nov-2005  yamt sync with head.
 1.61.6.1  22-Apr-2006  simonb Sync with head.
 1.61.4.1  09-Sep-2006  rpaulo sync with head
 1.61.2.2  07-Feb-2006  yamt fix crashes introduced by the previous.
 1.61.2.1  05-Feb-2006  yamt adapt alpha.
 1.62.20.1  12-Mar-2007  rmind Sync with HEAD.
 1.64.44.3  16-Sep-2009  yamt sync with head
 1.64.44.2  04-May-2009  yamt sync with head.
 1.64.44.1  16-May-2008  yamt sync with head.
 1.64.42.2  17-Jun-2008  yamt sync with head.
 1.64.42.1  18-May-2008  yamt sync with head.
 1.64.40.2  05-Jun-2008  mjf Sync with HEAD.

Also fix build.
 1.64.40.1  02-Jun-2008  mjf Sync with HEAD.
 1.65.2.1  23-Jun-2008  wrstuden Sync w/ -current. 34 merge conflicts to follow.
 1.68.12.1  20-Nov-2012  tls Resync to 2012-11-19 00:00:00 UTC
 1.68.2.1  30-Oct-2012  yamt sync with head
 1.70.2.1  14-Dec-2020  thorpej Sync w/ HEAD.
 1.71.4.2  01-Aug-2021  thorpej Sync with HEAD.
 1.71.4.1  13-May-2021  thorpej Sync with HEAD.

RSS XML Feed