diff options
author | Owain Ainsworth <oga@cvs.openbsd.org> | 2009-05-10 15:28:46 +0000 |
---|---|---|
committer | Owain Ainsworth <oga@cvs.openbsd.org> | 2009-05-10 15:28:46 +0000 |
commit | fade87d4238fbc174e53d7a1bbc2f8c738541ad6 (patch) | |
tree | a4c579210d342cadaecca31178a8d981c8accd1c /sys/dev/pci/agp_amd.c | |
parent | 58599f29e1a2625f3382da058b150d6340e816d5 (diff) |
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.
Diffstat (limited to 'sys/dev/pci/agp_amd.c')
-rw-r--r-- | sys/dev/pci/agp_amd.c | 27 |
1 files changed, 10 insertions, 17 deletions
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 |