File: /usr/src/linux/include/asm-ia64/sn/dmamap.h
1 /* $Id$
2 *
3 * This file is subject to the terms and conditions of the GNU General Public
4 * License. See the file "COPYING" in the main directory of this archive
5 * for more details.
6 *
7 * Copyright (C) 1992 - 1997, 2000 Silicon Graphics, Inc.
8 * Copyright (C) 2000 by Colin Ngam
9 */
10 #ifndef _ASM_SN_DMAMAP_H
11 #define _ASM_SN_DMAMAP_H
12
13 #include <asm/sn/sv.h>
14
15 #ifdef __cplusplus
16 extern "C" {
17 #endif
18
19 /*
20 * Definitions for allocating, freeing, and using DMA maps
21 */
22
23 /*
24 * DMA map types
25 */
26 #define DMA_SCSI 0
27 #define DMA_A24VME 1 /* Challenge/Onyx only */
28 #define DMA_A32VME 2 /* Challenge/Onyx only */
29 #define DMA_A64VME 3 /* SN0/Racer */
30
31 #define DMA_EISA 4
32
33 #define DMA_PCI32 5 /* SN0/Racer */
34 #define DMA_PCI64 6 /* SN0/Racer */
35
36 /*
37 * DMA map structure as returned by dma_mapalloc()
38 */
39 typedef struct dmamap {
40 int dma_type; /* Map type (see above) */
41 int dma_adap; /* I/O adapter */
42 int dma_index; /* Beginning map register to use */
43 int dma_size; /* Number of map registers to use */
44 paddr_t dma_addr; /* Corresponding bus addr for A24/A32 */
45 caddr_t dma_virtaddr; /* Beginning virtual address that is mapped */
46 } dmamap_t;
47
48 struct alenlist_s;
49
50 /*
51 * Prototypes of exported functions
52 */
53 extern dmamap_t *dma_mapalloc(int, int, int, int);
54 extern void dma_mapfree(dmamap_t *);
55 extern int dma_map(dmamap_t *, caddr_t, int);
56 extern int dma_map2(dmamap_t *, caddr_t, caddr_t, int);
57 extern paddr_t dma_mapaddr(dmamap_t *, caddr_t);
58 #ifdef LATER
59 extern int dma_mapbp(dmamap_t *, buf_t *, int);
60 #endif
61 extern int dma_map_alenlist(dmamap_t *, struct alenlist_s *, size_t);
62 extern uint ev_kvtoiopnum(caddr_t);
63
64 /*
65 * These variables are defined in master.d/kernel
66 */
67 extern struct map *a24map[];
68 extern struct map *a32map[];
69
70 extern int a24_mapsize;
71 extern int a32_mapsize;
72
73 extern lock_t dmamaplock;
74 extern sv_t dmamapout;
75
76 #ifdef __cplusplus
77 }
78 #endif
79
80 /* standard flags values for pio_map routines,
81 * including {xtalk,pciio}_dmamap calls.
82 * NOTE: try to keep these in step with PIOMAP flags.
83 */
84 #define DMAMAP_FIXED 0x1
85 #define DMAMAP_NOSLEEP 0x2
86 #define DMAMAP_INPLACE 0x4
87
88 #define DMAMAP_FLAGS 0x7
89
90 #endif /* _ASM_SN_DMAMAP_H */
91