io-unit.h 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. /* SPDX-License-Identifier: GPL-2.0 */
  2. /* io-unit.h: Definitions for the sun4d IO-UNIT.
  3. *
  4. * Copyright (C) 1997,1998 Jakub Jelinek ([email protected])
  5. */
  6. #ifndef _SPARC_IO_UNIT_H
  7. #define _SPARC_IO_UNIT_H
  8. #include <linux/spinlock.h>
  9. #include <linux/pgtable.h>
  10. #include <asm/page.h>
  11. /* The io-unit handles all virtual to physical address translations
  12. * that occur between the SBUS and physical memory. Access by
  13. * the cpu to IO registers and similar go over the xdbus so are
  14. * translated by the on chip SRMMU. The io-unit and the srmmu do
  15. * not need to have the same translations at all, in fact most
  16. * of the time the translations they handle are a disjunct set.
  17. * Basically the io-unit handles all dvma sbus activity.
  18. */
  19. /* AIEEE, unlike the nice sun4m, these monsters have
  20. fixed DMA range 64M */
  21. #define IOUNIT_DMA_BASE 0xfc000000 /* TOP - 64M */
  22. #define IOUNIT_DMA_SIZE 0x04000000 /* 64M */
  23. /* We use last 1M for sparc_dvma_malloc */
  24. #define IOUNIT_DVMA_SIZE 0x00100000 /* 1M */
  25. /* The format of an iopte in the external page tables */
  26. #define IOUPTE_PAGE 0xffffff00 /* Physical page number (PA[35:12]) */
  27. #define IOUPTE_CACHE 0x00000080 /* Cached (in Viking/MXCC) */
  28. /* XXX Jakub, find out how to program SBUS streaming cache on XDBUS/sun4d.
  29. * XXX Actually, all you should need to do is find out where the registers
  30. * XXX are and copy over the sparc64 implementation I wrote. There may be
  31. * XXX some horrible hwbugs though, so be careful. -DaveM
  32. */
  33. #define IOUPTE_STREAM 0x00000040 /* Translation can use streaming cache */
  34. #define IOUPTE_INTRA 0x00000008 /* SBUS direct slot->slot transfer */
  35. #define IOUPTE_WRITE 0x00000004 /* Writeable */
  36. #define IOUPTE_VALID 0x00000002 /* IOPTE is valid */
  37. #define IOUPTE_PARITY 0x00000001 /* Parity is checked during DVMA */
  38. struct iounit_struct {
  39. unsigned long bmap[(IOUNIT_DMA_SIZE >> (PAGE_SHIFT + 3)) / sizeof(unsigned long)];
  40. spinlock_t lock;
  41. iopte_t __iomem *page_table;
  42. unsigned long rotor[3];
  43. unsigned long limit[4];
  44. };
  45. #define IOUNIT_BMAP1_START 0x00000000
  46. #define IOUNIT_BMAP1_END (IOUNIT_DMA_SIZE >> (PAGE_SHIFT + 1))
  47. #define IOUNIT_BMAP2_START IOUNIT_BMAP1_END
  48. #define IOUNIT_BMAP2_END IOUNIT_BMAP2_START + (IOUNIT_DMA_SIZE >> (PAGE_SHIFT + 2))
  49. #define IOUNIT_BMAPM_START IOUNIT_BMAP2_END
  50. #define IOUNIT_BMAPM_END ((IOUNIT_DMA_SIZE - IOUNIT_DVMA_SIZE) >> PAGE_SHIFT)
  51. #endif /* !(_SPARC_IO_UNIT_H) */