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.
This commit is contained in:
marcel 2012-07-08 18:00:22 +00:00
parent bfa21239bc
commit 070f1b40de
3 changed files with 13 additions and 4 deletions

View File

@ -505,6 +505,14 @@ cpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t size)
pcpu->pc_acpi_id = 0xffffffff;
}
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)
{
@ -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);
/*

View File

@ -309,9 +309,8 @@ cpu_mp_add(u_int acpi_id, u_int id, u_int eid)
} 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);
}

View File

@ -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);