addrspace.h 2.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. /*
  2. * This file is subject to the terms and conditions of the GNU General Public
  3. * License. See the file "COPYING" in the main directory of this archive
  4. * for more details.
  5. *
  6. * Copyright (C) 1996 by Ralf Baechle
  7. * Copyright (C) 2000 by Maciej W. Rozycki
  8. *
  9. * Defitions for the address spaces of the MIPS CPUs.
  10. */
  11. #ifndef __ASM_MIPS_ADDRSPACE_H
  12. #define __ASM_MIPS_ADDRSPACE_H
  13. /*
  14. * Memory segments (32bit kernel mode addresses)
  15. */
  16. #define KUSEG 0x00000000
  17. #define KSEG0 0x80000000
  18. #define KSEG1 0xa0000000
  19. #define KSEG2 0xc0000000
  20. #define KSEG3 0xe0000000
  21. #define K0BASE KSEG0
  22. /*
  23. * Returns the kernel segment base of a given address
  24. */
  25. #ifndef __ASSEMBLY__
  26. #define KSEGX(a) (((unsigned long)(a)) & 0xe0000000)
  27. #else
  28. #define KSEGX(a) ((a) & 0xe0000000)
  29. #endif
  30. /*
  31. * Returns the physical address of a KSEG0/KSEG1 address
  32. */
  33. #ifndef __ASSEMBLY__
  34. #define PHYSADDR(a) (((unsigned long)(a)) & 0x1fffffff)
  35. #else
  36. #define PHYSADDR(a) ((a) & 0x1fffffff)
  37. #endif
  38. /*
  39. * Returns the uncached address of a sdram address
  40. */
  41. #ifndef __ASSEMBLY__
  42. #ifdef CONFIG_AU1X00
  43. /* We use a 36 bit physical address map here and
  44. cannot access physical memory directly from core */
  45. #define UNCACHED_SDRAM(a) (((unsigned long)(a)) | 0x20000000)
  46. #else /* !CONFIG_AU1X00 */
  47. #define UNCACHED_SDRAM(a) PHYSADDR(a)
  48. #endif /* CONFIG_AU1X00 */
  49. #endif /* __ASSEMBLY__ */
  50. /*
  51. * Map an address to a certain kernel segment
  52. */
  53. #ifndef __ASSEMBLY__
  54. #define KSEG0ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG0))
  55. #define KSEG1ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG1))
  56. #define KSEG2ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG2))
  57. #define KSEG3ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x1fffffff) | KSEG3))
  58. #else
  59. #define KSEG0ADDR(a) (((a) & 0x1fffffff) | KSEG0)
  60. #define KSEG1ADDR(a) (((a) & 0x1fffffff) | KSEG1)
  61. #define KSEG2ADDR(a) (((a) & 0x1fffffff) | KSEG2)
  62. #define KSEG3ADDR(a) (((a) & 0x1fffffff) | KSEG3)
  63. #endif
  64. /*
  65. * Memory segments (64bit kernel mode addresses)
  66. */
  67. #define XKUSEG 0x0000000000000000
  68. #define XKSSEG 0x4000000000000000
  69. #define XKPHYS 0x8000000000000000
  70. #define XKSEG 0xc000000000000000
  71. #define CKSEG0 0xffffffff80000000
  72. #define CKSEG1 0xffffffffa0000000
  73. #define CKSSEG 0xffffffffc0000000
  74. #define CKSEG3 0xffffffffe0000000
  75. #endif /* __ASM_MIPS_ADDRSPACE_H */