summaryrefslogtreecommitdiffstats
path: root/sys/amd64/acpica/acpi_wakeup.c
diff options
context:
space:
mode:
authorjkim <jkim@FreeBSD.org>2010-08-02 17:35:00 +0000
committerjkim <jkim@FreeBSD.org>2010-08-02 17:35:00 +0000
commit79a57d111a564cdef116d6cf2c34b1842377129d (patch)
treeac5b6c35aff67637e32c04209fa5f534aa1806b7 /sys/amd64/acpica/acpi_wakeup.c
parent0a86131c629fc0f57598850ae76df2002f261b3e (diff)
downloadFreeBSD-src-79a57d111a564cdef116d6cf2c34b1842377129d.zip
FreeBSD-src-79a57d111a564cdef116d6cf2c34b1842377129d.tar.gz
- Merge savectx2() with savectx() and struct xpcb with struct pcb. [1]
savectx() is only used for panic dump (dumppcb) and kdb (stoppcbs). Thus, saving additional information does not hurt and it may be even beneficial. Unfortunately, struct pcb has grown larger to accommodate more data. Move 512-byte long pcb_user_save to the end of struct pcb while I am here. - savectx() now saves FPU state unconditionally and copy it to the PCB of FPU thread if necessary. This gives panic dump and kdb a chance to take a look at the current FPU state even if the FPU is "supposedly" not used. - Resuming CPU now unconditionally reinitializes FPU. If the saved FPU state was irrelevant, it could be in an unknown state. Suggested by: bde [1]
Diffstat (limited to 'sys/amd64/acpica/acpi_wakeup.c')
-rw-r--r--sys/amd64/acpica/acpi_wakeup.c27
1 files changed, 13 insertions, 14 deletions
diff --git a/sys/amd64/acpica/acpi_wakeup.c b/sys/amd64/acpica/acpi_wakeup.c
index 982809b..6bdf658 100644
--- a/sys/amd64/acpica/acpi_wakeup.c
+++ b/sys/amd64/acpica/acpi_wakeup.c
@@ -2,7 +2,7 @@
* Copyright (c) 2001 Takanori Watanabe <takawata@jp.freebsd.org>
* Copyright (c) 2001 Mitsuru IWASAKI <iwasaki@jp.freebsd.org>
* Copyright (c) 2003 Peter Wemm
- * Copyright (c) 2008-2009 Jung-uk Kim <jkim@FreeBSD.org>
+ * Copyright (c) 2008-2010 Jung-uk Kim <jkim@FreeBSD.org>
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
@@ -66,13 +66,12 @@ extern int acpi_resume_beep;
extern int acpi_reset_video;
#ifdef SMP
-extern struct xpcb **stopxpcbs;
+extern struct pcb **susppcbs;
#else
-static struct xpcb **stopxpcbs;
+static struct pcb **susppcbs;
#endif
-int acpi_restorecpu(struct xpcb *, vm_offset_t);
-int acpi_savecpu(struct xpcb *);
+int acpi_restorecpu(struct pcb *, vm_offset_t);
static void *acpi_alloc_wakeup_handler(void);
static void acpi_stop_beep(void *);
@@ -105,10 +104,10 @@ acpi_wakeup_ap(struct acpi_softc *sc, int cpu)
int apic_id = cpu_apic_ids[cpu];
int ms;
- WAKECODE_FIXUP(wakeup_xpcb, struct xpcb *, stopxpcbs[cpu]);
- WAKECODE_FIXUP(wakeup_gdt, uint16_t, stopxpcbs[cpu]->xpcb_gdt.rd_limit);
+ WAKECODE_FIXUP(wakeup_pcb, struct pcb *, susppcbs[cpu]);
+ WAKECODE_FIXUP(wakeup_gdt, uint16_t, susppcbs[cpu]->pcb_gdt.rd_limit);
WAKECODE_FIXUP(wakeup_gdt + 2, uint64_t,
- stopxpcbs[cpu]->xpcb_gdt.rd_base);
+ susppcbs[cpu]->pcb_gdt.rd_base);
WAKECODE_FIXUP(wakeup_cpu, int, cpu);
/* do an INIT IPI: assert RESET */
@@ -245,7 +244,7 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
cr3 = rcr3();
load_cr3(KPML4phys);
- if (acpi_savecpu(stopxpcbs[0])) {
+ if (savectx(susppcbs[0])) {
#ifdef SMP
if (wakeup_cpus != 0 && suspend_cpus(wakeup_cpus) == 0) {
device_printf(sc->acpi_dev,
@@ -258,11 +257,11 @@ acpi_sleep_machdep(struct acpi_softc *sc, int state)
WAKECODE_FIXUP(resume_beep, uint8_t, (acpi_resume_beep != 0));
WAKECODE_FIXUP(reset_video, uint8_t, (acpi_reset_video != 0));
- WAKECODE_FIXUP(wakeup_xpcb, struct xpcb *, stopxpcbs[0]);
+ WAKECODE_FIXUP(wakeup_pcb, struct pcb *, susppcbs[0]);
WAKECODE_FIXUP(wakeup_gdt, uint16_t,
- stopxpcbs[0]->xpcb_gdt.rd_limit);
+ susppcbs[0]->pcb_gdt.rd_limit);
WAKECODE_FIXUP(wakeup_gdt + 2, uint64_t,
- stopxpcbs[0]->xpcb_gdt.rd_base);
+ susppcbs[0]->pcb_gdt.rd_base);
WAKECODE_FIXUP(wakeup_cpu, int, 0);
/* Call ACPICA to enter the desired sleep state */
@@ -332,9 +331,9 @@ acpi_alloc_wakeup_handler(void)
printf("%s: can't alloc wake memory\n", __func__);
return (NULL);
}
- stopxpcbs = malloc(mp_ncpus * sizeof(*stopxpcbs), M_DEVBUF, M_WAITOK);
+ susppcbs = malloc(mp_ncpus * sizeof(*susppcbs), M_DEVBUF, M_WAITOK);
for (i = 0; i < mp_ncpus; i++)
- stopxpcbs[i] = malloc(sizeof(**stopxpcbs), M_DEVBUF, M_WAITOK);
+ susppcbs[i] = malloc(sizeof(**susppcbs), M_DEVBUF, M_WAITOK);
return (wakeaddr);
}
OpenPOWER on IntegriCloud