tccvar.h 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. /* $OpenBSD: tccvar.h,v 1.1 2012/09/29 21:46:02 miod Exp $ */
  2. /*
  3. * Copyright (c) 2012 Miodrag Vallat.
  4. *
  5. * Permission to use, copy, modify, and distribute this software for any
  6. * purpose with or without fee is hereby granted, provided that the above
  7. * copyright notice and this permission notice appear in all copies.
  8. *
  9. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
  10. * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
  11. * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
  12. * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  13. * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
  14. * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
  15. * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  16. */
  17. #define tcc_read(o) \
  18. *(volatile uint64_t *)PHYS_TO_XKPHYS(TCC_BASE + (o), CCA_NC)
  19. #define tcc_write(o,v) \
  20. *(volatile uint64_t *)PHYS_TO_XKPHYS(TCC_BASE + (o), CCA_NC) = (v)
  21. static __inline__ void
  22. tcc_prefetch_disable(void)
  23. {
  24. tcc_write(TCC_PREFETCH_CTRL, TCC_PREFETCH_INVALIDATE);
  25. }
  26. static __inline__ void
  27. tcc_prefetch_enable(void)
  28. {
  29. tcc_write(TCC_PREFETCH_CTRL, TCC_PREFETCH_ENABLE);
  30. }
  31. static __inline__ void
  32. tcc_prefetch_invalidate(void)
  33. {
  34. tcc_write(TCC_PREFETCH_CTRL,
  35. tcc_read(TCC_PREFETCH_CTRL) | TCC_PREFETCH_INVALIDATE);
  36. }
  37. void tcc_bus_reset(void);