Commit 36afc3af authored by Ingo Molnar's avatar Ingo Molnar

x86, numaq_32: clean up

Impact: cleanup

- refactor smp_dump_qct()
- tidy up include files, remove duplicates
- misc other cleanups, pointed out by checkpatch

No code changed:

md5:
   9c0bc01a53558c77df0f2ebcda7e11a9  numaq_32.o.before.asm
   9c0bc01a53558c77df0f2ebcda7e11a9  numaq_32.o.after.asm
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent 7da18ed9
...@@ -22,21 +22,54 @@ ...@@ -22,21 +22,54 @@
* *
* Send feedback to <gone@us.ibm.com> * Send feedback to <gone@us.ibm.com>
*/ */
#include <linux/nodemask.h> #include <linux/nodemask.h>
#include <linux/bootmem.h> #include <linux/bootmem.h>
#include <linux/threads.h>
#include <linux/cpumask.h>
#include <linux/kernel.h>
#include <linux/mmzone.h> #include <linux/mmzone.h>
#include <linux/module.h> #include <linux/module.h>
#include <linux/string.h>
#include <linux/init.h>
#include <linux/numa.h>
#include <linux/smp.h>
#include <linux/mm.h> #include <linux/mm.h>
#include <asm/processor.h> #include <asm/processor.h>
#include <asm/topology.h> #include <asm/topology.h>
#include <asm/apic.h> #include <asm/fixmap.h>
#include <asm/mpspec.h>
#include <asm/numaq.h> #include <asm/numaq.h>
#include <asm/setup.h> #include <asm/setup.h>
#include <asm/apic.h>
#include <asm/e820.h> #include <asm/e820.h>
#include <asm/ipi.h>
#include <asm/io.h>
#define MB_TO_PAGES(addr) ((addr) << (20 - PAGE_SHIFT)) #define MB_TO_PAGES(addr) ((addr) << (20 - PAGE_SHIFT))
static inline void numaq_register_node(int node, struct sys_cfg_data *scd)
{
struct eachquadmem *eq = scd->eq + node;
node_set_online(node);
/* Convert to pages */
node_start_pfn[node] =
MB_TO_PAGES(eq->hi_shrd_mem_start - eq->priv_mem_size);
node_end_pfn[node] =
MB_TO_PAGES(eq->hi_shrd_mem_start + eq->hi_shrd_mem_size);
e820_register_active_regions(node, node_start_pfn[node],
node_end_pfn[node]);
memory_present(node, node_start_pfn[node], node_end_pfn[node]);
node_remap_size[node] = node_memmap_size_bytes(node,
node_start_pfn[node],
node_end_pfn[node]);
}
/* /*
* Function: smp_dump_qct() * Function: smp_dump_qct()
...@@ -46,34 +79,18 @@ ...@@ -46,34 +79,18 @@
*/ */
static void __init smp_dump_qct(void) static void __init smp_dump_qct(void)
{ {
struct sys_cfg_data *scd;
int node; int node;
struct eachquadmem *eq;
struct sys_cfg_data *scd = scd = (void *)__va(SYS_CFG_DATA_PRIV_ADDR);
(struct sys_cfg_data *)__va(SYS_CFG_DATA_PRIV_ADDR);
nodes_clear(node_online_map); nodes_clear(node_online_map);
for_each_node(node) { for_each_node(node) {
if (scd->quads_present31_0 & (1 << node)) { if (scd->quads_present31_0 & (1 << node))
node_set_online(node); numaq_register_node(node, scd);
eq = &scd->eq[node];
/* Convert to pages */
node_start_pfn[node] = MB_TO_PAGES(
eq->hi_shrd_mem_start - eq->priv_mem_size);
node_end_pfn[node] = MB_TO_PAGES(
eq->hi_shrd_mem_start + eq->hi_shrd_mem_size);
e820_register_active_regions(node, node_start_pfn[node],
node_end_pfn[node]);
memory_present(node,
node_start_pfn[node], node_end_pfn[node]);
node_remap_size[node] = node_memmap_size_bytes(node,
node_start_pfn[node],
node_end_pfn[node]);
}
} }
} }
void __cpuinit numaq_tsc_disable(void) void __cpuinit numaq_tsc_disable(void)
{ {
if (!found_numaq) if (!found_numaq)
...@@ -98,20 +115,20 @@ int found_numaq; ...@@ -98,20 +115,20 @@ int found_numaq;
* hence the mpc_record variable .... can't see a less disgusting way of * hence the mpc_record variable .... can't see a less disgusting way of
* doing this .... * doing this ....
*/ */
struct mpc_config_translation { struct mpc_trans {
unsigned char mpc_type; unsigned char mpc_type;
unsigned char trans_len; unsigned char trans_len;
unsigned char trans_type; unsigned char trans_type;
unsigned char trans_quad; unsigned char trans_quad;
unsigned char trans_global; unsigned char trans_global;
unsigned char trans_local; unsigned char trans_local;
unsigned short trans_reserved; unsigned short trans_reserved;
}; };
/* x86_quirks member */ /* x86_quirks member */
static int mpc_record; static int mpc_record;
static struct mpc_config_translation *translation_table[MAX_MPC_ENTRY]
__cpuinitdata; static __cpuinitdata struct mpc_trans *translation_table[MAX_MPC_ENTRY];
static inline int generate_logical_apicid(int quad, int phys_apicid) static inline int generate_logical_apicid(int quad, int phys_apicid)
{ {
...@@ -124,10 +141,12 @@ static int mpc_apic_id(struct mpc_cpu *m) ...@@ -124,10 +141,12 @@ static int mpc_apic_id(struct mpc_cpu *m)
int quad = translation_table[mpc_record]->trans_quad; int quad = translation_table[mpc_record]->trans_quad;
int logical_apicid = generate_logical_apicid(quad, m->apicid); int logical_apicid = generate_logical_apicid(quad, m->apicid);
printk(KERN_DEBUG "Processor #%d %u:%u APIC version %d (quad %d, apic %d)\n", printk(KERN_DEBUG
m->apicid, (m->cpufeature & CPU_FAMILY_MASK) >> 8, "Processor #%d %u:%u APIC version %d (quad %d, apic %d)\n",
(m->cpufeature & CPU_MODEL_MASK) >> 4, m->apicid, (m->cpufeature & CPU_FAMILY_MASK) >> 8,
m->apicver, quad, logical_apicid); (m->cpufeature & CPU_MODEL_MASK) >> 4,
m->apicver, quad, logical_apicid);
return logical_apicid; return logical_apicid;
} }
...@@ -143,11 +162,11 @@ static void mpc_oem_bus_info(struct mpc_bus *m, char *name) ...@@ -143,11 +162,11 @@ static void mpc_oem_bus_info(struct mpc_bus *m, char *name)
mp_bus_id_to_node[m->busid] = quad; mp_bus_id_to_node[m->busid] = quad;
mp_bus_id_to_local[m->busid] = local; mp_bus_id_to_local[m->busid] = local;
printk(KERN_INFO "Bus #%d is %s (node %d)\n",
m->busid, name, quad); printk(KERN_INFO "Bus #%d is %s (node %d)\n", m->busid, name, quad);
} }
int quad_local_to_mp_bus_id [NR_CPUS/4][4]; int quad_local_to_mp_bus_id[NR_CPUS/4][4];
/* x86_quirks member */ /* x86_quirks member */
static void mpc_oem_pci_bus(struct mpc_bus *m) static void mpc_oem_pci_bus(struct mpc_bus *m)
...@@ -158,7 +177,7 @@ static void mpc_oem_pci_bus(struct mpc_bus *m) ...@@ -158,7 +177,7 @@ static void mpc_oem_pci_bus(struct mpc_bus *m)
quad_local_to_mp_bus_id[quad][local] = m->busid; quad_local_to_mp_bus_id[quad][local] = m->busid;
} }
static void __init MP_translation_info(struct mpc_config_translation *m) static void __init MP_translation_info(struct mpc_trans *m)
{ {
printk(KERN_INFO printk(KERN_INFO
"Translation: record %d, type %d, quad %d, global %d, local %d\n", "Translation: record %d, type %d, quad %d, global %d, local %d\n",
...@@ -168,7 +187,8 @@ static void __init MP_translation_info(struct mpc_config_translation *m) ...@@ -168,7 +187,8 @@ static void __init MP_translation_info(struct mpc_config_translation *m)
if (mpc_record >= MAX_MPC_ENTRY) if (mpc_record >= MAX_MPC_ENTRY)
printk(KERN_ERR "MAX_MPC_ENTRY exceeded!\n"); printk(KERN_ERR "MAX_MPC_ENTRY exceeded!\n");
else else
translation_table[mpc_record] = m; /* stash this for later */ translation_table[mpc_record] = m; /* stash this for later */
if (m->trans_quad < MAX_NUMNODES && !node_online(m->trans_quad)) if (m->trans_quad < MAX_NUMNODES && !node_online(m->trans_quad))
node_set_online(m->trans_quad); node_set_online(m->trans_quad);
} }
...@@ -186,16 +206,16 @@ static int __init mpf_checksum(unsigned char *mp, int len) ...@@ -186,16 +206,16 @@ static int __init mpf_checksum(unsigned char *mp, int len)
/* /*
* Read/parse the MPC oem tables * Read/parse the MPC oem tables
*/ */
static void __init
static void __init smp_read_mpc_oem(struct mpc_oemtable *oemtable, smp_read_mpc_oem(struct mpc_oemtable *oemtable, unsigned short oemsize)
unsigned short oemsize)
{ {
int count = sizeof(*oemtable); /* the header size */ int count = sizeof(*oemtable); /* the header size */
unsigned char *oemptr = ((unsigned char *)oemtable) + count; unsigned char *oemptr = ((unsigned char *)oemtable) + count;
mpc_record = 0; mpc_record = 0;
printk(KERN_INFO "Found an OEM MPC table at %8p - parsing it ... \n", printk(KERN_INFO
oemtable); "Found an OEM MPC table at %8p - parsing it ... \n", oemtable);
if (memcmp(oemtable->signature, MPC_OEM_SIGNATURE, 4)) { if (memcmp(oemtable->signature, MPC_OEM_SIGNATURE, 4)) {
printk(KERN_WARNING printk(KERN_WARNING
"SMP mpc oemtable: bad signature [%c%c%c%c]!\n", "SMP mpc oemtable: bad signature [%c%c%c%c]!\n",
...@@ -203,16 +223,18 @@ static void __init smp_read_mpc_oem(struct mpc_oemtable *oemtable, ...@@ -203,16 +223,18 @@ static void __init smp_read_mpc_oem(struct mpc_oemtable *oemtable,
oemtable->signature[2], oemtable->signature[3]); oemtable->signature[2], oemtable->signature[3]);
return; return;
} }
if (mpf_checksum((unsigned char *)oemtable, oemtable->length)) { if (mpf_checksum((unsigned char *)oemtable, oemtable->length)) {
printk(KERN_WARNING "SMP oem mptable: checksum error!\n"); printk(KERN_WARNING "SMP oem mptable: checksum error!\n");
return; return;
} }
while (count < oemtable->length) { while (count < oemtable->length) {
switch (*oemptr) { switch (*oemptr) {
case MP_TRANSLATION: case MP_TRANSLATION:
{ {
struct mpc_config_translation *m = struct mpc_trans *m = (void *)oemptr;
(struct mpc_config_translation *)oemptr;
MP_translation_info(m); MP_translation_info(m);
oemptr += sizeof(*m); oemptr += sizeof(*m);
count += sizeof(*m); count += sizeof(*m);
...@@ -220,12 +242,10 @@ static void __init smp_read_mpc_oem(struct mpc_oemtable *oemtable, ...@@ -220,12 +242,10 @@ static void __init smp_read_mpc_oem(struct mpc_oemtable *oemtable,
break; break;
} }
default: default:
{ printk(KERN_WARNING
printk(KERN_WARNING "Unrecognised OEM table entry type! - %d\n",
"Unrecognised OEM table entry type! - %d\n", (int)*oemptr);
(int)*oemptr); return;
return;
}
} }
} }
} }
...@@ -244,21 +264,21 @@ static int __init numaq_update_genapic(void) ...@@ -244,21 +264,21 @@ static int __init numaq_update_genapic(void)
} }
static struct x86_quirks numaq_x86_quirks __initdata = { static struct x86_quirks numaq_x86_quirks __initdata = {
.arch_pre_time_init = numaq_pre_time_init, .arch_pre_time_init = numaq_pre_time_init,
.arch_time_init = NULL, .arch_time_init = NULL,
.arch_pre_intr_init = NULL, .arch_pre_intr_init = NULL,
.arch_memory_setup = NULL, .arch_memory_setup = NULL,
.arch_intr_init = NULL, .arch_intr_init = NULL,
.arch_trap_init = NULL, .arch_trap_init = NULL,
.mach_get_smp_config = NULL, .mach_get_smp_config = NULL,
.mach_find_smp_config = NULL, .mach_find_smp_config = NULL,
.mpc_record = &mpc_record, .mpc_record = &mpc_record,
.mpc_apic_id = mpc_apic_id, .mpc_apic_id = mpc_apic_id,
.mpc_oem_bus_info = mpc_oem_bus_info, .mpc_oem_bus_info = mpc_oem_bus_info,
.mpc_oem_pci_bus = mpc_oem_pci_bus, .mpc_oem_pci_bus = mpc_oem_pci_bus,
.smp_read_mpc_oem = smp_read_mpc_oem, .smp_read_mpc_oem = smp_read_mpc_oem,
.setup_ioapic_ids = numaq_setup_ioapic_ids, .setup_ioapic_ids = numaq_setup_ioapic_ids,
.update_genapic = numaq_update_genapic, .update_genapic = numaq_update_genapic,
}; };
void numaq_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid) void numaq_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid)
...@@ -275,6 +295,7 @@ static __init void early_check_numaq(void) ...@@ -275,6 +295,7 @@ static __init void early_check_numaq(void)
* Find possible boot-time SMP configuration: * Find possible boot-time SMP configuration:
*/ */
early_find_smp_config(); early_find_smp_config();
/* /*
* get boot-time SMP configuration: * get boot-time SMP configuration:
*/ */
...@@ -291,28 +312,10 @@ int __init get_memcfg_numaq(void) ...@@ -291,28 +312,10 @@ int __init get_memcfg_numaq(void)
if (!found_numaq) if (!found_numaq)
return 0; return 0;
smp_dump_qct(); smp_dump_qct();
return 1; return 1;
} }
/*
* APIC driver for the IBM NUMAQ chipset.
*/
#include <linux/threads.h>
#include <linux/cpumask.h>
#include <asm/mpspec.h>
#include <asm/fixmap.h>
#include <asm/apicdef.h>
#include <asm/ipi.h>
#include <linux/kernel.h>
#include <linux/string.h>
#include <linux/init.h>
#include <linux/numa.h>
#include <linux/smp.h>
#include <asm/numaq.h>
#include <asm/io.h>
#include <linux/mmzone.h>
#include <linux/nodemask.h>
#define NUMAQ_APIC_DFR_VALUE (APIC_DFR_CLUSTER) #define NUMAQ_APIC_DFR_VALUE (APIC_DFR_CLUSTER)
static inline unsigned int numaq_get_apic_id(unsigned long x) static inline unsigned int numaq_get_apic_id(unsigned long x)
...@@ -337,8 +340,8 @@ static inline void numaq_send_IPI_all(int vector) ...@@ -337,8 +340,8 @@ static inline void numaq_send_IPI_all(int vector)
extern void numaq_mps_oem_check(struct mpc_table *, char *, char *); extern void numaq_mps_oem_check(struct mpc_table *, char *, char *);
#define NUMAQ_TRAMPOLINE_PHYS_LOW (0x8) #define NUMAQ_TRAMPOLINE_PHYS_LOW (0x8)
#define NUMAQ_TRAMPOLINE_PHYS_HIGH (0xa) #define NUMAQ_TRAMPOLINE_PHYS_HIGH (0xa)
/* /*
* Because we use NMIs rather than the INIT-STARTUP sequence to * Because we use NMIs rather than the INIT-STARTUP sequence to
...@@ -426,7 +429,7 @@ static inline int numaq_cpu_present_to_apicid(int mps_cpu) ...@@ -426,7 +429,7 @@ static inline int numaq_cpu_present_to_apicid(int mps_cpu)
return BAD_APICID; return BAD_APICID;
} }
static inline int numaq_apicid_to_node(int logical_apicid) static inline int numaq_apicid_to_node(int logical_apicid)
{ {
return logical_apicid >> 4; return logical_apicid >> 4;
} }
...@@ -468,7 +471,9 @@ static inline int numaq_phys_pkg_id(int cpuid_apic, int index_msb) ...@@ -468,7 +471,9 @@ static inline int numaq_phys_pkg_id(int cpuid_apic, int index_msb)
{ {
return cpuid_apic >> index_msb; return cpuid_apic >> index_msb;
} }
static int __numaq_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid)
static int
__numaq_mps_oem_check(struct mpc_table *mpc, char *oem, char *productid)
{ {
numaq_mps_oem_check(mpc, oem, productid); numaq_mps_oem_check(mpc, oem, productid);
return found_numaq; return found_numaq;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment