numaq_32.c 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * Written by: Patricia Gaughen, IBM Corporation
  3. *
  4. * Copyright (C) 2002, IBM Corp.
  5. *
  6. * All rights reserved.
  7. *
  8. * This program is free software; you can redistribute it and/or modify
  9. * it under the terms of the GNU General Public License as published by
  10. * the Free Software Foundation; either version 2 of the License, or
  11. * (at your option) any later version.
  12. *
  13. * This program is distributed in the hope that it will be useful, but
  14. * WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE, GOOD TITLE or
  16. * NON INFRINGEMENT. See the GNU General Public License for more
  17. * details.
  18. *
  19. * You should have received a copy of the GNU General Public License
  20. * along with this program; if not, write to the Free Software
  21. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  22. *
  23. * Send feedback to <gone@us.ibm.com>
  24. */
  25. #include <linux/mm.h>
  26. #include <linux/bootmem.h>
  27. #include <linux/mmzone.h>
  28. #include <linux/module.h>
  29. #include <linux/nodemask.h>
  30. #include <asm/numaq.h>
  31. #include <asm/topology.h>
  32. #include <asm/processor.h>
  33. #include <asm/mpspec.h>
  34. #include <asm/e820.h>
  35. #define MB_TO_PAGES(addr) ((addr) << (20 - PAGE_SHIFT))
  36. /*
  37. * Function: smp_dump_qct()
  38. *
  39. * Description: gets memory layout from the quad config table. This
  40. * function also updates node_online_map with the nodes (quads) present.
  41. */
  42. static void __init smp_dump_qct(void)
  43. {
  44. int node;
  45. struct eachquadmem *eq;
  46. struct sys_cfg_data *scd =
  47. (struct sys_cfg_data *)__va(SYS_CFG_DATA_PRIV_ADDR);
  48. nodes_clear(node_online_map);
  49. for_each_node(node) {
  50. if (scd->quads_present31_0 & (1 << node)) {
  51. node_set_online(node);
  52. eq = &scd->eq[node];
  53. /* Convert to pages */
  54. node_start_pfn[node] = MB_TO_PAGES(
  55. eq->hi_shrd_mem_start - eq->priv_mem_size);
  56. node_end_pfn[node] = MB_TO_PAGES(
  57. eq->hi_shrd_mem_start + eq->hi_shrd_mem_size);
  58. e820_register_active_regions(node, node_start_pfn[node],
  59. node_end_pfn[node]);
  60. memory_present(node,
  61. node_start_pfn[node], node_end_pfn[node]);
  62. node_remap_size[node] = node_memmap_size_bytes(node,
  63. node_start_pfn[node],
  64. node_end_pfn[node]);
  65. }
  66. }
  67. }
  68. static __init void early_check_numaq(void)
  69. {
  70. /*
  71. * Find possible boot-time SMP configuration:
  72. */
  73. early_find_smp_config();
  74. /*
  75. * get boot-time SMP configuration:
  76. */
  77. if (smp_found_config)
  78. early_get_smp_config();
  79. }
  80. int __init get_memcfg_numaq(void)
  81. {
  82. early_check_numaq();
  83. if (!found_numaq)
  84. return 0;
  85. smp_dump_qct();
  86. return 1;
  87. }
  88. void __init numaq_tsc_disable(void)
  89. {
  90. if (!found_numaq)
  91. return -1;
  92. if (num_online_nodes() > 1) {
  93. printk(KERN_DEBUG "NUMAQ: disabling TSC\n");
  94. setup_clear_cpu_cap(X86_FEATURE_TSC);
  95. }
  96. }