uv_hub.h 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637
  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 UV architectural definitions
  7. *
  8. * Copyright (C) 2007-2013 Silicon Graphics, Inc. All rights reserved.
  9. */
  10. #ifndef _ASM_X86_UV_UV_HUB_H
  11. #define _ASM_X86_UV_UV_HUB_H
  12. #ifdef CONFIG_X86_64
  13. #include <linux/numa.h>
  14. #include <linux/percpu.h>
  15. #include <linux/timer.h>
  16. #include <linux/io.h>
  17. #include <asm/types.h>
  18. #include <asm/percpu.h>
  19. #include <asm/uv/uv_mmrs.h>
  20. #include <asm/irq_vectors.h>
  21. #include <asm/io_apic.h>
  22. /*
  23. * Addressing Terminology
  24. *
  25. * M - The low M bits of a physical address represent the offset
  26. * into the blade local memory. RAM memory on a blade is physically
  27. * contiguous (although various IO spaces may punch holes in
  28. * it)..
  29. *
  30. * N - Number of bits in the node portion of a socket physical
  31. * address.
  32. *
  33. * NASID - network ID of a router, Mbrick or Cbrick. Nasid values of
  34. * routers always have low bit of 1, C/MBricks have low bit
  35. * equal to 0. Most addressing macros that target UV hub chips
  36. * right shift the NASID by 1 to exclude the always-zero bit.
  37. * NASIDs contain up to 15 bits.
  38. *
  39. * GNODE - NASID right shifted by 1 bit. Most mmrs contain gnodes instead
  40. * of nasids.
  41. *
  42. * PNODE - the low N bits of the GNODE. The PNODE is the most useful variant
  43. * of the nasid for socket usage.
  44. *
  45. * GPA - (global physical address) a socket physical address converted
  46. * so that it can be used by the GRU as a global address. Socket
  47. * physical addresses 1) need additional NASID (node) bits added
  48. * to the high end of the address, and 2) unaliased if the
  49. * partition does not have a physical address 0. In addition, on
  50. * UV2 rev 1, GPAs need the gnode left shifted to bits 39 or 40.
  51. *
  52. *
  53. * NumaLink Global Physical Address Format:
  54. * +--------------------------------+---------------------+
  55. * |00..000| GNODE | NodeOffset |
  56. * +--------------------------------+---------------------+
  57. * |<-------53 - M bits --->|<--------M bits ----->
  58. *
  59. * M - number of node offset bits (35 .. 40)
  60. *
  61. *
  62. * Memory/UV-HUB Processor Socket Address Format:
  63. * +----------------+---------------+---------------------+
  64. * |00..000000000000| PNODE | NodeOffset |
  65. * +----------------+---------------+---------------------+
  66. * <--- N bits --->|<--------M bits ----->
  67. *
  68. * M - number of node offset bits (35 .. 40)
  69. * N - number of PNODE bits (0 .. 10)
  70. *
  71. * Note: M + N cannot currently exceed 44 (x86_64) or 46 (IA64).
  72. * The actual values are configuration dependent and are set at
  73. * boot time. M & N values are set by the hardware/BIOS at boot.
  74. *
  75. *
  76. * APICID format
  77. * NOTE!!!!!! This is the current format of the APICID. However, code
  78. * should assume that this will change in the future. Use functions
  79. * in this file for all APICID bit manipulations and conversion.
  80. *
  81. * 1111110000000000
  82. * 5432109876543210
  83. * pppppppppplc0cch Nehalem-EX (12 bits in hdw reg)
  84. * ppppppppplcc0cch Westmere-EX (12 bits in hdw reg)
  85. * pppppppppppcccch SandyBridge (15 bits in hdw reg)
  86. * sssssssssss
  87. *
  88. * p = pnode bits
  89. * l = socket number on board
  90. * c = core
  91. * h = hyperthread
  92. * s = bits that are in the SOCKET_ID CSR
  93. *
  94. * Note: Processor may support fewer bits in the APICID register. The ACPI
  95. * tables hold all 16 bits. Software needs to be aware of this.
  96. *
  97. * Unless otherwise specified, all references to APICID refer to
  98. * the FULL value contained in ACPI tables, not the subset in the
  99. * processor APICID register.
  100. */
  101. /*
  102. * Maximum number of bricks in all partitions and in all coherency domains.
  103. * This is the total number of bricks accessible in the numalink fabric. It
  104. * includes all C & M bricks. Routers are NOT included.
  105. *
  106. * This value is also the value of the maximum number of non-router NASIDs
  107. * in the numalink fabric.
  108. *
  109. * NOTE: a brick may contain 1 or 2 OS nodes. Don't get these confused.
  110. */
  111. #define UV_MAX_NUMALINK_BLADES 16384
  112. /*
  113. * Maximum number of C/Mbricks within a software SSI (hardware may support
  114. * more).
  115. */
  116. #define UV_MAX_SSI_BLADES 256
  117. /*
  118. * The largest possible NASID of a C or M brick (+ 2)
  119. */
  120. #define UV_MAX_NASID_VALUE (UV_MAX_NUMALINK_BLADES * 2)
  121. struct uv_scir_s {
  122. struct timer_list timer;
  123. unsigned long offset;
  124. unsigned long last;
  125. unsigned long idle_on;
  126. unsigned long idle_off;
  127. unsigned char state;
  128. unsigned char enabled;
  129. };
  130. /*
  131. * The following defines attributes of the HUB chip. These attributes are
  132. * frequently referenced and are kept in the per-cpu data areas of each cpu.
  133. * They are kept together in a struct to minimize cache misses.
  134. */
  135. struct uv_hub_info_s {
  136. unsigned long global_mmr_base;
  137. unsigned long gpa_mask;
  138. unsigned int gnode_extra;
  139. unsigned char hub_revision;
  140. unsigned char apic_pnode_shift;
  141. unsigned char m_shift;
  142. unsigned char n_lshift;
  143. unsigned long gnode_upper;
  144. unsigned long lowmem_remap_top;
  145. unsigned long lowmem_remap_base;
  146. unsigned short pnode;
  147. unsigned short pnode_mask;
  148. unsigned short coherency_domain_number;
  149. unsigned short numa_blade_id;
  150. unsigned char blade_processor_id;
  151. unsigned char m_val;
  152. unsigned char n_val;
  153. struct uv_scir_s scir;
  154. };
  155. DECLARE_PER_CPU(struct uv_hub_info_s, __uv_hub_info);
  156. #define uv_hub_info (&__get_cpu_var(__uv_hub_info))
  157. #define uv_cpu_hub_info(cpu) (&per_cpu(__uv_hub_info, cpu))
  158. /*
  159. * Hub revisions less than UV2_HUB_REVISION_BASE are UV1 hubs. All UV2
  160. * hubs have revision numbers greater than or equal to UV2_HUB_REVISION_BASE.
  161. * This is a software convention - NOT the hardware revision numbers in
  162. * the hub chip.
  163. */
  164. #define UV1_HUB_REVISION_BASE 1
  165. #define UV2_HUB_REVISION_BASE 3
  166. #define UV3_HUB_REVISION_BASE 5
  167. static inline int is_uv1_hub(void)
  168. {
  169. return uv_hub_info->hub_revision < UV2_HUB_REVISION_BASE;
  170. }
  171. static inline int is_uv2_hub(void)
  172. {
  173. return ((uv_hub_info->hub_revision >= UV2_HUB_REVISION_BASE) &&
  174. (uv_hub_info->hub_revision < UV3_HUB_REVISION_BASE));
  175. }
  176. static inline int is_uv3_hub(void)
  177. {
  178. return uv_hub_info->hub_revision >= UV3_HUB_REVISION_BASE;
  179. }
  180. static inline int is_uv_hub(void)
  181. {
  182. return uv_hub_info->hub_revision;
  183. }
  184. /* code common to uv2 and uv3 only */
  185. static inline int is_uvx_hub(void)
  186. {
  187. return uv_hub_info->hub_revision >= UV2_HUB_REVISION_BASE;
  188. }
  189. static inline int is_uv2_1_hub(void)
  190. {
  191. return uv_hub_info->hub_revision == UV2_HUB_REVISION_BASE;
  192. }
  193. static inline int is_uv2_2_hub(void)
  194. {
  195. return uv_hub_info->hub_revision == UV2_HUB_REVISION_BASE + 1;
  196. }
  197. union uvh_apicid {
  198. unsigned long v;
  199. struct uvh_apicid_s {
  200. unsigned long local_apic_mask : 24;
  201. unsigned long local_apic_shift : 5;
  202. unsigned long unused1 : 3;
  203. unsigned long pnode_mask : 24;
  204. unsigned long pnode_shift : 5;
  205. unsigned long unused2 : 3;
  206. } s;
  207. };
  208. /*
  209. * Local & Global MMR space macros.
  210. * Note: macros are intended to be used ONLY by inline functions
  211. * in this file - not by other kernel code.
  212. * n - NASID (full 15-bit global nasid)
  213. * g - GNODE (full 15-bit global nasid, right shifted 1)
  214. * p - PNODE (local part of nsids, right shifted 1)
  215. */
  216. #define UV_NASID_TO_PNODE(n) (((n) >> 1) & uv_hub_info->pnode_mask)
  217. #define UV_PNODE_TO_GNODE(p) ((p) |uv_hub_info->gnode_extra)
  218. #define UV_PNODE_TO_NASID(p) (UV_PNODE_TO_GNODE(p) << 1)
  219. #define UV1_LOCAL_MMR_BASE 0xf4000000UL
  220. #define UV1_GLOBAL_MMR32_BASE 0xf8000000UL
  221. #define UV1_LOCAL_MMR_SIZE (64UL * 1024 * 1024)
  222. #define UV1_GLOBAL_MMR32_SIZE (64UL * 1024 * 1024)
  223. #define UV2_LOCAL_MMR_BASE 0xfa000000UL
  224. #define UV2_GLOBAL_MMR32_BASE 0xfc000000UL
  225. #define UV2_LOCAL_MMR_SIZE (32UL * 1024 * 1024)
  226. #define UV2_GLOBAL_MMR32_SIZE (32UL * 1024 * 1024)
  227. #define UV3_LOCAL_MMR_BASE 0xfa000000UL
  228. #define UV3_GLOBAL_MMR32_BASE 0xfc000000UL
  229. #define UV3_LOCAL_MMR_SIZE (32UL * 1024 * 1024)
  230. #define UV3_GLOBAL_MMR32_SIZE (32UL * 1024 * 1024)
  231. #define UV_LOCAL_MMR_BASE (is_uv1_hub() ? UV1_LOCAL_MMR_BASE : \
  232. (is_uv2_hub() ? UV2_LOCAL_MMR_BASE : \
  233. UV3_LOCAL_MMR_BASE))
  234. #define UV_GLOBAL_MMR32_BASE (is_uv1_hub() ? UV1_GLOBAL_MMR32_BASE :\
  235. (is_uv2_hub() ? UV2_GLOBAL_MMR32_BASE :\
  236. UV3_GLOBAL_MMR32_BASE))
  237. #define UV_LOCAL_MMR_SIZE (is_uv1_hub() ? UV1_LOCAL_MMR_SIZE : \
  238. (is_uv2_hub() ? UV2_LOCAL_MMR_SIZE : \
  239. UV3_LOCAL_MMR_SIZE))
  240. #define UV_GLOBAL_MMR32_SIZE (is_uv1_hub() ? UV1_GLOBAL_MMR32_SIZE :\
  241. (is_uv2_hub() ? UV2_GLOBAL_MMR32_SIZE :\
  242. UV3_GLOBAL_MMR32_SIZE))
  243. #define UV_GLOBAL_MMR64_BASE (uv_hub_info->global_mmr_base)
  244. #define UV_GLOBAL_GRU_MMR_BASE 0x4000000
  245. #define UV_GLOBAL_MMR32_PNODE_SHIFT 15
  246. #define UV_GLOBAL_MMR64_PNODE_SHIFT 26
  247. #define UV_GLOBAL_MMR32_PNODE_BITS(p) ((p) << (UV_GLOBAL_MMR32_PNODE_SHIFT))
  248. #define UV_GLOBAL_MMR64_PNODE_BITS(p) \
  249. (((unsigned long)(p)) << UV_GLOBAL_MMR64_PNODE_SHIFT)
  250. #define UVH_APICID 0x002D0E00L
  251. #define UV_APIC_PNODE_SHIFT 6
  252. #define UV_APICID_HIBIT_MASK 0xffff0000
  253. /* Local Bus from cpu's perspective */
  254. #define LOCAL_BUS_BASE 0x1c00000
  255. #define LOCAL_BUS_SIZE (4 * 1024 * 1024)
  256. /*
  257. * System Controller Interface Reg
  258. *
  259. * Note there are NO leds on a UV system. This register is only
  260. * used by the system controller to monitor system-wide operation.
  261. * There are 64 regs per node. With Nahelem cpus (2 cores per node,
  262. * 8 cpus per core, 2 threads per cpu) there are 32 cpu threads on
  263. * a node.
  264. *
  265. * The window is located at top of ACPI MMR space
  266. */
  267. #define SCIR_WINDOW_COUNT 64
  268. #define SCIR_LOCAL_MMR_BASE (LOCAL_BUS_BASE + \
  269. LOCAL_BUS_SIZE - \
  270. SCIR_WINDOW_COUNT)
  271. #define SCIR_CPU_HEARTBEAT 0x01 /* timer interrupt */
  272. #define SCIR_CPU_ACTIVITY 0x02 /* not idle */
  273. #define SCIR_CPU_HB_INTERVAL (HZ) /* once per second */
  274. /* Loop through all installed blades */
  275. #define for_each_possible_blade(bid) \
  276. for ((bid) = 0; (bid) < uv_num_possible_blades(); (bid)++)
  277. /*
  278. * Macros for converting between kernel virtual addresses, socket local physical
  279. * addresses, and UV global physical addresses.
  280. * Note: use the standard __pa() & __va() macros for converting
  281. * between socket virtual and socket physical addresses.
  282. */
  283. /* socket phys RAM --> UV global physical address */
  284. static inline unsigned long uv_soc_phys_ram_to_gpa(unsigned long paddr)
  285. {
  286. if (paddr < uv_hub_info->lowmem_remap_top)
  287. paddr |= uv_hub_info->lowmem_remap_base;
  288. paddr |= uv_hub_info->gnode_upper;
  289. paddr = ((paddr << uv_hub_info->m_shift) >> uv_hub_info->m_shift) |
  290. ((paddr >> uv_hub_info->m_val) << uv_hub_info->n_lshift);
  291. return paddr;
  292. }
  293. /* socket virtual --> UV global physical address */
  294. static inline unsigned long uv_gpa(void *v)
  295. {
  296. return uv_soc_phys_ram_to_gpa(__pa(v));
  297. }
  298. /* Top two bits indicate the requested address is in MMR space. */
  299. static inline int
  300. uv_gpa_in_mmr_space(unsigned long gpa)
  301. {
  302. return (gpa >> 62) == 0x3UL;
  303. }
  304. /* UV global physical address --> socket phys RAM */
  305. static inline unsigned long uv_gpa_to_soc_phys_ram(unsigned long gpa)
  306. {
  307. unsigned long paddr;
  308. unsigned long remap_base = uv_hub_info->lowmem_remap_base;
  309. unsigned long remap_top = uv_hub_info->lowmem_remap_top;
  310. gpa = ((gpa << uv_hub_info->m_shift) >> uv_hub_info->m_shift) |
  311. ((gpa >> uv_hub_info->n_lshift) << uv_hub_info->m_val);
  312. paddr = gpa & uv_hub_info->gpa_mask;
  313. if (paddr >= remap_base && paddr < remap_base + remap_top)
  314. paddr -= remap_base;
  315. return paddr;
  316. }
  317. /* gpa -> pnode */
  318. static inline unsigned long uv_gpa_to_gnode(unsigned long gpa)
  319. {
  320. return gpa >> uv_hub_info->n_lshift;
  321. }
  322. /* gpa -> pnode */
  323. static inline int uv_gpa_to_pnode(unsigned long gpa)
  324. {
  325. unsigned long n_mask = (1UL << uv_hub_info->n_val) - 1;
  326. return uv_gpa_to_gnode(gpa) & n_mask;
  327. }
  328. /* gpa -> node offset*/
  329. static inline unsigned long uv_gpa_to_offset(unsigned long gpa)
  330. {
  331. return (gpa << uv_hub_info->m_shift) >> uv_hub_info->m_shift;
  332. }
  333. /* pnode, offset --> socket virtual */
  334. static inline void *uv_pnode_offset_to_vaddr(int pnode, unsigned long offset)
  335. {
  336. return __va(((unsigned long)pnode << uv_hub_info->m_val) | offset);
  337. }
  338. /*
  339. * Extract a PNODE from an APICID (full apicid, not processor subset)
  340. */
  341. static inline int uv_apicid_to_pnode(int apicid)
  342. {
  343. return (apicid >> uv_hub_info->apic_pnode_shift);
  344. }
  345. /*
  346. * Convert an apicid to the socket number on the blade
  347. */
  348. static inline int uv_apicid_to_socket(int apicid)
  349. {
  350. if (is_uv1_hub())
  351. return (apicid >> (uv_hub_info->apic_pnode_shift - 1)) & 1;
  352. else
  353. return 0;
  354. }
  355. /*
  356. * Access global MMRs using the low memory MMR32 space. This region supports
  357. * faster MMR access but not all MMRs are accessible in this space.
  358. */
  359. static inline unsigned long *uv_global_mmr32_address(int pnode, unsigned long offset)
  360. {
  361. return __va(UV_GLOBAL_MMR32_BASE |
  362. UV_GLOBAL_MMR32_PNODE_BITS(pnode) | offset);
  363. }
  364. static inline void uv_write_global_mmr32(int pnode, unsigned long offset, unsigned long val)
  365. {
  366. writeq(val, uv_global_mmr32_address(pnode, offset));
  367. }
  368. static inline unsigned long uv_read_global_mmr32(int pnode, unsigned long offset)
  369. {
  370. return readq(uv_global_mmr32_address(pnode, offset));
  371. }
  372. /*
  373. * Access Global MMR space using the MMR space located at the top of physical
  374. * memory.
  375. */
  376. static inline volatile void __iomem *uv_global_mmr64_address(int pnode, unsigned long offset)
  377. {
  378. return __va(UV_GLOBAL_MMR64_BASE |
  379. UV_GLOBAL_MMR64_PNODE_BITS(pnode) | offset);
  380. }
  381. static inline void uv_write_global_mmr64(int pnode, unsigned long offset, unsigned long val)
  382. {
  383. writeq(val, uv_global_mmr64_address(pnode, offset));
  384. }
  385. static inline unsigned long uv_read_global_mmr64(int pnode, unsigned long offset)
  386. {
  387. return readq(uv_global_mmr64_address(pnode, offset));
  388. }
  389. /*
  390. * Global MMR space addresses when referenced by the GRU. (GRU does
  391. * NOT use socket addressing).
  392. */
  393. static inline unsigned long uv_global_gru_mmr_address(int pnode, unsigned long offset)
  394. {
  395. return UV_GLOBAL_GRU_MMR_BASE | offset |
  396. ((unsigned long)pnode << uv_hub_info->m_val);
  397. }
  398. static inline void uv_write_global_mmr8(int pnode, unsigned long offset, unsigned char val)
  399. {
  400. writeb(val, uv_global_mmr64_address(pnode, offset));
  401. }
  402. static inline unsigned char uv_read_global_mmr8(int pnode, unsigned long offset)
  403. {
  404. return readb(uv_global_mmr64_address(pnode, offset));
  405. }
  406. /*
  407. * Access hub local MMRs. Faster than using global space but only local MMRs
  408. * are accessible.
  409. */
  410. static inline unsigned long *uv_local_mmr_address(unsigned long offset)
  411. {
  412. return __va(UV_LOCAL_MMR_BASE | offset);
  413. }
  414. static inline unsigned long uv_read_local_mmr(unsigned long offset)
  415. {
  416. return readq(uv_local_mmr_address(offset));
  417. }
  418. static inline void uv_write_local_mmr(unsigned long offset, unsigned long val)
  419. {
  420. writeq(val, uv_local_mmr_address(offset));
  421. }
  422. static inline unsigned char uv_read_local_mmr8(unsigned long offset)
  423. {
  424. return readb(uv_local_mmr_address(offset));
  425. }
  426. static inline void uv_write_local_mmr8(unsigned long offset, unsigned char val)
  427. {
  428. writeb(val, uv_local_mmr_address(offset));
  429. }
  430. /*
  431. * Structures and definitions for converting between cpu, node, pnode, and blade
  432. * numbers.
  433. */
  434. struct uv_blade_info {
  435. unsigned short nr_possible_cpus;
  436. unsigned short nr_online_cpus;
  437. unsigned short pnode;
  438. short memory_nid;
  439. spinlock_t nmi_lock;
  440. unsigned long nmi_count;
  441. };
  442. extern struct uv_blade_info *uv_blade_info;
  443. extern short *uv_node_to_blade;
  444. extern short *uv_cpu_to_blade;
  445. extern short uv_possible_blades;
  446. /* Blade-local cpu number of current cpu. Numbered 0 .. <# cpus on the blade> */
  447. static inline int uv_blade_processor_id(void)
  448. {
  449. return uv_hub_info->blade_processor_id;
  450. }
  451. /* Blade number of current cpu. Numnbered 0 .. <#blades -1> */
  452. static inline int uv_numa_blade_id(void)
  453. {
  454. return uv_hub_info->numa_blade_id;
  455. }
  456. /* Convert a cpu number to the the UV blade number */
  457. static inline int uv_cpu_to_blade_id(int cpu)
  458. {
  459. return uv_cpu_to_blade[cpu];
  460. }
  461. /* Convert linux node number to the UV blade number */
  462. static inline int uv_node_to_blade_id(int nid)
  463. {
  464. return uv_node_to_blade[nid];
  465. }
  466. /* Convert a blade id to the PNODE of the blade */
  467. static inline int uv_blade_to_pnode(int bid)
  468. {
  469. return uv_blade_info[bid].pnode;
  470. }
  471. /* Nid of memory node on blade. -1 if no blade-local memory */
  472. static inline int uv_blade_to_memory_nid(int bid)
  473. {
  474. return uv_blade_info[bid].memory_nid;
  475. }
  476. /* Determine the number of possible cpus on a blade */
  477. static inline int uv_blade_nr_possible_cpus(int bid)
  478. {
  479. return uv_blade_info[bid].nr_possible_cpus;
  480. }
  481. /* Determine the number of online cpus on a blade */
  482. static inline int uv_blade_nr_online_cpus(int bid)
  483. {
  484. return uv_blade_info[bid].nr_online_cpus;
  485. }
  486. /* Convert a cpu id to the PNODE of the blade containing the cpu */
  487. static inline int uv_cpu_to_pnode(int cpu)
  488. {
  489. return uv_blade_info[uv_cpu_to_blade_id(cpu)].pnode;
  490. }
  491. /* Convert a linux node number to the PNODE of the blade */
  492. static inline int uv_node_to_pnode(int nid)
  493. {
  494. return uv_blade_info[uv_node_to_blade_id(nid)].pnode;
  495. }
  496. /* Maximum possible number of blades */
  497. static inline int uv_num_possible_blades(void)
  498. {
  499. return uv_possible_blades;
  500. }
  501. /* Update SCIR state */
  502. static inline void uv_set_scir_bits(unsigned char value)
  503. {
  504. if (uv_hub_info->scir.state != value) {
  505. uv_hub_info->scir.state = value;
  506. uv_write_local_mmr8(uv_hub_info->scir.offset, value);
  507. }
  508. }
  509. static inline unsigned long uv_scir_offset(int apicid)
  510. {
  511. return SCIR_LOCAL_MMR_BASE | (apicid & 0x3f);
  512. }
  513. static inline void uv_set_cpu_scir_bits(int cpu, unsigned char value)
  514. {
  515. if (uv_cpu_hub_info(cpu)->scir.state != value) {
  516. uv_write_global_mmr8(uv_cpu_to_pnode(cpu),
  517. uv_cpu_hub_info(cpu)->scir.offset, value);
  518. uv_cpu_hub_info(cpu)->scir.state = value;
  519. }
  520. }
  521. extern unsigned int uv_apicid_hibits;
  522. static unsigned long uv_hub_ipi_value(int apicid, int vector, int mode)
  523. {
  524. apicid |= uv_apicid_hibits;
  525. return (1UL << UVH_IPI_INT_SEND_SHFT) |
  526. ((apicid) << UVH_IPI_INT_APIC_ID_SHFT) |
  527. (mode << UVH_IPI_INT_DELIVERY_MODE_SHFT) |
  528. (vector << UVH_IPI_INT_VECTOR_SHFT);
  529. }
  530. static inline void uv_hub_send_ipi(int pnode, int apicid, int vector)
  531. {
  532. unsigned long val;
  533. unsigned long dmode = dest_Fixed;
  534. if (vector == NMI_VECTOR)
  535. dmode = dest_NMI;
  536. val = uv_hub_ipi_value(apicid, vector, dmode);
  537. uv_write_global_mmr64(pnode, UVH_IPI_INT, val);
  538. }
  539. /*
  540. * Get the minimum revision number of the hub chips within the partition.
  541. * 1 - UV1 rev 1.0 initial silicon
  542. * 2 - UV1 rev 2.0 production silicon
  543. * 3 - UV2 rev 1.0 initial silicon
  544. * 5 - UV3 rev 1.0 initial silicon
  545. */
  546. static inline int uv_get_min_hub_revision_id(void)
  547. {
  548. return uv_hub_info->hub_revision;
  549. }
  550. #endif /* CONFIG_X86_64 */
  551. #endif /* _ASM_X86_UV_UV_HUB_H */