summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--sys/arch/amd64/amd64/sg_dma.c39
-rw-r--r--sys/arch/amd64/pci/iommu.c10
-rw-r--r--sys/arch/sparc64/dev/iommu.c40
-rw-r--r--sys/arch/sparc64/dev/iommuvar.h10
-rw-r--r--sys/arch/sparc64/dev/viommu.c22
5 files changed, 61 insertions, 60 deletions
diff --git a/sys/arch/amd64/amd64/sg_dma.c b/sys/arch/amd64/amd64/sg_dma.c
index f9da3094342..95642705f8b 100644
--- a/sys/arch/amd64/amd64/sg_dma.c
+++ b/sys/arch/amd64/amd64/sg_dma.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: sg_dma.c,v 1.1 2009/04/21 17:05:29 oga Exp $ */
+/* $OpenBSD: sg_dma.c,v 1.2 2009/05/04 16:48:37 oga Exp $ */
/*
* Copyright (c) 2009 Owain G. Ainsworth <oga@openbsd.org>
*
@@ -72,7 +72,7 @@
struct sg_page_entry {
SPLAY_ENTRY(sg_page_entry) spe_node;
paddr_t spe_pa;
- vaddr_t spe_va;
+ bus_addr_t spe_va;
};
/* this should be in the map's dm_cookie. */
@@ -85,23 +85,24 @@ struct sg_page_map {
struct sg_page_entry spm_map[1];
};
-int sg_dmamap_load_seg(bus_dma_tag_t, struct sg_cookie *, bus_dmamap_t,
- bus_dma_segment_t *, int, int, bus_size_t, bus_size_t);
+int sg_dmamap_load_seg(bus_dma_tag_t, struct sg_cookie *,
+ bus_dmamap_t, bus_dma_segment_t *, int, int, bus_size_t,
+ bus_size_t);
struct sg_page_map *sg_iomap_create(int);
-int sg_dmamap_append_range(bus_dma_tag_t, bus_dmamap_t, paddr_t,
- bus_size_t, int, bus_size_t);
-int sg_iomap_insert_page(struct sg_page_map *, paddr_t);
-vaddr_t sg_iomap_translate(struct sg_page_map *, paddr_t);
-void sg_iomap_load_map(struct sg_cookie *, struct sg_page_map *,
- vaddr_t, int);
-void sg_iomap_unload_map(struct sg_cookie *, struct sg_page_map *);
-void sg_iomap_destroy(struct sg_page_map *);
-void sg_iomap_clear_pages(struct sg_page_map *);
+int sg_dmamap_append_range(bus_dma_tag_t, bus_dmamap_t, paddr_t,
+ bus_size_t, int, bus_size_t);
+int sg_iomap_insert_page(struct sg_page_map *, paddr_t);
+bus_addr_t sg_iomap_translate(struct sg_page_map *, paddr_t);
+void sg_iomap_load_map(struct sg_cookie *, struct sg_page_map *,
+ bus_addr_t, int);
+void sg_iomap_unload_map(struct sg_cookie *, struct sg_page_map *);
+void sg_iomap_destroy(struct sg_page_map *);
+void sg_iomap_clear_pages(struct sg_page_map *);
struct sg_cookie *
sg_dmatag_init(char *name, void *hdl, bus_addr_t start, bus_size_t size,
- void bind(void *, vaddr_t, paddr_t, int),
- void unbind(void *, vaddr_t), void flush_tlb(void *))
+ void bind(void *, bus_addr_t, paddr_t, int),
+ void unbind(void *, bus_addr_t), void flush_tlb(void *))
{
struct sg_cookie *cookie;
@@ -235,7 +236,7 @@ sg_dmamap_load(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
sg_iomap_clear_pages(spm);
{ /* Scope */
bus_addr_t a, aend;
- bus_addr_t addr = (vaddr_t)buf;
+ bus_addr_t addr = (bus_addr_t)buf;
int seg_len = buflen;
aend = round_page(addr + seg_len);
@@ -291,7 +292,7 @@ sg_dmamap_load(bus_dma_tag_t t, bus_dmamap_t map, void *buf,
{ /* Scope */
bus_addr_t a, aend;
- bus_addr_t addr = (vaddr_t)buf;
+ bus_addr_t addr = (bus_addr_t)buf;
int seg_len = buflen;
aend = round_page(addr + seg_len);
@@ -899,7 +900,7 @@ sg_iomap_insert_page(struct sg_page_map *spm, paddr_t pa)
*/
void
sg_iomap_load_map(struct sg_cookie *sc, struct sg_page_map *spm,
- vaddr_t vmaddr, int flags)
+ bus_addr_t vmaddr, int flags)
{
struct sg_page_entry *e;
int i;
@@ -930,7 +931,7 @@ sg_iomap_unload_map(struct sg_cookie *sc, struct sg_page_map *spm)
/*
* Translate a physical address (pa) into a DVMA address.
*/
-vaddr_t
+bus_addr_t
sg_iomap_translate(struct sg_page_map *spm, paddr_t pa)
{
struct sg_page_entry *e, pe;
diff --git a/sys/arch/amd64/pci/iommu.c b/sys/arch/amd64/pci/iommu.c
index 50eeb79493b..12827f7f60c 100644
--- a/sys/arch/amd64/pci/iommu.c
+++ b/sys/arch/amd64/pci/iommu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iommu.c,v 1.28 2009/04/21 17:05:29 oga Exp $ */
+/* $OpenBSD: iommu.c,v 1.29 2009/05/04 16:48:37 oga Exp $ */
/*
* Copyright (c) 2005 Jason L. Wright (jason@thought.net)
@@ -120,8 +120,8 @@ void amdgart_dumpregs(struct amdgart_softc *);
int amdgart_ok(pci_chipset_tag_t, pcitag_t);
int amdgart_enabled(pci_chipset_tag_t, pcitag_t);
void amdgart_initpt(struct amdgart_softc *, u_long);
-void amdgart_bind_page(void *, vaddr_t, paddr_t, int);
-void amdgart_unbind_page(void *, vaddr_t);
+void amdgart_bind_page(void *, bus_addr_t, paddr_t, int);
+void amdgart_unbind_page(void *, bus_addr_t);
void amdgart_invalidate(void *);
void amdgart_invalidate_wait(struct amdgart_softc *);
@@ -143,7 +143,7 @@ struct bus_dma_tag amdgart_bus_dma_tag = {
};
void
-amdgart_bind_page(void *handle, vaddr_t offset, paddr_t page, int flags)
+amdgart_bind_page(void *handle, bus_addr_t offset, paddr_t page, int flags)
{
struct amdgart_softc *sc = handle;
u_int32_t pgno, pte;
@@ -155,7 +155,7 @@ amdgart_bind_page(void *handle, vaddr_t offset, paddr_t page, int flags)
}
void
-amdgart_unbind_page(void *handle, vaddr_t offset)
+amdgart_unbind_page(void *handle, bus_addr_t offset)
{
struct amdgart_softc *sc = handle;
u_int32_t pgno;
diff --git a/sys/arch/sparc64/dev/iommu.c b/sys/arch/sparc64/dev/iommu.c
index 97243af304f..850e086aa21 100644
--- a/sys/arch/sparc64/dev/iommu.c
+++ b/sys/arch/sparc64/dev/iommu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: iommu.c,v 1.59 2009/05/03 13:44:05 kettenis Exp $ */
+/* $OpenBSD: iommu.c,v 1.60 2009/05/04 16:48:37 oga Exp $ */
/* $NetBSD: iommu.c,v 1.47 2002/02/08 20:03:45 eeh Exp $ */
/*
@@ -71,10 +71,10 @@ int iommudebug = IDB_INFO;
#define DPRINTF(l, s)
#endif
-void iommu_enter(struct iommu_state *, struct strbuf_ctl *, vaddr_t, paddr_t,
- int);
-void iommu_remove(struct iommu_state *, struct strbuf_ctl *, vaddr_t);
-int iommu_dvmamap_sync_range(struct strbuf_ctl*, vaddr_t, bus_size_t);
+void iommu_enter(struct iommu_state *, struct strbuf_ctl *, bus_addr_t,
+ paddr_t, int);
+void iommu_remove(struct iommu_state *, struct strbuf_ctl *, bus_addr_t);
+int iommu_dvmamap_sync_range(struct strbuf_ctl*, bus_addr_t, bus_size_t);
int iommu_strbuf_flush_done(struct iommu_map_state *);
int iommu_dvmamap_load_seg(bus_dma_tag_t, struct iommu_state *,
bus_dmamap_t, bus_dma_segment_t *, int, int, bus_size_t, bus_size_t);
@@ -86,12 +86,12 @@ void iommu_dvmamap_print_map(bus_dma_tag_t, struct iommu_state *,
bus_dmamap_t);
int iommu_dvmamap_append_range(bus_dma_tag_t, bus_dmamap_t, paddr_t,
bus_size_t, int, bus_size_t);
-int64_t iommu_tsb_entry(struct iommu_state *, vaddr_t);
+int64_t iommu_tsb_entry(struct iommu_state *, bus_addr_t);
void strbuf_reset(struct strbuf_ctl *);
int iommu_iomap_insert_page(struct iommu_map_state *, paddr_t);
-vaddr_t iommu_iomap_translate(struct iommu_map_state *, paddr_t);
+bus_addr_t iommu_iomap_translate(struct iommu_map_state *, paddr_t);
void iommu_iomap_load_map(struct iommu_state *, struct iommu_map_state *,
- vaddr_t, int);
+ bus_addr_t, int);
void iommu_iomap_unload_map(struct iommu_state *, struct iommu_map_state *);
struct iommu_map_state *iommu_iomap_create(int);
void iommu_iomap_destroy(struct iommu_map_state *);
@@ -103,7 +103,7 @@ void _iommu_dvmamap_sync(bus_dma_tag_t, bus_dma_tag_t, bus_dmamap_t,
* Initiate an STC entry flush.
*/
static inline void
-iommu_strbuf_flush(struct strbuf_ctl *sb, vaddr_t va)
+iommu_strbuf_flush(struct strbuf_ctl *sb, bus_addr_t va)
{
#ifdef DEBUG
if (sb->sb_flush == NULL) {
@@ -306,7 +306,7 @@ strbuf_reset(struct strbuf_ctl *sb)
* the BUS_DMA_STREAMING flag is set.
*/
void
-iommu_enter(struct iommu_state *is, struct strbuf_ctl *sb, vaddr_t va,
+iommu_enter(struct iommu_state *is, struct strbuf_ctl *sb, bus_addr_t va,
paddr_t pa, int flags)
{
int64_t tte;
@@ -365,7 +365,7 @@ iommu_enter(struct iommu_state *is, struct strbuf_ctl *sb, vaddr_t va,
* as an STC entry exists.)
*/
void
-iommu_remove(struct iommu_state *is, struct strbuf_ctl *sb, vaddr_t va)
+iommu_remove(struct iommu_state *is, struct strbuf_ctl *sb, bus_addr_t va)
{
int64_t *tte_ptr = &is->is_tsb[IOTSBSLOT(va, is->is_tsbsize)];
int64_t tte;
@@ -412,7 +412,7 @@ iommu_remove(struct iommu_state *is, struct strbuf_ctl *sb, vaddr_t va)
* Find the physical address of a DVMA address (debug routine).
*/
paddr_t
-iommu_extract(struct iommu_state *is, vaddr_t dva)
+iommu_extract(struct iommu_state *is, bus_addr_t dva)
{
int64_t tte = 0;
@@ -426,7 +426,7 @@ iommu_extract(struct iommu_state *is, vaddr_t dva)
* Lookup a TSB entry for a given DVMA (debug routine).
*/
int64_t
-iommu_lookup_tte(struct iommu_state *is, vaddr_t dva)
+iommu_lookup_tte(struct iommu_state *is, bus_addr_t dva)
{
int64_t tte = 0;
@@ -455,7 +455,7 @@ iommu_fetch_tte(struct iommu_state *is, paddr_t pa)
* Fetch a TSB entry with some sanity checking.
*/
int64_t
-iommu_tsb_entry(struct iommu_state *is, vaddr_t dva)
+iommu_tsb_entry(struct iommu_state *is, bus_addr_t dva)
{
int64_t tte;
@@ -705,7 +705,7 @@ iommu_dvmamap_load(bus_dma_tag_t t, bus_dma_tag_t t0, bus_dmamap_t map,
iommu_iomap_clear_pages(ims);
{ /* Scope */
bus_addr_t a, aend;
- bus_addr_t addr = (vaddr_t)buf;
+ bus_addr_t addr = (bus_addr_t)buf;
int seg_len = buflen;
aend = round_page(addr + seg_len);
@@ -777,7 +777,7 @@ iommu_dvmamap_load(bus_dma_tag_t t, bus_dma_tag_t t0, bus_dmamap_t map,
{ /* Scope */
bus_addr_t a, aend;
- bus_addr_t addr = (vaddr_t)buf;
+ bus_addr_t addr = (bus_addr_t)buf;
int seg_len = buflen;
aend = round_page(addr + seg_len);
@@ -1546,9 +1546,9 @@ iommu_dvmamap_sync(bus_dma_tag_t t, bus_dma_tag_t t0, bus_dmamap_t map,
* need flushing afterwards.
*/
int
-iommu_dvmamap_sync_range(struct strbuf_ctl *sb, vaddr_t va, bus_size_t len)
+iommu_dvmamap_sync_range(struct strbuf_ctl *sb, bus_addr_t va, bus_size_t len)
{
- vaddr_t vaend;
+ bus_addr_t vaend;
#ifdef DIAGNOSTIC
struct iommu_state *is = sb->sb_iommu;
@@ -1713,7 +1713,7 @@ iommu_iomap_insert_page(struct iommu_map_state *ims, paddr_t pa)
*/
void
iommu_iomap_load_map(struct iommu_state *is, struct iommu_map_state *ims,
- vaddr_t vmaddr, int flags)
+ bus_addr_t vmaddr, int flags)
{
struct iommu_page_map *ipm = &ims->ims_map;
struct iommu_page_entry *e;
@@ -1769,7 +1769,7 @@ iommu_iomap_unload_map(struct iommu_state *is, struct iommu_map_state *ims)
/*
* Translate a physical address (pa) into a DVMA address.
*/
-vaddr_t
+bus_addr_t
iommu_iomap_translate(struct iommu_map_state *ims, paddr_t pa)
{
struct iommu_page_map *ipm = &ims->ims_map;
diff --git a/sys/arch/sparc64/dev/iommuvar.h b/sys/arch/sparc64/dev/iommuvar.h
index abd7609e431..d1f1bbf9453 100644
--- a/sys/arch/sparc64/dev/iommuvar.h
+++ b/sys/arch/sparc64/dev/iommuvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: iommuvar.h,v 1.14 2009/01/02 20:01:45 kettenis Exp $ */
+/* $OpenBSD: iommuvar.h,v 1.15 2009/05/04 16:48:37 oga Exp $ */
/* $NetBSD: iommuvar.h,v 1.9 2001/10/07 20:30:41 eeh Exp $ */
/*
@@ -74,8 +74,8 @@ struct strbuf_flush {
*/
struct iommu_page_entry {
SPLAY_ENTRY(iommu_page_entry) ipe_node;
- paddr_t ipe_pa;
- vaddr_t ipe_va;
+ paddr_t ipe_pa;
+ bus_addr_t ipe_va;
};
struct iommu_page_map {
SPLAY_HEAD(iommu_page_tree, iommu_page_entry) ipm_tree;
@@ -124,8 +124,8 @@ struct iommu_state {
/* interfaces for PCI/SBus code */
void iommu_init(char *, struct iommu_state *, int, u_int32_t);
void iommu_reset(struct iommu_state *);
-paddr_t iommu_extract(struct iommu_state *, vaddr_t);
-int64_t iommu_lookup_tte(struct iommu_state *, vaddr_t);
+paddr_t iommu_extract(struct iommu_state *, bus_addr_t);
+int64_t iommu_lookup_tte(struct iommu_state *, bus_addr_t);
int64_t iommu_fetch_tte(struct iommu_state *, paddr_t);
/* bus_dma_tag_t implementation functions */
int iommu_dvmamap_create(bus_dma_tag_t, bus_dma_tag_t, struct strbuf_ctl *,
diff --git a/sys/arch/sparc64/dev/viommu.c b/sys/arch/sparc64/dev/viommu.c
index ca63d2c8148..b1d34106af2 100644
--- a/sys/arch/sparc64/dev/viommu.c
+++ b/sys/arch/sparc64/dev/viommu.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: viommu.c,v 1.6 2009/05/03 13:44:05 kettenis Exp $ */
+/* $OpenBSD: viommu.c,v 1.7 2009/05/04 16:48:37 oga Exp $ */
/* $NetBSD: iommu.c,v 1.47 2002/02/08 20:03:45 eeh Exp $ */
/*
@@ -75,9 +75,9 @@ extern int iommudebug;
#define DPRINTF(l, s)
#endif
-void viommu_enter(struct iommu_state *, struct strbuf_ctl *, vaddr_t, paddr_t,
- int);
-void viommu_remove(struct iommu_state *, struct strbuf_ctl *, vaddr_t);
+void viommu_enter(struct iommu_state *, struct strbuf_ctl *, bus_addr_t,
+ paddr_t, int);
+void viommu_remove(struct iommu_state *, struct strbuf_ctl *, bus_addr_t);
int viommu_dvmamap_load_seg(bus_dma_tag_t, struct iommu_state *,
bus_dmamap_t, bus_dma_segment_t *, int, int, bus_size_t, bus_size_t);
int viommu_dvmamap_load_mlist(bus_dma_tag_t, struct iommu_state *,
@@ -85,9 +85,9 @@ int viommu_dvmamap_load_mlist(bus_dma_tag_t, struct iommu_state *,
int viommu_dvmamap_append_range(bus_dma_tag_t, bus_dmamap_t, paddr_t,
bus_size_t, int, bus_size_t);
int iommu_iomap_insert_page(struct iommu_map_state *, paddr_t);
-vaddr_t iommu_iomap_translate(struct iommu_map_state *, paddr_t);
+bus_addr_t iommu_iomap_translate(struct iommu_map_state *, paddr_t);
void viommu_iomap_load_map(struct iommu_state *, struct iommu_map_state *,
- vaddr_t, int);
+ bus_addr_t, int);
void viommu_iomap_unload_map(struct iommu_state *, struct iommu_map_state *);
struct iommu_map_state *viommu_iomap_create(int);
void iommu_iomap_destroy(struct iommu_map_state *);
@@ -136,7 +136,7 @@ viommu_init(char *name, struct iommu_state *is, int tsbsize,
* Add an entry to the IOMMU table.
*/
void
-viommu_enter(struct iommu_state *is, struct strbuf_ctl *sb, vaddr_t va,
+viommu_enter(struct iommu_state *is, struct strbuf_ctl *sb, bus_addr_t va,
paddr_t pa, int flags)
{
u_int64_t tsbid = IOTSBSLOT(va, is->is_tsbsize);
@@ -170,7 +170,7 @@ viommu_enter(struct iommu_state *is, struct strbuf_ctl *sb, vaddr_t va,
* Remove an entry from the IOMMU table.
*/
void
-viommu_remove(struct iommu_state *is, struct strbuf_ctl *sb, vaddr_t va)
+viommu_remove(struct iommu_state *is, struct strbuf_ctl *sb, bus_addr_t va)
{
u_int64_t tsbid = IOTSBSLOT(va, is->is_tsbsize);
u_int64_t ndemapped;
@@ -319,7 +319,7 @@ viommu_dvmamap_load(bus_dma_tag_t t, bus_dma_tag_t t0, bus_dmamap_t map,
iommu_iomap_clear_pages(ims);
{ /* Scope */
bus_addr_t a, aend;
- bus_addr_t addr = (vaddr_t)buf;
+ bus_addr_t addr = (bus_addr_t)buf;
int seg_len = buflen;
aend = round_page(addr + seg_len);
@@ -386,7 +386,7 @@ viommu_dvmamap_load(bus_dma_tag_t t, bus_dma_tag_t t0, bus_dmamap_t map,
{ /* Scope */
bus_addr_t a, aend;
- bus_addr_t addr = (vaddr_t)buf;
+ bus_addr_t addr = (bus_addr_t)buf;
int seg_len = buflen;
aend = round_page(addr + seg_len);
@@ -926,7 +926,7 @@ viommu_iomap_create(int n)
*/
void
viommu_iomap_load_map(struct iommu_state *is, struct iommu_map_state *ims,
- vaddr_t vmaddr, int flags)
+ bus_addr_t vmaddr, int flags)
{
struct iommu_page_map *ipm = &ims->ims_map;
struct iommu_page_entry *e;