map.c 1.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright (C) Paul Mackerras 1997.
  3. * Copyright (C) Leigh Brown 2002.
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License
  7. * as published by the Free Software Foundation; either version
  8. * 2 of the License, or (at your option) any later version.
  9. */
  10. #include "of1275.h"
  11. #include "nonstdio.h"
  12. extern ihandle of_prom_mmu;
  13. int
  14. map(unsigned int phys, unsigned int virt, unsigned int size)
  15. {
  16. struct prom_args {
  17. char *service;
  18. int nargs;
  19. int nret;
  20. char *method;
  21. ihandle mmu_ihandle;
  22. int misc;
  23. unsigned int size;
  24. unsigned int virt;
  25. unsigned int phys;
  26. int ret0;
  27. } args;
  28. if (of_prom_mmu == 0) {
  29. printf("map() called, no MMU found\n");
  30. return -1;
  31. }
  32. args.service = "call-method";
  33. args.nargs = 6;
  34. args.nret = 1;
  35. args.method = "map";
  36. args.mmu_ihandle = of_prom_mmu;
  37. args.misc = 0;
  38. args.phys = phys;
  39. args.virt = virt;
  40. args.size = size;
  41. (*of_prom_entry)(&args);
  42. return (int)args.ret0;
  43. }