Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+100 −95
Original line number Diff line number Diff line
@@ -22,22 +22,55 @@
 *
 * Send feedback to <gone@us.ibm.com>
 */

#include <linux/nodemask.h>
#include <linux/bootmem.h>
#include <linux/threads.h>
#include <linux/cpumask.h>
#include <linux/kernel.h>
#include <linux/mmzone.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 <asm/processor.h>
#include <asm/topology.h>
#include <asm/apic.h>
#include <asm/fixmap.h>
#include <asm/mpspec.h>
#include <asm/numaq.h>
#include <asm/setup.h>
#include <asm/apic.h>
#include <asm/e820.h>
#include <asm/ipi.h>
#include <asm/io.h>

#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()
 *
@@ -46,34 +79,18 @@
 */
static void __init smp_dump_qct(void)
{
	struct sys_cfg_data *scd;
	int node;
	struct eachquadmem *eq;
	struct sys_cfg_data *scd =
		(struct sys_cfg_data *)__va(SYS_CFG_DATA_PRIV_ADDR);

	scd = (void *)__va(SYS_CFG_DATA_PRIV_ADDR);

	nodes_clear(node_online_map);
	for_each_node(node) {
		if (scd->quads_present31_0 & (1 << node)) {
			node_set_online(node);
			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]);
		}
		if (scd->quads_present31_0 & (1 << node))
			numaq_register_node(node, scd);
	}
}


void __cpuinit numaq_tsc_disable(void)
{
	if (!found_numaq)
@@ -98,7 +115,7 @@ int found_numaq;
 * hence the mpc_record variable .... can't see a less disgusting way of
 * doing this ....
 */
struct mpc_config_translation {
struct mpc_trans {
	unsigned char			mpc_type;
	unsigned char			trans_len;
	unsigned char			trans_type;
@@ -110,8 +127,8 @@ struct mpc_config_translation {

/* x86_quirks member */
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)
{
@@ -124,10 +141,12 @@ static int mpc_apic_id(struct mpc_cpu *m)
	int quad = translation_table[mpc_record]->trans_quad;
	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
		"Processor #%d %u:%u APIC version %d (quad %d, apic %d)\n",
		 m->apicid, (m->cpufeature & CPU_FAMILY_MASK) >> 8,
		(m->cpufeature & CPU_MODEL_MASK) >> 4,
		 m->apicver, quad, logical_apicid);

	return logical_apicid;
}

@@ -143,8 +162,8 @@ static void mpc_oem_bus_info(struct mpc_bus *m, char *name)

	mp_bus_id_to_node[m->busid] = quad;
	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];
@@ -158,7 +177,7 @@ static void mpc_oem_pci_bus(struct mpc_bus *m)
	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
	       "Translation: record %d, type %d, quad %d, global %d, local %d\n",
@@ -169,6 +188,7 @@ static void __init MP_translation_info(struct mpc_config_translation *m)
		printk(KERN_ERR "MAX_MPC_ENTRY exceeded!\n");
	else
		translation_table[mpc_record] = m; /* stash this for later */

	if (m->trans_quad < MAX_NUMNODES && !node_online(m->trans_quad))
		node_set_online(m->trans_quad);
}
@@ -186,16 +206,16 @@ static int __init mpf_checksum(unsigned char *mp, int len)
/*
 * Read/parse the MPC oem tables
 */

static void __init smp_read_mpc_oem(struct mpc_oemtable *oemtable,
				    unsigned short oemsize)
static void __init
 smp_read_mpc_oem(struct mpc_oemtable *oemtable, unsigned short oemsize)
{
	int count = sizeof(*oemtable);	/* the header size */
	unsigned char *oemptr = ((unsigned char *)oemtable) + count;

	mpc_record = 0;
	printk(KERN_INFO "Found an OEM MPC table at %8p - parsing it ... \n",
	       oemtable);
	printk(KERN_INFO
		"Found an OEM MPC table at %8p - parsing it ... \n", oemtable);

	if (memcmp(oemtable->signature, MPC_OEM_SIGNATURE, 4)) {
		printk(KERN_WARNING
		       "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,
		       oemtable->signature[2], oemtable->signature[3]);
		return;
	}

	if (mpf_checksum((unsigned char *)oemtable, oemtable->length)) {
		printk(KERN_WARNING "SMP oem mptable: checksum error!\n");
		return;
	}

	while (count < oemtable->length) {
		switch (*oemptr) {
		case MP_TRANSLATION:
			{
				struct mpc_config_translation *m =
				    (struct mpc_config_translation *)oemptr;
				struct mpc_trans *m = (void *)oemptr;

				MP_translation_info(m);
				oemptr += sizeof(*m);
				count += sizeof(*m);
@@ -220,7 +242,6 @@ static void __init smp_read_mpc_oem(struct mpc_oemtable *oemtable,
				break;
			}
		default:
			{
			printk(KERN_WARNING
			       "Unrecognised OEM table entry type! - %d\n",
			       (int)*oemptr);
@@ -228,7 +249,6 @@ static void __init smp_read_mpc_oem(struct mpc_oemtable *oemtable,
		}
	}
}
}

static int __init numaq_setup_ioapic_ids(void)
{
@@ -275,6 +295,7 @@ static __init void early_check_numaq(void)
	 * Find possible boot-time SMP configuration:
	 */
	early_find_smp_config();

	/*
	 * get boot-time SMP configuration:
	 */
@@ -291,28 +312,10 @@ int __init get_memcfg_numaq(void)
	if (!found_numaq)
		return 0;
	smp_dump_qct();

	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)

static inline unsigned int numaq_get_apic_id(unsigned long x)
@@ -468,7 +471,9 @@ static inline int numaq_phys_pkg_id(int cpuid_apic, int 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);
	return found_numaq;