summaryrefslogtreecommitdiffstats
path: root/sys/ia64
diff options
context:
space:
mode:
authormarcel <marcel@FreeBSD.org>2006-11-18 21:52:26 +0000
committermarcel <marcel@FreeBSD.org>2006-11-18 21:52:26 +0000
commita76d88c55cb8b38c525303578fcbb54228090878 (patch)
tree404278084df7d9b7053d56982ce4ff0b5aff9ea9 /sys/ia64
parent08b7cebe65d77af067262f36e1b05999b79990d7 (diff)
downloadFreeBSD-src-a76d88c55cb8b38c525303578fcbb54228090878.zip
FreeBSD-src-a76d88c55cb8b38c525303578fcbb54228090878.tar.gz
Now that printf() needs the PCPU, set it up before we call printf().
Change the pc_pcb field from a pointer to struct pcb to struct pcb so that sizeof(struct pcb) includes the PCB we use for IPI_STOP. Statically declare early_pcb so that we don't have to allocate the PCB for thread0. This way we can setup the PCPU before cninit() and thus before we use printf().
Diffstat (limited to 'sys/ia64')
-rw-r--r--sys/ia64/ia64/interrupt.c2
-rw-r--r--sys/ia64/ia64/machdep.c28
-rw-r--r--sys/ia64/ia64/mp_machdep.c4
-rw-r--r--sys/ia64/include/kdb.h2
-rw-r--r--sys/ia64/include/pcpu.h6
5 files changed, 16 insertions, 26 deletions
diff --git a/sys/ia64/ia64/interrupt.c b/sys/ia64/ia64/interrupt.c
index 423cd86..fefb2e2 100644
--- a/sys/ia64/ia64/interrupt.c
+++ b/sys/ia64/ia64/interrupt.c
@@ -224,7 +224,7 @@ interrupt(u_int64_t vector, struct trapframe *tf)
cpumask_t mybit = PCPU_GET(cpumask);
intr = intr_disable();
- savectx(PCPU_GET(pcb));
+ savectx(PCPU_PTR(pcb));
atomic_set_int(&stopped_cpus, mybit);
while ((started_cpus & mybit) == 0)
/* spin */;
diff --git a/sys/ia64/ia64/machdep.c b/sys/ia64/ia64/machdep.c
index f3a875e..d59c5e4 100644
--- a/sys/ia64/ia64/machdep.c
+++ b/sys/ia64/ia64/machdep.c
@@ -403,17 +403,7 @@ cpu_throw(struct thread *old __unused, struct thread *new)
void
cpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t size)
{
- size_t pcpusz;
- /*
- * Make sure the PCB is 16-byte aligned by making the PCPU
- * a multiple of 16 bytes. We assume the PCPU is 16-byte
- * aligned itself.
- */
- pcpusz = (sizeof(struct pcpu) + 15) & ~15;
- KASSERT(size >= pcpusz + sizeof(struct pcb),
- ("%s: too small an allocation for pcpu", __func__));
- pcpu->pc_pcb = (struct pcb *)((char*)pcpu + pcpusz);
pcpu->pc_acpi_id = cpuid;
}
@@ -611,6 +601,13 @@ ia64_init(void)
bootverbose = 1;
/*
+ * Setup the global data for the bootstrap cpu.
+ */
+ pcpup = &early_pcpu;
+ ia64_set_k4((u_int64_t)pcpup);
+ pcpu_init(pcpup, 0, sizeof(early_pcpu));
+
+ /*
* Initialize the console before we print anything out.
*/
cninit();
@@ -781,19 +778,10 @@ ia64_init(void)
#else
proc_linkup(&proc0, &thread0);
#endif
- /*
- * Init mapping for kernel stack for proc 0
- */
+
proc0kstack = (vm_offset_t)kstack;
thread0.td_kstack = proc0kstack;
thread0.td_kstack_pages = KSTACK_PAGES;
-
- /*
- * Setup the global data for the bootstrap cpu.
- */
- pcpup = (struct pcpu *)pmap_steal_memory(PAGE_SIZE);
- ia64_set_k4((u_int64_t)pcpup);
- pcpu_init(pcpup, 0, PAGE_SIZE);
PCPU_SET(curthread, &thread0);
mutex_init();
diff --git a/sys/ia64/ia64/mp_machdep.c b/sys/ia64/ia64/mp_machdep.c
index c25b6a1..0746437 100644
--- a/sys/ia64/ia64/mp_machdep.c
+++ b/sys/ia64/ia64/mp_machdep.c
@@ -200,8 +200,8 @@ cpu_mp_add(u_int acpiid, u_int apicid, u_int apiceid)
}
if (acpiid != 0) {
- pc = (struct pcpu *)kmem_alloc(kernel_map, PAGE_SIZE);
- pcpu_init(pc, acpiid, PAGE_SIZE);
+ pc = (struct pcpu *)malloc(sizeof(*pc), M_PMAP, M_WAITOK);
+ pcpu_init(pc, acpiid, sizeof(*pc));
} else
pc = pcpup;
diff --git a/sys/ia64/include/kdb.h b/sys/ia64/include/kdb.h
index 500a909..57d84bc 100644
--- a/sys/ia64/include/kdb.h
+++ b/sys/ia64/include/kdb.h
@@ -33,7 +33,7 @@
#include <machine/frame.h>
#include <machine/ia64_cpu.h>
-#define KDB_STOPPEDPCB(pc) (pc)->pc_pcb
+#define KDB_STOPPEDPCB(pc) (&(pc)->pc_pcb)
static __inline void
kdb_cpu_clear_singlestep(void)
diff --git a/sys/ia64/include/pcpu.h b/sys/ia64/include/pcpu.h
index beb934b1..c7bf793 100644
--- a/sys/ia64/include/pcpu.h
+++ b/sys/ia64/include/pcpu.h
@@ -32,13 +32,15 @@
#ifdef _KERNEL
+#include <machine/pcb.h>
+
#define PCPU_MD_FIELDS \
- struct pcb *pc_pcb; /* Used by IPI_STOP */ \
+ struct pcb pc_pcb; /* Used by IPI_STOP */ \
struct pmap *pc_current_pmap; /* active pmap */ \
uint64_t pc_lid; /* local CPU ID */ \
- uint32_t pc_awake:1; /* CPU is awake? */ \
uint64_t pc_clock; /* Clock counter. */ \
uint64_t pc_clockadj; /* Clock adjust. */ \
+ uint32_t pc_awake:1; /* CPU is awake? */ \
uint32_t pc_acpi_id /* ACPI CPU id. */
struct pcpu;
OpenPOWER on IntegriCloud