diff options
Diffstat (limited to 'include/asm-sparc64/sbus.h')
-rw-r--r-- | include/asm-sparc64/sbus.h | 86 |
1 files changed, 71 insertions, 15 deletions
diff --git a/include/asm-sparc64/sbus.h b/include/asm-sparc64/sbus.h index 7efd49d31bb8..0151cad486f3 100644 --- a/include/asm-sparc64/sbus.h +++ b/include/asm-sparc64/sbus.h | |||
@@ -1,7 +1,6 @@ | |||
1 | /* $Id: sbus.h,v 1.14 2000/02/18 13:50:55 davem Exp $ | 1 | /* sbus.h: Defines for the Sun SBus. |
2 | * sbus.h: Defines for the Sun SBus. | ||
3 | * | 2 | * |
4 | * Copyright (C) 1996, 1999 David S. Miller (davem@redhat.com) | 3 | * Copyright (C) 1996, 1999, 2007 David S. Miller (davem@davemloft.net) |
5 | */ | 4 | */ |
6 | 5 | ||
7 | #ifndef _SPARC64_SBUS_H | 6 | #ifndef _SPARC64_SBUS_H |
@@ -69,7 +68,6 @@ struct sbus_dev { | |||
69 | /* This struct describes the SBus(s) found on this machine. */ | 68 | /* This struct describes the SBus(s) found on this machine. */ |
70 | struct sbus_bus { | 69 | struct sbus_bus { |
71 | struct of_device ofdev; | 70 | struct of_device ofdev; |
72 | void *iommu; /* Opaque IOMMU cookie */ | ||
73 | struct sbus_dev *devices; /* Tree of SBUS devices */ | 71 | struct sbus_dev *devices; /* Tree of SBUS devices */ |
74 | struct sbus_bus *next; /* Next SBUS in system */ | 72 | struct sbus_bus *next; /* Next SBUS in system */ |
75 | int prom_node; /* OBP node of SBUS */ | 73 | int prom_node; /* OBP node of SBUS */ |
@@ -102,9 +100,18 @@ extern struct sbus_bus *sbus_root; | |||
102 | extern void sbus_set_sbus64(struct sbus_dev *, int); | 100 | extern void sbus_set_sbus64(struct sbus_dev *, int); |
103 | extern void sbus_fill_device_irq(struct sbus_dev *); | 101 | extern void sbus_fill_device_irq(struct sbus_dev *); |
104 | 102 | ||
105 | /* These yield IOMMU mappings in consistent mode. */ | 103 | static inline void *sbus_alloc_consistent(struct sbus_dev *sdev , size_t size, |
106 | extern void *sbus_alloc_consistent(struct sbus_dev *, size_t, dma_addr_t *dma_addrp); | 104 | dma_addr_t *dma_handle) |
107 | extern void sbus_free_consistent(struct sbus_dev *, size_t, void *, dma_addr_t); | 105 | { |
106 | return dma_alloc_coherent(&sdev->ofdev.dev, size, | ||
107 | dma_handle, GFP_ATOMIC); | ||
108 | } | ||
109 | |||
110 | static inline void sbus_free_consistent(struct sbus_dev *sdev, size_t size, | ||
111 | void *vaddr, dma_addr_t dma_handle) | ||
112 | { | ||
113 | return dma_free_coherent(&sdev->ofdev.dev, size, vaddr, dma_handle); | ||
114 | } | ||
108 | 115 | ||
109 | #define SBUS_DMA_BIDIRECTIONAL DMA_BIDIRECTIONAL | 116 | #define SBUS_DMA_BIDIRECTIONAL DMA_BIDIRECTIONAL |
110 | #define SBUS_DMA_TODEVICE DMA_TO_DEVICE | 117 | #define SBUS_DMA_TODEVICE DMA_TO_DEVICE |
@@ -112,18 +119,67 @@ extern void sbus_free_consistent(struct sbus_dev *, size_t, void *, dma_addr_t); | |||
112 | #define SBUS_DMA_NONE DMA_NONE | 119 | #define SBUS_DMA_NONE DMA_NONE |
113 | 120 | ||
114 | /* All the rest use streaming mode mappings. */ | 121 | /* All the rest use streaming mode mappings. */ |
115 | extern dma_addr_t sbus_map_single(struct sbus_dev *, void *, size_t, int); | 122 | static inline dma_addr_t sbus_map_single(struct sbus_dev *sdev, void *ptr, |
116 | extern void sbus_unmap_single(struct sbus_dev *, dma_addr_t, size_t, int); | 123 | size_t size, int direction) |
117 | extern int sbus_map_sg(struct sbus_dev *, struct scatterlist *, int, int); | 124 | { |
118 | extern void sbus_unmap_sg(struct sbus_dev *, struct scatterlist *, int, int); | 125 | return dma_map_single(&sdev->ofdev.dev, ptr, size, |
126 | (enum dma_data_direction) direction); | ||
127 | } | ||
128 | |||
129 | static inline void sbus_unmap_single(struct sbus_dev *sdev, | ||
130 | dma_addr_t dma_addr, size_t size, | ||
131 | int direction) | ||
132 | { | ||
133 | dma_unmap_single(&sdev->ofdev.dev, dma_addr, size, | ||
134 | (enum dma_data_direction) direction); | ||
135 | } | ||
136 | |||
137 | static inline int sbus_map_sg(struct sbus_dev *sdev, struct scatterlist *sg, | ||
138 | int nents, int direction) | ||
139 | { | ||
140 | return dma_map_sg(&sdev->ofdev.dev, sg, nents, | ||
141 | (enum dma_data_direction) direction); | ||
142 | } | ||
143 | |||
144 | static inline void sbus_unmap_sg(struct sbus_dev *sdev, struct scatterlist *sg, | ||
145 | int nents, int direction) | ||
146 | { | ||
147 | dma_unmap_sg(&sdev->ofdev.dev, sg, nents, | ||
148 | (enum dma_data_direction) direction); | ||
149 | } | ||
119 | 150 | ||
120 | /* Finally, allow explicit synchronization of streamable mappings. */ | 151 | /* Finally, allow explicit synchronization of streamable mappings. */ |
121 | extern void sbus_dma_sync_single_for_cpu(struct sbus_dev *, dma_addr_t, size_t, int); | 152 | static inline void sbus_dma_sync_single_for_cpu(struct sbus_dev *sdev, |
153 | dma_addr_t dma_handle, | ||
154 | size_t size, int direction) | ||
155 | { | ||
156 | dma_sync_single_for_cpu(&sdev->ofdev.dev, dma_handle, size, | ||
157 | (enum dma_data_direction) direction); | ||
158 | } | ||
122 | #define sbus_dma_sync_single sbus_dma_sync_single_for_cpu | 159 | #define sbus_dma_sync_single sbus_dma_sync_single_for_cpu |
123 | extern void sbus_dma_sync_single_for_device(struct sbus_dev *, dma_addr_t, size_t, int); | 160 | |
124 | extern void sbus_dma_sync_sg_for_cpu(struct sbus_dev *, struct scatterlist *, int, int); | 161 | static inline void sbus_dma_sync_single_for_device(struct sbus_dev *sdev, |
162 | dma_addr_t dma_handle, | ||
163 | size_t size, int direction) | ||
164 | { | ||
165 | /* No flushing needed to sync cpu writes to the device. */ | ||
166 | } | ||
167 | |||
168 | static inline void sbus_dma_sync_sg_for_cpu(struct sbus_dev *sdev, | ||
169 | struct scatterlist *sg, | ||
170 | int nents, int direction) | ||
171 | { | ||
172 | dma_sync_sg_for_cpu(&sdev->ofdev.dev, sg, nents, | ||
173 | (enum dma_data_direction) direction); | ||
174 | } | ||
125 | #define sbus_dma_sync_sg sbus_dma_sync_sg_for_cpu | 175 | #define sbus_dma_sync_sg sbus_dma_sync_sg_for_cpu |
126 | extern void sbus_dma_sync_sg_for_device(struct sbus_dev *, struct scatterlist *, int, int); | 176 | |
177 | static inline void sbus_dma_sync_sg_for_device(struct sbus_dev *sdev, | ||
178 | struct scatterlist *sg, | ||
179 | int nents, int direction) | ||
180 | { | ||
181 | /* No flushing needed to sync cpu writes to the device. */ | ||
182 | } | ||
127 | 183 | ||
128 | extern void sbus_arch_bus_ranges_init(struct device_node *, struct sbus_bus *); | 184 | extern void sbus_arch_bus_ranges_init(struct device_node *, struct sbus_bus *); |
129 | extern void sbus_setup_iommu(struct sbus_bus *, struct device_node *); | 185 | extern void sbus_setup_iommu(struct sbus_bus *, struct device_node *); |