Date: Sun, 16 Aug 2009 01:43:08 +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: r196268 - head/sys/ia64/ia64 Message-ID: <200908160143.n7G1h8JK096540@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: marcel Date: Sun Aug 16 01:43:08 2009 New Revision: 196268 URL: http://svn.freebsd.org/changeset/base/196268 Log: Decouple ACPI CPU Ids from FreeBSD's cpuid. The ACPI Ids can be sparse, which causes a kernel assert. Approved by: re (kensmith) Modified: head/sys/ia64/ia64/genassym.c head/sys/ia64/ia64/machdep.c head/sys/ia64/ia64/mp_machdep.c Modified: head/sys/ia64/ia64/genassym.c ============================================================================== --- head/sys/ia64/ia64/genassym.c Sat Aug 15 23:07:43 2009 (r196267) +++ head/sys/ia64/ia64/genassym.c Sun Aug 16 01:43:08 2009 (r196268) @@ -91,7 +91,6 @@ ASSYM(MC_SPECIAL_RNAT, offsetof(mcontext ASSYM(PAGE_SHIFT, PAGE_SHIFT); ASSYM(PAGE_SIZE, PAGE_SIZE); -ASSYM(PC_CPUID, offsetof(struct pcpu, pc_cpuid)); ASSYM(PC_CURRENT_PMAP, offsetof(struct pcpu, pc_current_pmap)); ASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread)); ASSYM(PC_IDLETHREAD, offsetof(struct pcpu, pc_idlethread)); Modified: head/sys/ia64/ia64/machdep.c ============================================================================== --- head/sys/ia64/ia64/machdep.c Sat Aug 15 23:07:43 2009 (r196267) +++ head/sys/ia64/ia64/machdep.c Sun Aug 16 01:43:08 2009 (r196268) @@ -424,7 +424,11 @@ void cpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t size) { - pcpu->pc_acpi_id = cpuid; + /* + * Set pc_acpi_id to "uninitialized". + * See sys/dev/acpica/acpi_cpu.c + */ + pcpu->pc_acpi_id = 0xffffffff; } void Modified: head/sys/ia64/ia64/mp_machdep.c ============================================================================== --- head/sys/ia64/ia64/mp_machdep.c Sat Aug 15 23:07:43 2009 (r196267) +++ head/sys/ia64/ia64/mp_machdep.c Sun Aug 16 01:43:08 2009 (r196268) @@ -208,31 +208,25 @@ cpu_mp_add(u_int acpiid, u_int apicid, u struct pcpu *pc; u_int64_t lid; void *dpcpu; - - /* Ignore any processor numbers outside our range */ - if (acpiid > mp_maxid) - return; - - KASSERT((all_cpus & (1UL << acpiid)) == 0, - ("%s: cpu%d already in CPU map", __func__, acpiid)); + u_int cpuid; lid = LID_SAPIC_SET(apicid, apiceid); + cpuid = ((ia64_get_lid() & LID_SAPIC_MASK) == lid) ? 0 : smp_cpus++; - if ((ia64_get_lid() & LID_SAPIC_MASK) == lid) { - KASSERT(acpiid == 0, - ("%s: the BSP must be cpu0", __func__)); - } + KASSERT((all_cpus & (1UL << cpuid)) == 0, + ("%s: cpu%d already in CPU map", __func__, acpiid)); - if (acpiid != 0) { + if (cpuid != 0) { pc = (struct pcpu *)malloc(sizeof(*pc), M_SMP, M_WAITOK); + pcpu_init(pc, cpuid, sizeof(*pc)); dpcpu = (void *)kmem_alloc(kernel_map, DPCPU_SIZE); - pcpu_init(pc, acpiid, sizeof(*pc)); - dpcpu_init(dpcpu, acpiid); + dpcpu_init(dpcpu, cpuid); } else pc = pcpup; + pc->pc_acpi_id = acpiid; pc->pc_lid = lid; - all_cpus |= (1UL << acpiid); + all_cpus |= (1UL << cpuid); } void @@ -244,8 +238,8 @@ cpu_mp_announce() for (i = 0; i <= mp_maxid; i++) { pc = pcpu_find(i); if (pc != NULL) { - printf("cpu%d: SAPIC Id=%x, SAPIC Eid=%x", i, - LID_SAPIC_ID(pc->pc_lid), + printf("cpu%d: ACPI Id=%x, SAPIC Id=%x, SAPIC Eid=%x", + i, pc->pc_acpi_id, LID_SAPIC_ID(pc->pc_lid), LID_SAPIC_EID(pc->pc_lid)); if (i == 0) printf(" (BSP)\n"); @@ -305,7 +299,9 @@ cpu_mp_unleash(void *dummy) SLIST_FOREACH(pc, &cpuhead, pc_allcpu) { cpus++; if (pc->pc_awake) { - kproc_create(ia64_store_mca_state, (void*)((uintptr_t)pc->pc_cpuid), NULL, 0, 0, "mca %u", pc->pc_cpuid); + kproc_create(ia64_store_mca_state, + (void*)((uintptr_t)pc->pc_cpuid), NULL, 0, 0, + "mca %u", pc->pc_cpuid); smp_cpus++; } }
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200908160143.n7G1h8JK096540>