arch.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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 <asm/sn/types.h>
  15. #ifdef CONFIG_SGI_IP27
  16. #include <asm/sn/sn0/arch.h>
  17. #endif
  18. typedef u64 hubreg_t;
  19. #define cputonasid(cpu) (sn_cpu_info[(cpu)].p_nasid)
  20. #define cputoslice(cpu) (sn_cpu_info[(cpu)].p_slice)
  21. #define makespnum(_nasid, _slice) \
  22. (((_nasid) << CPUS_PER_NODE_SHFT) | (_slice))
  23. #define INVALID_NASID (nasid_t)-1
  24. #define INVALID_CNODEID (cnodeid_t)-1
  25. #define INVALID_PNODEID (pnodeid_t)-1
  26. #define INVALID_MODULE (moduleid_t)-1
  27. #define INVALID_PARTID (partid_t)-1
  28. extern nasid_t get_nasid(void);
  29. extern cnodeid_t get_cpu_cnode(cpuid_t);
  30. extern int get_cpu_slice(cpuid_t);
  31. /*
  32. * NO ONE should access these arrays directly. The only reason we refer to
  33. * them here is to avoid the procedure call that would be required in the
  34. * macros below. (Really want private data members here :-)
  35. */
  36. extern cnodeid_t nasid_to_compact_node[MAX_NASIDS];
  37. extern nasid_t compact_to_nasid_node[MAX_COMPACT_NODES];
  38. /*
  39. * These macros are used by various parts of the kernel to convert
  40. * between the three different kinds of node numbering. At least some
  41. * of them may change to procedure calls in the future, but the macros
  42. * will continue to work. Don't use the arrays above directly.
  43. */
  44. #define NASID_TO_REGION(nnode) \
  45. ((nnode) >> \
  46. (is_fine_dirmode() ? NASID_TO_FINEREG_SHFT : NASID_TO_COARSEREG_SHFT))
  47. extern cnodeid_t nasid_to_compact_node[MAX_NASIDS];
  48. extern nasid_t compact_to_nasid_node[MAX_COMPACT_NODES];
  49. extern cnodeid_t cpuid_to_compact_node[MAXCPUS];
  50. #define NASID_TO_COMPACT_NODEID(nnode) (nasid_to_compact_node[nnode])
  51. #define COMPACT_TO_NASID_NODEID(cnode) (compact_to_nasid_node[cnode])
  52. #define CPUID_TO_COMPACT_NODEID(cpu) (cpuid_to_compact_node[(cpu)])
  53. #endif /* _ASM_SN_ARCH_H */