addrspace.h
上传用户:lgb322
上传日期:2013-02-24
资源大小:30529k
文件大小:4k
源码类别:

嵌入式Linux

开发平台:

Unix_Linux

  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, 1999 by Ralf Baechle
  7.  * Copyright (C) 1990, 1999 by Silicon Graphics, Inc.
  8.  */
  9. #ifndef _ASM_ADDRSPACE_H
  10. #define _ASM_ADDRSPACE_H
  11. #include <linux/config.h>
  12. /*
  13.  * Memory segments (32bit kernel mode addresses)
  14.  */
  15. #define KUSEG                   0x0000000000000000
  16. #define KSEG0                   0xffffffff80000000
  17. #define KSEG1                   0xffffffffa0000000
  18. #define KSEG2                   0xffffffffc0000000
  19. #define KSEG3                   0xffffffffe0000000
  20. /*
  21.  * Returns the kernel segment base of a given address
  22.  */
  23. #define KSEGX(a)                (((unsigned long)(a)) & 0xe0000000)
  24. /*
  25.  * Returns the physical address of a KSEG0/KSEG1 address
  26.  */
  27. #define CPHYSADDR(a) (((unsigned long)(a)) & 0x000000001fffffffUL)
  28. #define PHYSADDR(a) (((unsigned long)(a)) & 0x000000ffffffffffUL)
  29. /*
  30.  * Map an address to a certain kernel segment
  31.  */
  32. #define KSEG0ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x000000ffffffffffUL) | KSEG0))
  33. #define KSEG1ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x000000ffffffffffUL) | KSEG1))
  34. #define KSEG2ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x000000ffffffffffUL) | KSEG2))
  35. #define KSEG3ADDR(a) ((__typeof__(a))(((unsigned long)(a) & 0x000000ffffffffffUL) | KSEG3))
  36. /*
  37.  * Memory segments (64bit kernel mode addresses)
  38.  */
  39. #define XKUSEG                  0x0000000000000000
  40. #define XKSSEG                  0x4000000000000000
  41. #define XKPHYS                  0x8000000000000000
  42. #define XKSEG                   0xc000000000000000
  43. #define CKSEG0                  0xffffffff80000000
  44. #define CKSEG1                  0xffffffffa0000000
  45. #define CKSSEG                  0xffffffffc0000000
  46. #define CKSEG3                  0xffffffffe0000000
  47. #if defined (CONFIG_CPU_R4300)
  48.     || defined (CONFIG_CPU_R4X00)
  49.     || defined (CONFIG_CPU_R5000)
  50.     || defined (CONFIG_CPU_NEVADA)
  51. #define KUSIZE 0x0000010000000000 /* 2^^40 */
  52. #define KUSIZE_64 0x0000010000000000 /* 2^^40 */
  53. #define K0SIZE 0x0000001000000000 /* 2^^36 */
  54. #define K1SIZE 0x0000001000000000 /* 2^^36 */
  55. #define K2SIZE 0x000000ff80000000
  56. #define KSEGSIZE 0x000000ff80000000 /* max syssegsz */
  57. #define TO_PHYS_MASK 0x0000000fffffffff /* 2^^36 - 1 */
  58. #endif
  59. #if defined (CONFIG_CPU_R8000)
  60. /* We keep KUSIZE consistent with R4000 for now (2^^40) instead of (2^^48) */
  61. #define KUSIZE 0x0000010000000000 /* 2^^40 */
  62. #define KUSIZE_64 0x0000010000000000 /* 2^^40 */
  63. #define K0SIZE 0x0000010000000000 /* 2^^40 */
  64. #define K1SIZE 0x0000010000000000 /* 2^^40 */
  65. #define K2SIZE 0x0001000000000000
  66. #define KSEGSIZE 0x0000010000000000 /* max syssegsz */
  67. #define TO_PHYS_MASK 0x000000ffffffffff /* 2^^40 - 1 */
  68. #endif
  69. #if defined (CONFIG_CPU_R10000)
  70. #define KUSIZE 0x0000010000000000 /* 2^^40 */
  71. #define KUSIZE_64 0x0000010000000000 /* 2^^40 */
  72. #define K0SIZE 0x0000010000000000 /* 2^^40 */
  73. #define K1SIZE 0x0000010000000000 /* 2^^40 */
  74. #define K2SIZE 0x00000fff80000000
  75. #define KSEGSIZE 0x00000fff80000000 /* max syssegsz */
  76. #define TO_PHYS_MASK 0x000000ffffffffff /* 2^^40 - 1 */
  77. #endif
  78. /*
  79.  * Further names for SGI source compatibility.  These are stolen from
  80.  * IRIX's <sys/mips_addrspace.h>.
  81.  */
  82. #define KUBASE 0
  83. #define KUSIZE_32 0x0000000080000000 /* KUSIZE for a 32 bit proc */
  84. #define K0BASE 0xa800000000000000
  85. #define K0BASE_EXL_WR K0BASE /* exclusive on write */
  86. #define K0BASE_NONCOH 0x9800000000000000 /* noncoherent */
  87. #define K0BASE_EXL 0xa000000000000000 /* exclusive */
  88. #ifdef CONFIG_SGI_IP27
  89. #define K1BASE 0x9600000000000000 /* Uncached attr 3, uncac */
  90. #else
  91. #define K1BASE 0x9000000000000000
  92. #endif
  93. #define K2BASE 0xc000000000000000
  94. #if !defined (CONFIG_CPU_R8000)
  95. #define COMPAT_K1BASE32 0xffffffffa0000000
  96. #define PHYS_TO_COMPATK1(x) ((x) | COMPAT_K1BASE32) /* 32-bit compat k1 */
  97. #endif
  98. #define KDM_TO_PHYS(x) ((unsigned long)(x) & TO_PHYS_MASK)
  99. #define PHYS_TO_K0(x) ((unsigned long)(x) | K0BASE)
  100. #endif /* _ASM_ADDRSPACE_H */