Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 8 Jul 2012 18:00:22 +0000 (UTC)
From:      Marcel Moolenaar <marcel@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r238257 - in head/sys/ia64: ia64 include
Message-ID:  <201207081800.q68I0Mq8066409@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: marcel
Date: Sun Jul  8 18:00:22 2012
New Revision: 238257
URL: http://svn.freebsd.org/changeset/base/238257

Log:
  Move PCPU initialization to a new function called cpu_pcpu_setup().
  This makes it easier to add additional CPU or platform information
  to the per-CPU structure without duplicated code.

Modified:
  head/sys/ia64/ia64/machdep.c
  head/sys/ia64/ia64/mp_machdep.c
  head/sys/ia64/include/md_var.h

Modified: head/sys/ia64/ia64/machdep.c
==============================================================================
--- head/sys/ia64/ia64/machdep.c	Sun Jul  8 17:43:25 2012	(r238256)
+++ head/sys/ia64/ia64/machdep.c	Sun Jul  8 18:00:22 2012	(r238257)
@@ -506,6 +506,14 @@ cpu_pcpu_init(struct pcpu *pcpu, int cpu
 }
 
 void
+cpu_pcpu_setup(struct pcpu *pc, u_int acpi_id, u_int sapic_id)
+{
+
+	pc->pc_acpi_id = acpi_id;
+	pc->pc_md.lid = IA64_LID_SET_SAPIC_ID(sapic_id);
+}
+ 
+void
 spinlock_enter(void)
 {
 	struct thread *td;
@@ -791,7 +799,7 @@ ia64_init(void)
 	ia64_set_k4((u_int64_t)pcpup);
 	pcpu_init(pcpup, 0, sizeof(pcpu0));
 	dpcpu_init(ia64_physmem_alloc(DPCPU_SIZE, PAGE_SIZE), 0);
-	PCPU_SET(md.lid, ia64_get_lid());
+	cpu_pcpu_setup(pcpup, ~0U, ia64_get_lid());
 	PCPU_SET(curthread, &thread0);
 
 	/*

Modified: head/sys/ia64/ia64/mp_machdep.c
==============================================================================
--- head/sys/ia64/ia64/mp_machdep.c	Sun Jul  8 17:43:25 2012	(r238256)
+++ head/sys/ia64/ia64/mp_machdep.c	Sun Jul  8 18:00:22 2012	(r238257)
@@ -309,9 +309,8 @@ cpu_mp_add(u_int acpi_id, u_int id, u_in
 	} else
 		pc = pcpup;
 
-	pc->pc_acpi_id = acpi_id;
-	pc->pc_md.lid = IA64_LID_SET_SAPIC_ID(sapic_id);
-
+	cpu_pcpu_setup(pc, acpi_id, sapic_id);
+ 
 	CPU_SET(pc->pc_cpuid, &all_cpus);
 }
 

Modified: head/sys/ia64/include/md_var.h
==============================================================================
--- head/sys/ia64/include/md_var.h	Sun Jul  8 17:43:25 2012	(r238256)
+++ head/sys/ia64/include/md_var.h	Sun Jul  8 18:00:22 2012	(r238257)
@@ -61,6 +61,7 @@ ia64_bsp_adjust(uint64_t bsp, int nslots
 #ifdef _KERNEL
 
 struct _special;
+struct pcpu;
 struct thread;
 struct trapframe;
 
@@ -80,6 +81,7 @@ void	*acpi_find_table(const char *sig);
 void	busdma_swi(void);
 int	copyout_regstack(struct thread *, uint64_t *, uint64_t *);
 void	cpu_mp_add(u_int, u_int, u_int);
+void	cpu_pcpu_setup(struct pcpu *, u_int, u_int);
 int	do_ast(struct trapframe *);
 void	ia32_trap(int, struct trapframe *);
 int	ia64_count_cpus(void);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201207081800.q68I0Mq8066409>