Deleted Added
full compact
iommu.c (111553) iommu.c (113238)
1/*
2 * Copyright (c) 1999, 2000 Matthew R. Green
3 * Copyright (c) 2001-2003 Thomas Moestl
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

101 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
102 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
103 * SUCH DAMAGE.
104 *
105 * from: NetBSD: sbus.c,v 1.13 1999/05/23 07:24:02 mrg Exp
106 * from: @(#)sbus.c 8.1 (Berkeley) 6/11/93
107 * from: NetBSD: iommu.c,v 1.42 2001/08/06 22:02:58 eeh Exp
108 *
1/*
2 * Copyright (c) 1999, 2000 Matthew R. Green
3 * Copyright (c) 2001-2003 Thomas Moestl
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions
8 * are met:

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

101 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
102 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
103 * SUCH DAMAGE.
104 *
105 * from: NetBSD: sbus.c,v 1.13 1999/05/23 07:24:02 mrg Exp
106 * from: @(#)sbus.c 8.1 (Berkeley) 6/11/93
107 * from: NetBSD: iommu.c,v 1.42 2001/08/06 22:02:58 eeh Exp
108 *
109 * $FreeBSD: head/sys/sparc64/sparc64/iommu.c 111553 2003-02-26 15:02:55Z mux $
109 * $FreeBSD: head/sys/sparc64/sparc64/iommu.c 113238 2003-04-08 06:35:09Z jake $
110 */
111
112/*
113 * UltraSPARC IOMMU support; used by both the sbus and pci code.
114 * Currently, the IOTSBs are synchronized, because determining the bus the map
115 * is to be loaded for is not possible with the current busdma code.
116 * The code is structured so that the IOMMUs can be easily divorced when that
117 * is fixed.

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

397 }
398 }
399}
400
401/*
402 * Here are the iommu control routines.
403 */
404void
110 */
111
112/*
113 * UltraSPARC IOMMU support; used by both the sbus and pci code.
114 * Currently, the IOTSBs are synchronized, because determining the bus the map
115 * is to be loaded for is not possible with the current busdma code.
116 * The code is structured so that the IOMMUs can be easily divorced when that
117 * is fixed.

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

397 }
398 }
399}
400
401/*
402 * Here are the iommu control routines.
403 */
404void
405iommu_enter(struct iommu_state *is, vm_offset_t va, vm_offset_t pa, int flags)
405iommu_enter(struct iommu_state *is, vm_offset_t va, vm_paddr_t pa, int flags)
406{
407 int64_t tte;
408
409 KASSERT(va >= is->is_dvmabase,
410 ("iommu_enter: va %#lx not in DVMA space", va));
411
412 tte = MAKEIOTTE(pa, !(flags & BUS_DMA_NOWRITE),
413 !(flags & BUS_DMA_NOCACHE), (flags & BUS_DMA_STREAMING));

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

779/*
780 * IOMMU DVMA operations, common to SBUS and PCI.
781 */
782static int
783iommu_dvmamap_load_buffer(bus_dma_tag_t dt, struct iommu_state *is,
784 bus_dmamap_t map, bus_dma_segment_t sgs[], void *buf,
785 bus_size_t buflen, struct thread *td, int flags, int *segp, int align)
786{
406{
407 int64_t tte;
408
409 KASSERT(va >= is->is_dvmabase,
410 ("iommu_enter: va %#lx not in DVMA space", va));
411
412 tte = MAKEIOTTE(pa, !(flags & BUS_DMA_NOWRITE),
413 !(flags & BUS_DMA_NOCACHE), (flags & BUS_DMA_STREAMING));

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

779/*
780 * IOMMU DVMA operations, common to SBUS and PCI.
781 */
782static int
783iommu_dvmamap_load_buffer(bus_dma_tag_t dt, struct iommu_state *is,
784 bus_dmamap_t map, bus_dma_segment_t sgs[], void *buf,
785 bus_size_t buflen, struct thread *td, int flags, int *segp, int align)
786{
787 bus_size_t sgsize;
788 vm_offset_t curaddr, vaddr, voffs;
789 bus_addr_t amask, dvmaddr;
787 bus_addr_t amask, dvmaddr;
788 bus_size_t sgsize;
789 vm_offset_t vaddr, voffs;
790 vm_paddr_t curaddr;
790 int error, sgcnt, firstpg;
791 pmap_t pmap = NULL;
792
793 KASSERT(buflen != 0, ("iommu_dvmamap_load_buffer: buflen == 0!"));
794 if (buflen > dt->dt_maxsize)
795 return (EINVAL);
796
797 if (td != NULL)

--- 282 unchanged lines hidden ---
791 int error, sgcnt, firstpg;
792 pmap_t pmap = NULL;
793
794 KASSERT(buflen != 0, ("iommu_dvmamap_load_buffer: buflen == 0!"));
795 if (buflen > dt->dt_maxsize)
796 return (EINVAL);
797
798 if (td != NULL)

--- 282 unchanged lines hidden ---