Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 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> |
Dave Hansen | e1474e2 | 2005-07-28 21:16:18 -0700 | [diff] [blame] | 33 | #include <asm/processor.h> |
Yinghai Lu | ab530e1 | 2008-06-03 10:25:54 -0700 | [diff] [blame] | 34 | #include <asm/mpspec.h> |
Yinghai Lu | 7b2a0a6 | 2008-06-03 19:35:04 -0700 | [diff] [blame^] | 35 | #include <asm/e820.h> |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 36 | |
| 37 | #define MB_TO_PAGES(addr) ((addr) << (20 - PAGE_SHIFT)) |
| 38 | |
Yinghai Lu | ab530e1 | 2008-06-03 10:25:54 -0700 | [diff] [blame] | 39 | int found_numaq; |
| 40 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 41 | /* |
| 42 | * Function: smp_dump_qct() |
| 43 | * |
| 44 | * Description: gets memory layout from the quad config table. This |
| 45 | * function also updates node_online_map with the nodes (quads) present. |
| 46 | */ |
| 47 | static void __init smp_dump_qct(void) |
| 48 | { |
| 49 | int node; |
| 50 | struct eachquadmem *eq; |
| 51 | struct sys_cfg_data *scd = |
| 52 | (struct sys_cfg_data *)__va(SYS_CFG_DATA_PRIV_ADDR); |
| 53 | |
| 54 | nodes_clear(node_online_map); |
| 55 | for_each_node(node) { |
| 56 | if (scd->quads_present31_0 & (1 << node)) { |
| 57 | node_set_online(node); |
| 58 | eq = &scd->eq[node]; |
| 59 | /* Convert to pages */ |
| 60 | node_start_pfn[node] = MB_TO_PAGES( |
| 61 | eq->hi_shrd_mem_start - eq->priv_mem_size); |
| 62 | node_end_pfn[node] = MB_TO_PAGES( |
| 63 | eq->hi_shrd_mem_start + eq->hi_shrd_mem_size); |
| 64 | |
Yinghai Lu | 7b2a0a6 | 2008-06-03 19:35:04 -0700 | [diff] [blame^] | 65 | e820_register_active_regions(node, node_start_pfn[node], |
| 66 | node_end_pfn[node]); |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 67 | memory_present(node, |
| 68 | node_start_pfn[node], node_end_pfn[node]); |
| 69 | node_remap_size[node] = node_memmap_size_bytes(node, |
| 70 | node_start_pfn[node], |
| 71 | node_end_pfn[node]); |
| 72 | } |
| 73 | } |
| 74 | } |
| 75 | |
Yinghai Lu | ab530e1 | 2008-06-03 10:25:54 -0700 | [diff] [blame] | 76 | static __init void early_check_numaq(void) |
| 77 | { |
| 78 | /* |
| 79 | * Find possible boot-time SMP configuration: |
| 80 | */ |
| 81 | early_find_smp_config(); |
| 82 | /* |
| 83 | * get boot-time SMP configuration: |
| 84 | */ |
| 85 | if (smp_found_config) |
| 86 | early_get_smp_config(); |
| 87 | } |
| 88 | |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 89 | int __init get_memcfg_numaq(void) |
| 90 | { |
Yinghai Lu | ab530e1 | 2008-06-03 10:25:54 -0700 | [diff] [blame] | 91 | early_check_numaq(); |
| 92 | if (!found_numaq) |
| 93 | return 0; |
Linus Torvalds | 1da177e | 2005-04-16 15:20:36 -0700 | [diff] [blame] | 94 | smp_dump_qct(); |
| 95 | return 1; |
| 96 | } |
Dave Hansen | e1474e2 | 2005-07-28 21:16:18 -0700 | [diff] [blame] | 97 | |
john stultz | 539eb11 | 2006-06-26 00:25:10 -0700 | [diff] [blame] | 98 | static int __init numaq_tsc_disable(void) |
Dave Hansen | e1474e2 | 2005-07-28 21:16:18 -0700 | [diff] [blame] | 99 | { |
john stultz | 539eb11 | 2006-06-26 00:25:10 -0700 | [diff] [blame] | 100 | if (num_online_nodes() > 1) { |
| 101 | printk(KERN_DEBUG "NUMAQ: disabling TSC\n"); |
Andi Kleen | 404ee5b | 2008-01-30 13:33:20 +0100 | [diff] [blame] | 102 | setup_clear_cpu_cap(X86_FEATURE_TSC); |
john stultz | 539eb11 | 2006-06-26 00:25:10 -0700 | [diff] [blame] | 103 | } |
Dave Hansen | e1474e2 | 2005-07-28 21:16:18 -0700 | [diff] [blame] | 104 | return 0; |
| 105 | } |
john stultz | 539eb11 | 2006-06-26 00:25:10 -0700 | [diff] [blame] | 106 | arch_initcall(numaq_tsc_disable); |