1 /* $NetBSD: sgmap.h,v 1.5 2008/02/03 08:39:48 matt Exp $ */
4 * Copyright (c) 1997, 1998 The NetBSD Foundation, Inc.
7 * This code is derived from software contributed to The NetBSD Foundation
8 * by Jason R. Thorpe of the Numerical Aerospace Simulation Facility,
9 * NASA Ames Research Center.
11 * Redistribution and use in source and binary forms, with or without
12 * modification, are permitted provided that the following conditions
14 * 1. Redistributions of source code must retain the above copyright
15 * notice, this list of conditions and the following disclaimer.
16 * 2. Redistributions in binary form must reproduce the above copyright
17 * notice, this list of conditions and the following disclaimer in the
18 * documentation and/or other materials provided with the distribution.
20 * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
21 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
22 * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
24 * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
36 #include <sys/extent.h>
37 #include <machine/bus.h>
38 #include <machine/pte.h>
41 * A VAX SGMAP's state information. Nothing in the sgmap requires
42 * locking[*], with the exception of the extent map. Locking of the
43 * extent map is handled within the extent manager itself.
45 * [*] While the page table is a `global' resource, access to it is
46 * controlled by the extent map; once a region has been allocated from
47 * the map, that region is effectively `locked'.
50 struct extent
*aps_ex
; /* extent map to manage sgva space */
51 struct pte
*aps_pt
; /* page table */
52 bus_addr_t aps_sgvabase
; /* base of the sgva space */
53 bus_size_t aps_sgvasize
; /* size of the sgva space */
54 bus_addr_t aps_pa
; /* Address in region */
55 unsigned int aps_flags
; /* flags */
58 void vax_sgmap_dmatag_init(bus_dma_tag_t
, void *, size_t);
60 void vax_sgmap_init(bus_dma_tag_t
, struct vax_sgmap
*, const char *,
61 bus_addr_t
, bus_size_t
, struct pte
*, bus_size_t
);
63 int vax_sgmap_alloc(bus_dmamap_t
, bus_size_t
, struct vax_sgmap
*, int);
64 void vax_sgmap_free(bus_dmamap_t
, struct vax_sgmap
*);
66 int vax_sgmap_load(bus_dma_tag_t
, bus_dmamap_t
, void *, bus_size_t
,
67 struct proc
*, int, struct vax_sgmap
*);
69 int vax_sgmap_load_mbuf(bus_dma_tag_t
, bus_dmamap_t
, struct mbuf
*, int,
72 int vax_sgmap_load_uio(bus_dma_tag_t
, bus_dmamap_t
, struct uio
*, int,
75 int vax_sgmap_load_raw(bus_dma_tag_t
, bus_dmamap_t
, bus_dma_segment_t
*,
76 int, bus_size_t
, int, struct vax_sgmap
*);
78 void vax_sgmap_unload(bus_dma_tag_t
, bus_dmamap_t
, struct vax_sgmap
*);
80 #endif /* _VAX_SGMAP_H */