numaq.c 2.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  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/config.h>
  26. #include <linux/mm.h>
  27. #include <linux/bootmem.h>
  28. #include <linux/mmzone.h>
  29. #include <linux/module.h>
  30. #include <linux/nodemask.h>
  31. #include <asm/numaq.h>
  32. #include <asm/topology.h>
  33. #include <asm/processor.h>
  34. #define MB_TO_PAGES(addr) ((addr) << (20 - PAGE_SHIFT))
  35. /*
  36. * Function: smp_dump_qct()
  37. *
  38. * Description: gets memory layout from the quad config table. This
  39. * function also updates node_online_map with the nodes (quads) present.
  40. */
  41. static void __init smp_dump_qct(void)
  42. {
  43. int node;
  44. struct eachquadmem *eq;
  45. struct sys_cfg_data *scd =
  46. (struct sys_cfg_data *)__va(SYS_CFG_DATA_PRIV_ADDR);
  47. nodes_clear(node_online_map);
  48. for_each_node(node) {
  49. if (scd->quads_present31_0 & (1 << node)) {
  50. node_set_online(node);
  51. eq = &scd->eq[node];
  52. /* Convert to pages */
  53. node_start_pfn[node] = MB_TO_PAGES(
  54. eq->hi_shrd_mem_start - eq->priv_mem_size);
  55. node_end_pfn[node] = MB_TO_PAGES(
  56. eq->hi_shrd_mem_start + eq->hi_shrd_mem_size);
  57. memory_present(node,
  58. node_start_pfn[node], node_end_pfn[node]);
  59. node_remap_size[node] = node_memmap_size_bytes(node,
  60. node_start_pfn[node],
  61. node_end_pfn[node]);
  62. }
  63. }
  64. }
  65. /*
  66. * Unlike Summit, we don't really care to let the NUMA-Q
  67. * fall back to flat mode. Don't compile for NUMA-Q
  68. * unless you really need it!
  69. */
  70. int __init get_memcfg_numaq(void)
  71. {
  72. smp_dump_qct();
  73. return 1;
  74. }
  75. static int __init numaq_dsc_disable(void)
  76. {
  77. printk(KERN_DEBUG "NUMAQ: disabling TSC\n");
  78. tsc_disable = 1;
  79. return 0;
  80. }
  81. core_initcall(numaq_dsc_disable);