summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoroga <oga@openbsd.org>2009-05-10 15:28:45 +0000
committeroga <oga@openbsd.org>2009-05-10 15:28:45 +0000
commit07fa6f2a903e31e034521010e47ee802509dbe5b (patch)
treeae8b09e821ca616bea0ada6a3f4f0091de2cc5a7
parentWhen I changed the implementation of iommu and sg_dma over to use (diff)
downloadwireguard-openbsd-07fa6f2a903e31e034521010e47ee802509dbe5b.tar.xz
wireguard-openbsd-07fa6f2a903e31e034521010e47ee802509dbe5b.zip
In preparation for using agp as a bus_dma backend for drm, convert the bind_page
and unbind_page callbacks from int bind_page(void *, off_t, bus_addr_t) to void bind_page(void *, bus_addr_t, paddr_t, int) We can make these function void by making sure that the agp code sanity checks properly (it already mostly did), so by definition these functions may not fail. The flags field is currently unused (intagp at least will have a use for it soon). Been in my tree for ages.
-rw-r--r--sys/dev/pci/agp.c54
-rw-r--r--sys/dev/pci/agp_ali.c27
-rw-r--r--sys/dev/pci/agp_amd.c27
-rw-r--r--sys/dev/pci/agp_i810.c66
-rw-r--r--sys/dev/pci/agp_intel.c27
-rw-r--r--sys/dev/pci/agp_sis.c27
-rw-r--r--sys/dev/pci/agp_via.c27
-rw-r--r--sys/dev/pci/agpvar.h33
8 files changed, 104 insertions, 184 deletions
diff --git a/sys/dev/pci/agp.c b/sys/dev/pci/agp.c
index 59dfc602b48..9d4c7501831 100644
--- a/sys/dev/pci/agp.c
+++ b/sys/dev/pci/agp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: agp.c,v 1.30 2009/05/10 14:44:42 oga Exp $ */
+/* $OpenBSD: agp.c,v 1.31 2009/05/10 15:28:45 oga Exp $ */
/*-
* Copyright (c) 2000 Doug Rabson
* All rights reserved.
@@ -460,13 +460,12 @@ agp_generic_free_memory(struct agp_softc *sc, struct agp_memory *mem)
int
agp_generic_bind_memory(struct agp_softc *sc, struct agp_memory *mem,
- off_t offset)
+ bus_size_t offset)
{
- bus_dma_segment_t *segs, *seg;
- bus_size_t done, j;
- bus_addr_t pa;
- off_t i, k;
- int nseg, error;
+ bus_dma_segment_t *segs, *seg;
+ bus_addr_t apaddr = sc->sc_apaddr + offset;
+ bus_size_t done, i, j;
+ int nseg, error;
rw_enter_write(&sc->sc_lock);
@@ -512,43 +511,21 @@ agp_generic_bind_memory(struct agp_softc *sc, struct agp_memory *mem,
mem->am_dmaseg = segs;
/*
- * Bind the individual pages and flush the chipset's
- * TLB.
+ * Install entries in the GATT, making sure that if
+ * AGP_PAGE_SIZE < PAGE_SIZE and mem->am_size is not
+ * aligned to PAGE_SIZE, we don't modify too many GATT
+ * entries. Flush chipset tlb when done.
*/
done = 0;
for (i = 0; i < mem->am_dmamap->dm_nsegs; i++) {
seg = &mem->am_dmamap->dm_segs[i];
- /*
- * Install entries in the GATT, making sure that if
- * AGP_PAGE_SIZE < PAGE_SIZE and mem->am_size is not
- * aligned to PAGE_SIZE, we don't modify too many GATT
- * entries.
- */
for (j = 0; j < seg->ds_len && (done + j) < mem->am_size;
j += AGP_PAGE_SIZE) {
- pa = seg->ds_addr + j;
AGP_DPF("binding offset %#lx to pa %#lx\n",
(unsigned long)(offset + done + j),
- (unsigned long)pa);
- error = sc->sc_methods->bind_page(sc->sc_chipc,
- offset + done + j, pa);
- if (error) {
- /*
- * Bail out. Reverse all the mappings
- * and unwire the pages.
- */
- for (k = 0; k < done + j; k += AGP_PAGE_SIZE)
- sc->sc_methods->unbind_page(
- sc->sc_chipc, offset + k);
-
- bus_dmamap_unload(sc->sc_dmat, mem->am_dmamap);
- bus_dmamem_free(sc->sc_dmat, mem->am_dmaseg,
- mem->am_nseg);
- free(mem->am_dmaseg, M_AGP);
- rw_exit_write(&sc->sc_lock);
- AGP_DPF("AGP_BIND_PAGE failed %d\n", error);
- return (error);
- }
+ (unsigned long)seg->ds_addr + j);
+ sc->sc_methods->bind_page(sc->sc_chipc,
+ apaddr + done + j, seg->ds_addr + j, 0);
}
done += seg->ds_len;
}
@@ -575,7 +552,8 @@ agp_generic_bind_memory(struct agp_softc *sc, struct agp_memory *mem,
int
agp_generic_unbind_memory(struct agp_softc *sc, struct agp_memory *mem)
{
- int i;
+ bus_addr_t apaddr = sc->sc_apaddr + mem->am_offset;
+ bus_size_t i;
rw_enter_write(&sc->sc_lock);
@@ -591,7 +569,7 @@ agp_generic_unbind_memory(struct agp_softc *sc, struct agp_memory *mem)
* TLB. Unwire the pages so they can be swapped.
*/
for (i = 0; i < mem->am_size; i += AGP_PAGE_SIZE)
- sc->sc_methods->unbind_page(sc->sc_chipc, mem->am_offset + i);
+ sc->sc_methods->unbind_page(sc->sc_chipc, apaddr + i);
agp_flush_cache();
sc->sc_methods->flush_tlb(sc->sc_chipc);
diff --git a/sys/dev/pci/agp_ali.c b/sys/dev/pci/agp_ali.c
index 7591370a19e..1fe96e3eaaa 100644
--- a/sys/dev/pci/agp_ali.c
+++ b/sys/dev/pci/agp_ali.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: agp_ali.c,v 1.8 2009/05/10 14:44:42 oga Exp $ */
+/* $OpenBSD: agp_ali.c,v 1.9 2009/05/10 15:28:45 oga Exp $ */
/* $NetBSD: agp_ali.c,v 1.2 2001/09/15 00:25:00 thorpej Exp $ */
@@ -63,8 +63,8 @@ void agp_ali_attach(struct device *, struct device *, void *);
int agp_ali_probe(struct device *, void *, void *);
bus_size_t agp_ali_get_aperture(void *);
int agp_ali_set_aperture(void *sc, bus_size_t);
-int agp_ali_bind_page(void *, off_t, bus_addr_t);
-int agp_ali_unbind_page(void *, off_t);
+void agp_ali_bind_page(void *, bus_addr_t, paddr_t, int);
+void agp_ali_unbind_page(void *, bus_addr_t);
void agp_ali_flush_tlb(void *);
struct cfattach aliagp_ca = {
@@ -228,28 +228,21 @@ agp_ali_set_aperture(void *sc, bus_size_t aperture)
return (0);
}
-int
-agp_ali_bind_page(void *sc, off_t offset, bus_addr_t physical)
+void
+agp_ali_bind_page(void *sc, bus_addr_t offset, paddr_t physical, int flags)
{
struct agp_ali_softc *asc = sc;
- if (offset < 0 || offset >= (asc->gatt->ag_entries << AGP_PAGE_SHIFT))
- return (EINVAL);
-
- asc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] = physical;
- return (0);
+ asc->gatt->ag_virtual[(offset - asc->asc_apaddr) >> AGP_PAGE_SHIFT] =
+ physical;
}
-int
-agp_ali_unbind_page(void *sc, off_t offset)
+void
+agp_ali_unbind_page(void *sc, bus_size_t offset)
{
struct agp_ali_softc *asc = sc;
- if (offset < 0 || offset >= (asc->gatt->ag_entries << AGP_PAGE_SHIFT))
- return (EINVAL);
-
- asc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] = 0;
- return (0);
+ asc->gatt->ag_virtual[(offset - asc->asc_apaddr) >> AGP_PAGE_SHIFT] = 0;
}
void
diff --git a/sys/dev/pci/agp_amd.c b/sys/dev/pci/agp_amd.c
index 710062ed054..f2d4cda07ca 100644
--- a/sys/dev/pci/agp_amd.c
+++ b/sys/dev/pci/agp_amd.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: agp_amd.c,v 1.11 2009/05/10 14:44:42 oga Exp $ */
+/* $OpenBSD: agp_amd.c,v 1.12 2009/05/10 15:28:45 oga Exp $ */
/* $NetBSD: agp_amd.c,v 1.6 2001/10/06 02:48:50 thorpej Exp $ */
/*-
@@ -81,8 +81,8 @@ int agp_amd_probe(struct device *, void *, void *);
bus_size_t agp_amd_get_aperture(void *);
struct agp_amd_gatt *agp_amd_alloc_gatt(bus_dma_tag_t, bus_size_t);
int agp_amd_set_aperture(void *, bus_size_t);
-int agp_amd_bind_page(void *, off_t, bus_addr_t);
-int agp_amd_unbind_page(void *, off_t);
+void agp_amd_bind_page(void *, bus_size_t, paddr_t, int);
+void agp_amd_unbind_page(void *, bus_size_t);
void agp_amd_flush_tlb(void *);
struct cfattach amdagp_ca = {
@@ -313,28 +313,21 @@ agp_amd_set_aperture(void *sc, bus_size_t aperture)
return (0);
}
-int
-agp_amd_bind_page(void *sc, off_t offset, bus_addr_t physical)
+void
+agp_amd_bind_page(void *sc, bus_size_t offset, paddr_t physical, int flags)
{
struct agp_amd_softc *asc = sc;
- if (offset < 0 || offset >= (asc->gatt->ag_entries << AGP_PAGE_SHIFT))
- return (EINVAL);
-
- asc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] = physical | 1;
- return (0);
+ asc->gatt->ag_virtual[(offset - asc->asc_apaddr) >> AGP_PAGE_SHIFT] =
+ physical | 1;
}
-int
-agp_amd_unbind_page(void *sc, off_t offset)
+void
+agp_amd_unbind_page(void *sc, bus_size_t offset)
{
struct agp_amd_softc *asc = sc;
- if (offset < 0 || offset >= (asc->gatt->ag_entries << AGP_PAGE_SHIFT))
- return (EINVAL);
-
- asc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] = 0;
- return (0);
+ asc->gatt->ag_virtual[(offset - asc->asc_apaddr) >> AGP_PAGE_SHIFT] = 0;
}
void
diff --git a/sys/dev/pci/agp_i810.c b/sys/dev/pci/agp_i810.c
index 2e3e3a1059e..da7ef078622 100644
--- a/sys/dev/pci/agp_i810.c
+++ b/sys/dev/pci/agp_i810.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: agp_i810.c,v 1.50 2009/05/10 14:44:42 oga Exp $ */
+/* $OpenBSD: agp_i810.c,v 1.51 2009/05/10 15:28:45 oga Exp $ */
/*-
* Copyright (c) 2000 Doug Rabson
@@ -80,15 +80,15 @@ void agp_i810_attach(struct device *, struct device *, void *);
int agp_i810_probe(struct device *, void *, void *);
int agp_i810_get_chiptype(struct pci_attach_args *);
bus_size_t agp_i810_get_aperture(void *);
-int agp_i810_bind_page(void *, off_t, bus_addr_t);
-int agp_i810_unbind_page(void *, off_t);
+void agp_i810_bind_page(void *, bus_size_t, paddr_t, int);
+void agp_i810_unbind_page(void *, bus_size_t);
void agp_i810_flush_tlb(void *);
int agp_i810_enable(void *, u_int32_t mode);
struct agp_memory * agp_i810_alloc_memory(void *, int, vsize_t);
int agp_i810_free_memory(void *, struct agp_memory *);
-int agp_i810_bind_memory(void *, struct agp_memory *, off_t);
+int agp_i810_bind_memory(void *, struct agp_memory *, bus_size_t);
int agp_i810_unbind_memory(void *, struct agp_memory *);
-void intagp_write_gtt(struct agp_i810_softc *, bus_size_t, u_int32_t);
+void intagp_write_gtt(struct agp_i810_softc *, bus_size_t, paddr_t);
int intagp_gmch_match(struct pci_attach_args *);
struct cfattach intagp_ca = {
@@ -515,51 +515,20 @@ agp_i810_get_aperture(void *sc)
return (isc->aperture);
}
-int
-agp_i810_bind_page(void *sc, off_t offset, bus_addr_t physical)
+void
+agp_i810_bind_page(void *sc, bus_addr_t offset, paddr_t physical, int flags)
{
struct agp_i810_softc *isc = sc;
- if (offset < 0 || offset >= (isc->gatt->ag_entries << AGP_PAGE_SHIFT)) {
-#ifdef DEBUG
- printf("agp: failed: offset 0x%08x, shift %d, entries %d\n",
- (int)offset, AGP_PAGE_SHIFT, isc->gatt->ag_entries);
-#endif
- return (EINVAL);
- }
-
- if (isc->chiptype != CHIP_I810) {
- if ((offset >> AGP_PAGE_SHIFT) < isc->stolen) {
-#ifdef DEBUG
- printf("agp: trying to bind into stolen memory\n");
-#endif
- return (EINVAL);
- }
- }
-
- intagp_write_gtt(isc, offset, physical);
- return (0);
+ intagp_write_gtt(isc, offset - isc->isc_apaddr, physical);
}
-int
-agp_i810_unbind_page(void *sc, off_t offset)
+void
+agp_i810_unbind_page(void *sc, bus_size_t offset)
{
struct agp_i810_softc *isc = sc;
- if (offset < 0 || offset >= (isc->gatt->ag_entries << AGP_PAGE_SHIFT))
- return (EINVAL);
-
- if (isc->chiptype != CHIP_I810 ) {
- if ((offset >> AGP_PAGE_SHIFT) < isc->stolen) {
-#ifdef DEBUG
- printf("agp: trying to unbind from stolen memory\n");
-#endif
- return (EINVAL);
- }
- }
-
- intagp_write_gtt(isc, offset, 0);
- return (0);
+ intagp_write_gtt(isc, offset - isc->isc_apaddr, 0);
}
/*
@@ -668,13 +637,22 @@ agp_i810_free_memory(void *softc, struct agp_memory *mem)
}
int
-agp_i810_bind_memory(void *sc, struct agp_memory *mem, off_t offset)
+agp_i810_bind_memory(void *sc, struct agp_memory *mem, bus_size_t offset)
{
struct agp_i810_softc *isc = sc;
u_int32_t regval, i;
if (mem->am_is_bound != 0)
return (EINVAL);
+
+ if (isc->chiptype != CHIP_I810 && (offset >> AGP_PAGE_SHIFT) <
+ isc->stolen) {
+#ifdef DEBUG
+ printf("agp: trying to bind into stolen memory\n");
+#endif
+ return (EINVAL);
+ }
+
/*
* XXX evil hack: the PGTBL_CTL appearently gets overwritten by the
* X server for mysterious reasons which leads to crashes if we write
@@ -738,7 +716,7 @@ agp_i810_unbind_memory(void *sc, struct agp_memory *mem)
}
void
-intagp_write_gtt(struct agp_i810_softc *isc, bus_size_t off, u_int32_t v)
+intagp_write_gtt(struct agp_i810_softc *isc, bus_size_t off, paddr_t v)
{
u_int32_t pte = 0;
bus_size_t baseoff, wroff;
diff --git a/sys/dev/pci/agp_intel.c b/sys/dev/pci/agp_intel.c
index 011bd1512a8..56905c35b5c 100644
--- a/sys/dev/pci/agp_intel.c
+++ b/sys/dev/pci/agp_intel.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: agp_intel.c,v 1.13 2009/05/10 14:44:42 oga Exp $ */
+/* $OpenBSD: agp_intel.c,v 1.14 2009/05/10 15:28:45 oga Exp $ */
/* $NetBSD: agp_intel.c,v 1.3 2001/09/15 00:25:00 thorpej Exp $ */
/*-
@@ -71,8 +71,8 @@ void agp_intel_attach(struct device *, struct device *, void *);
int agp_intel_probe(struct device *, void *, void *);
bus_size_t agp_intel_get_aperture(void *);
int agp_intel_set_aperture(void *, bus_size_t);
-int agp_intel_bind_page(void *, off_t, bus_addr_t);
-int agp_intel_unbind_page(void *, off_t);
+void agp_intel_bind_page(void *, bus_addr_t, paddr_t, int);
+void agp_intel_unbind_page(void *, bus_addr_t);
void agp_intel_flush_tlb(void *);
struct cfattach intelagp_ca = {
@@ -326,28 +326,21 @@ agp_intel_set_aperture(void *sc, bus_size_t aperture)
return (0);
}
-int
-agp_intel_bind_page(void *sc, off_t offset, bus_addr_t physical)
+void
+agp_intel_bind_page(void *sc, bus_addr_t offset, paddr_t physical, int flags)
{
struct agp_intel_softc *isc = sc;
- if (offset < 0 || offset >= (isc->gatt->ag_entries << AGP_PAGE_SHIFT))
- return (EINVAL);
-
- isc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] = physical | 0x17;
- return (0);
+ isc->gatt->ag_virtual[(offset - isc->isc_apaddr) >> AGP_PAGE_SHIFT] =
+ physical | 0x17;
}
-int
-agp_intel_unbind_page(void *sc, off_t offset)
+void
+agp_intel_unbind_page(void *sc, bus_size_t offset)
{
struct agp_intel_softc *isc = sc;
- if (offset < 0 || offset >= (isc->gatt->ag_entries << AGP_PAGE_SHIFT))
- return (EINVAL);
-
- isc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] = 0;
- return (0);
+ isc->gatt->ag_virtual[(offset - isc->isc_apaddr) >> AGP_PAGE_SHIFT] = 0;
}
void
diff --git a/sys/dev/pci/agp_sis.c b/sys/dev/pci/agp_sis.c
index b9f610e5ff0..e96199abcff 100644
--- a/sys/dev/pci/agp_sis.c
+++ b/sys/dev/pci/agp_sis.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: agp_sis.c,v 1.11 2009/05/10 14:44:42 oga Exp $ */
+/* $OpenBSD: agp_sis.c,v 1.12 2009/05/10 15:28:45 oga Exp $ */
/* $NetBSD: agp_sis.c,v 1.2 2001/09/15 00:25:00 thorpej Exp $ */
/*-
@@ -62,8 +62,8 @@ void agp_sis_attach(struct device *, struct device *, void *);
int agp_sis_probe(struct device *, void *, void *);
bus_size_t agp_sis_get_aperture(void *);
int agp_sis_set_aperture(void *, bus_size_t);
-int agp_sis_bind_page(void *, off_t, bus_addr_t);
-int agp_sis_unbind_page(void *, off_t);
+void agp_sis_bind_page(void *, bus_addr_t, paddr_t, int);
+void agp_sis_unbind_page(void *, bus_addr_t);
void agp_sis_flush_tlb(void *);
struct cfattach sisagp_ca = {
@@ -211,28 +211,21 @@ agp_sis_set_aperture(void *sc, bus_size_t aperture)
return (0);
}
-int
-agp_sis_bind_page(void *sc, off_t offset, bus_addr_t physical)
+void
+agp_sis_bind_page(void *sc, bus_addr_t offset, paddr_t physical, int flags)
{
struct agp_sis_softc *ssc = sc;
- if (offset < 0 || offset >= (ssc->gatt->ag_entries << AGP_PAGE_SHIFT))
- return (EINVAL);
-
- ssc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] = physical;
- return (0);
+ ssc->gatt->ag_virtual[(offset - ssc->ssc_apaddr) >> AGP_PAGE_SHIFT] =
+ physical;
}
-int
-agp_sis_unbind_page(void *sc, off_t offset)
+void
+agp_sis_unbind_page(void *sc, bus_addr_t offset)
{
struct agp_sis_softc *ssc = sc;
- if (offset < 0 || offset >= (ssc->gatt->ag_entries << AGP_PAGE_SHIFT))
- return (EINVAL);
-
- ssc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] = 0;
- return (0);
+ ssc->gatt->ag_virtual[(offset - ssc->ssc_apaddr) >> AGP_PAGE_SHIFT] = 0;
}
void
diff --git a/sys/dev/pci/agp_via.c b/sys/dev/pci/agp_via.c
index a1a01ee6f02..dd4f2cbac00 100644
--- a/sys/dev/pci/agp_via.c
+++ b/sys/dev/pci/agp_via.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: agp_via.c,v 1.12 2009/05/10 14:44:42 oga Exp $ */
+/* $OpenBSD: agp_via.c,v 1.13 2009/05/10 15:28:45 oga Exp $ */
/* $NetBSD: agp_via.c,v 1.2 2001/09/15 00:25:00 thorpej Exp $ */
/*-
@@ -52,8 +52,8 @@ void agp_via_attach(struct device *, struct device *, void *);
int agp_via_probe(struct device *, void *, void *);
bus_size_t agp_via_get_aperture(void *);
int agp_via_set_aperture(void *, bus_size_t);
-int agp_via_bind_page(void *, off_t, bus_addr_t);
-int agp_via_unbind_page(void *, off_t);
+void agp_via_bind_page(void *, bus_addr_t, paddr_t, int);
+void agp_via_unbind_page(void *, bus_addr_t);
void agp_via_flush_tlb(void *);
const struct agp_methods agp_via_methods = {
@@ -250,28 +250,21 @@ agp_via_set_aperture(void *sc, bus_size_t aperture)
return (0);
}
-int
-agp_via_bind_page(void *sc, off_t offset, bus_addr_t physical)
+void
+agp_via_bind_page(void *sc, bus_addr_t offset, paddr_t physical, int flags)
{
struct agp_via_softc *vsc = sc;
- if (offset < 0 || offset >= (vsc->gatt->ag_entries << AGP_PAGE_SHIFT))
- return (EINVAL);
-
- vsc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] = physical;
- return (0);
+ vsc->gatt->ag_virtual[(offset - vsc->vsc_apaddr) >> AGP_PAGE_SHIFT] =
+ physical;
}
-int
-agp_via_unbind_page(void *sc, off_t offset)
+void
+agp_via_unbind_page(void *sc, bus_addr_t offset)
{
struct agp_via_softc *vsc = sc;
- if (offset < 0 || offset >= (vsc->gatt->ag_entries << AGP_PAGE_SHIFT))
- return (EINVAL);
-
- vsc->gatt->ag_virtual[offset >> AGP_PAGE_SHIFT] = 0;
- return (0);
+ vsc->gatt->ag_virtual[(offset - vsc->vsc_apaddr) >> AGP_PAGE_SHIFT] = 0;
}
void
diff --git a/sys/dev/pci/agpvar.h b/sys/dev/pci/agpvar.h
index 5e270ca205e..331cdd90b1c 100644
--- a/sys/dev/pci/agpvar.h
+++ b/sys/dev/pci/agpvar.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: agpvar.h,v 1.17 2009/05/10 14:44:42 oga Exp $ */
+/* $OpenBSD: agpvar.h,v 1.18 2009/05/10 15:28:45 oga Exp $ */
/* $NetBSD: agpvar.h,v 1.4 2001/10/01 21:54:48 fvdl Exp $ */
/*-
@@ -66,16 +66,16 @@ enum agp_acquire_state {
*/
TAILQ_HEAD(agp_memory_list, agp_memory);
struct agp_memory {
- TAILQ_ENTRY(agp_memory) am_link; /* wiring for the tailq */
- int am_id; /* unique id for block */
- vsize_t am_size; /* number of bytes allocated */
- int am_type; /* chipset specific type */
- off_t am_offset; /* page offset if bound */
- int am_is_bound; /* non-zero if bound */
- bus_addr_t am_physical;
- bus_dmamap_t am_dmamap;
- int am_nseg;
- bus_dma_segment_t *am_dmaseg;
+ TAILQ_ENTRY(agp_memory) am_link; /* wiring for the tailq */
+ bus_dmamap_t am_dmamap;
+ bus_dma_segment_t *am_dmaseg;
+ bus_size_t am_size; /* number of bytes allocated */
+ bus_size_t am_offset; /* page offset if bound */
+ paddr_t am_physical;
+ int am_id; /* unique id for block */
+ int am_is_bound; /* non-zero if bound */
+ int am_nseg;
+ int am_type; /* chipset specific type */
};
/*
@@ -99,14 +99,14 @@ struct agp_memory_info {
struct agp_methods {
bus_size_t (*get_aperture)(void *);
- int (*bind_page)(void *, off_t, bus_addr_t);
- int (*unbind_page)(void *, off_t);
+ void (*bind_page)(void *, bus_addr_t, paddr_t, int);
+ void (*unbind_page)(void *, bus_addr_t);
void (*flush_tlb)(void *);
int (*enable)(void *, u_int32_t mode);
struct agp_memory *
(*alloc_memory)(void *, int, vsize_t);
int (*free_memory)(void *, struct agp_memory *);
- int (*bind_memory)(void *, struct agp_memory *, off_t);
+ int (*bind_memory)(void *, struct agp_memory *, bus_size_t);
int (*unbind_memory)(void *, struct agp_memory *);
};
@@ -151,13 +151,12 @@ struct agp_gatt {
struct device *agp_attach_bus(struct pci_attach_args *,
const struct agp_methods *, bus_addr_t,
struct device *);
-int agp_map_aperture(struct pci_attach_args *,
- struct agp_softc *, u_int32_t, u_int32_t);
struct agp_gatt *
agp_alloc_gatt(bus_dma_tag_t, u_int32_t);
void agp_free_gatt(bus_dma_tag_t, struct agp_gatt *);
void agp_flush_cache(void);
-int agp_generic_bind_memory(struct agp_softc *, struct agp_memory *, off_t);
+int agp_generic_bind_memory(struct agp_softc *, struct agp_memory *,
+ bus_size_t);
int agp_generic_unbind_memory(struct agp_softc *, struct agp_memory *);
int agp_alloc_dmamem(bus_dma_tag_t, size_t, bus_dmamap_t *,