numaq.c 2.4 KB

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