nouveau_bo74c1.c 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright 2007 Dave Airlied
  3. * All Rights Reserved.
  4. *
  5. * Permission is hereby granted, free of charge, to any person obtaining a
  6. * copy of this software and associated documentation files (the "Software"),
  7. * to deal in the Software without restriction, including without limitation
  8. * the rights to use, copy, modify, merge, publish, distribute, sublicense,
  9. * and/or sell copies of the Software, and to permit persons to whom the
  10. * Software is furnished to do so, subject to the following conditions:
  11. *
  12. * The above copyright notice and this permission notice (including the next
  13. * paragraph) shall be included in all copies or substantial portions of the
  14. * Software.
  15. *
  16. * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  17. * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  18. * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
  19. * VA LINUX SYSTEMS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, DAMAGES OR
  20. * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
  21. * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
  22. * OTHER DEALINGS IN THE SOFTWARE.
  23. */
  24. /*
  25. * Authors: Dave Airlied <airlied@linux.ie>
  26. * Ben Skeggs <darktama@iinet.net.au>
  27. * Jeremy Kolb <jkolb@brandeis.edu>
  28. */
  29. #include "nouveau_bo.h"
  30. #include "nouveau_dma.h"
  31. #include "nouveau_mem.h"
  32. #include <nvif/push206e.h>
  33. int
  34. nv84_bo_move_exec(struct nouveau_channel *chan, struct ttm_buffer_object *bo,
  35. struct ttm_resource *old_reg, struct ttm_resource *new_reg)
  36. {
  37. struct nouveau_mem *mem = nouveau_mem(old_reg);
  38. struct nvif_push *push = chan->chan.push;
  39. int ret;
  40. ret = PUSH_WAIT(push, 7);
  41. if (ret)
  42. return ret;
  43. PUSH_NVSQ(push, NV74C1, 0x0304, new_reg->num_pages << PAGE_SHIFT,
  44. 0x0308, upper_32_bits(mem->vma[0].addr),
  45. 0x030c, lower_32_bits(mem->vma[0].addr),
  46. 0x0310, upper_32_bits(mem->vma[1].addr),
  47. 0x0314, lower_32_bits(mem->vma[1].addr),
  48. 0x0318, 0x00000000 /* MODE_COPY, QUERY_NONE */);
  49. return 0;
  50. }