arch.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.  * SGI specific setup.
  7.  *
  8.  * Copyright (C) 1995 - 1997, 1999 Silcon Graphics, Inc.
  9.  * Copyright (C) 1999 Ralf Baechle (ralf@gnu.org)
  10.  */
  11. #ifndef _ASM_SN_ARCH_H
  12. #define _ASM_SN_ARCH_H
  13. #include <linux/types.h>
  14. #include <linux/config.h>
  15. #if !defined(CONFIG_SGI_IO)
  16. #include <asm/sn/types.h>
  17. #include <asm/sn/sn0/arch.h>
  18. #endif
  19. #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
  20. #if !defined(CONFIG_SGI_IO)
  21. typedef u64 hubreg_t;
  22. typedef u64 nic_t;
  23. #endif
  24. #endif
  25. #ifdef CONFIG_SGI_IP27
  26. #define CPUS_PER_NODE 2 /* CPUs on a single hub */
  27. #define CPUS_PER_NODE_SHFT 1 /* Bits to shift in the node number */
  28. #define CPUS_PER_SUBNODE 2 /* CPUs on a single hub PI */
  29. #endif
  30. #define CNODE_NUM_CPUS(_cnode) (NODEPDA(_cnode)->node_num_cpus)
  31. #define CNODE_TO_CPU_BASE(_cnode) (NODEPDA(_cnode)->node_first_cpu)
  32. #define cputocnode(cpu)
  33.                (cpu_data[(cpu)].p_nodeid)
  34. #define cputonasid(cpu)
  35.                (cpu_data[(cpu)].p_nasid)
  36. #define cputoslice(cpu)
  37.                (cpu_data[(cpu)].p_slice)
  38. #define makespnum(_nasid, _slice)
  39. (((_nasid) << CPUS_PER_NODE_SHFT) | (_slice))
  40. #if defined(_LANGUAGE_C) || defined(_LANGUAGE_C_PLUS_PLUS)
  41. #define INVALID_NASID (nasid_t)-1
  42. #define INVALID_CNODEID (cnodeid_t)-1
  43. #define INVALID_PNODEID (pnodeid_t)-1
  44. #define INVALID_MODULE (moduleid_t)-1
  45. #define INVALID_PARTID (partid_t)-1
  46. extern nasid_t get_nasid(void);
  47. extern cnodeid_t get_cpu_cnode(cpuid_t);
  48. extern int get_cpu_slice(cpuid_t);
  49. /*
  50.  * NO ONE should access these arrays directly.  The only reason we refer to
  51.  * them here is to avoid the procedure call that would be required in the
  52.  * macros below.  (Really want private data members here :-)
  53.  */
  54. extern cnodeid_t nasid_to_compact_node[MAX_NASIDS];
  55. extern nasid_t compact_to_nasid_node[MAX_COMPACT_NODES];
  56. /*
  57.  * These macros are used by various parts of the kernel to convert
  58.  * between the three different kinds of node numbering.   At least some
  59.  * of them may change to procedure calls in the future, but the macros
  60.  * will continue to work.  Don't use the arrays above directly.
  61.  */
  62. #define NASID_TO_REGION(nnode)       
  63.     ((nnode) >> 
  64.      (is_fine_dirmode() ? NASID_TO_FINEREG_SHFT : NASID_TO_COARSEREG_SHFT))
  65. #if !defined(_STANDALONE)
  66. extern cnodeid_t nasid_to_compact_node[MAX_NASIDS];
  67. extern nasid_t compact_to_nasid_node[MAX_COMPACT_NODES];
  68. extern cnodeid_t cpuid_to_compact_node[MAXCPUS];
  69. #endif
  70. #if !defined(DEBUG) && (!defined(SABLE) || defined(_STANDALONE))
  71. #define NASID_TO_COMPACT_NODEID(nnode) (nasid_to_compact_node[nnode])
  72. #define COMPACT_TO_NASID_NODEID(cnode) (compact_to_nasid_node[cnode])
  73. #define CPUID_TO_COMPACT_NODEID(cpu) (cpuid_to_compact_node[(cpu)])
  74. #else
  75. /*
  76.  * These functions can do type checking and fail if they need to return
  77.  * a bad nodeid, but they're not as fast so just use 'em for debug kernels.
  78.  */
  79. cnodeid_t nasid_to_compact_nodeid(nasid_t nasid);
  80. nasid_t compact_to_nasid_nodeid(cnodeid_t cnode);
  81. #define NASID_TO_COMPACT_NODEID(nnode) nasid_to_compact_nodeid(nnode)
  82. #define COMPACT_TO_NASID_NODEID(cnode) compact_to_nasid_nodeid(cnode)
  83. #define CPUID_TO_COMPACT_NODEID(cpu) (cpuid_to_compact_node[(cpu)])
  84. #endif
  85. extern int node_getlastslot(cnodeid_t);
  86. #endif /* _LANGUAGE_C || _LANGUAGE_C_PLUS_PLUS */
  87. #define SLOT_BITMASK     (MAX_MEM_SLOTS - 1)
  88. #define SLOT_SIZE (1LL<<SLOT_SHIFT)
  89. #define node_getnumslots(node) (MAX_MEM_SLOTS)
  90. #define NODE_MAX_MEM_SIZE SLOT_SIZE * MAX_MEM_SLOTS
  91. /*
  92.  * New stuff in here from Irix sys/pfdat.h.
  93.  */
  94. #define SLOT_PFNSHIFT (SLOT_SHIFT - PAGE_SHIFT)
  95. #define PFN_NASIDSHFT (NASID_SHFT - PAGE_SHIFT)
  96. #define mkpfn(nasid, off) (((pfn_t)(nasid) << PFN_NASIDSHFT) | (off))
  97. #define slot_getbasepfn(node,slot) 
  98. (mkpfn(COMPACT_TO_NASID_NODEID(node), slot<<SLOT_PFNSHIFT))
  99. #endif /* _ASM_SN_ARCH_H */