Deleted Added
full compact
busdma_dmar.c (257251) busdma_dmar.c (259512)
1/*-
2 * Copyright (c) 2013 The FreeBSD Foundation
3 * All rights reserved.
4 *
5 * This software was developed by Konstantin Belousov <kib@FreeBSD.org>
6 * under sponsorship from the FreeBSD Foundation.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 14 unchanged lines hidden (view full) ---

23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
1/*-
2 * Copyright (c) 2013 The FreeBSD Foundation
3 * All rights reserved.
4 *
5 * This software was developed by Konstantin Belousov <kib@FreeBSD.org>
6 * under sponsorship from the FreeBSD Foundation.
7 *
8 * Redistribution and use in source and binary forms, with or without

--- 14 unchanged lines hidden (view full) ---

23 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
24 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE.
28 */
29
30#include <sys/cdefs.h>
31__FBSDID("$FreeBSD: head/sys/x86/iommu/busdma_dmar.c 257251 2013-10-28 13:33:29Z kib $");
31__FBSDID("$FreeBSD: stable/10/sys/x86/iommu/busdma_dmar.c 259512 2013-12-17 13:49:35Z kib $");
32
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/malloc.h>
36#include <sys/bus.h>
37#include <sys/conf.h>
38#include <sys/interrupt.h>
39#include <sys/kernel.h>

--- 118 unchanged lines hidden (view full) ---

158
159 *dmat = NULL;
160 error = common_bus_dma_tag_create(parent != NULL ?
161 &((struct bus_dma_tag_dmar *)parent)->common : NULL, alignment,
162 boundary, lowaddr, highaddr, filter, filterarg, maxsize,
163 nsegments, maxsegsz, flags, lockfunc, lockfuncarg,
164 sizeof(struct bus_dma_tag_dmar), (void **)&newtag);
165 if (error != 0)
32
33#include <sys/param.h>
34#include <sys/systm.h>
35#include <sys/malloc.h>
36#include <sys/bus.h>
37#include <sys/conf.h>
38#include <sys/interrupt.h>
39#include <sys/kernel.h>

--- 118 unchanged lines hidden (view full) ---

158
159 *dmat = NULL;
160 error = common_bus_dma_tag_create(parent != NULL ?
161 &((struct bus_dma_tag_dmar *)parent)->common : NULL, alignment,
162 boundary, lowaddr, highaddr, filter, filterarg, maxsize,
163 nsegments, maxsegsz, flags, lockfunc, lockfuncarg,
164 sizeof(struct bus_dma_tag_dmar), (void **)&newtag);
165 if (error != 0)
166 return (error);
166 goto out;
167
168 oldtag = (struct bus_dma_tag_dmar *)parent;
169 newtag->common.impl = &bus_dma_dmar_impl;
170 newtag->ctx = oldtag->ctx;
171 newtag->owner = oldtag->owner;
167
168 oldtag = (struct bus_dma_tag_dmar *)parent;
169 newtag->common.impl = &bus_dma_dmar_impl;
170 newtag->ctx = oldtag->ctx;
171 newtag->owner = oldtag->owner;
172 error = 0;
173
172
174 if (error != 0)
175 free(newtag, M_DEVBUF);
176 else
177 *dmat = (bus_dma_tag_t)newtag;
173 *dmat = (bus_dma_tag_t)newtag;
174out:
178 CTR4(KTR_BUSDMA, "%s returned tag %p tag flags 0x%x error %d",
179 __func__, newtag, (newtag != NULL ? newtag->common.flags : 0),
180 error);
181 return (error);
182}
183
184static int
185dmar_bus_dma_tag_destroy(bus_dma_tag_t dmat1)

--- 153 unchanged lines hidden (view full) ---

339 dmar_gaddr_t size;
340 bus_size_t buflen1;
341 int error, idx, gas_flags, seg;
342
343 if (segs == NULL)
344 segs = tag->segments;
345 ctx = tag->ctx;
346 seg = *segp;
175 CTR4(KTR_BUSDMA, "%s returned tag %p tag flags 0x%x error %d",
176 __func__, newtag, (newtag != NULL ? newtag->common.flags : 0),
177 error);
178 return (error);
179}
180
181static int
182dmar_bus_dma_tag_destroy(bus_dma_tag_t dmat1)

--- 153 unchanged lines hidden (view full) ---

336 dmar_gaddr_t size;
337 bus_size_t buflen1;
338 int error, idx, gas_flags, seg;
339
340 if (segs == NULL)
341 segs = tag->segments;
342 ctx = tag->ctx;
343 seg = *segp;
344 error = 0;
347 idx = 0;
348 while (buflen > 0) {
349 seg++;
350 if (seg >= tag->common.nsegments) {
351 error = EFBIG;
352 break;
353 }
354 buflen1 = buflen > tag->common.maxsegsz ?

--- 400 unchanged lines hidden ---
345 idx = 0;
346 while (buflen > 0) {
347 seg++;
348 if (seg >= tag->common.nsegments) {
349 error = EFBIG;
350 break;
351 }
352 buflen1 = buflen > tag->common.maxsegsz ?

--- 400 unchanged lines hidden ---