From owner-svn-src-all@FreeBSD.ORG Thu Apr 2 00:23:57 2009 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 07FD510656F9; Thu, 2 Apr 2009 00:23:57 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id DFD018FC16; Thu, 2 Apr 2009 00:23:56 +0000 (UTC) (envelope-from jkim@FreeBSD.org) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.3/8.14.3) with ESMTP id n320Nudt046565; Thu, 2 Apr 2009 00:23:56 GMT (envelope-from jkim@svn.freebsd.org) Received: (from jkim@localhost) by svn.freebsd.org (8.14.3/8.14.3/Submit) id n320Nu0u046562; Thu, 2 Apr 2009 00:23:56 GMT (envelope-from jkim@svn.freebsd.org) Message-Id: <200904020023.n320Nu0u046562@svn.freebsd.org> From: Jung-uk Kim Date: Thu, 2 Apr 2009 00:23:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r190635 - head/sys/amd64/acpica X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 02 Apr 2009 00:23:57 -0000 Author: jkim Date: Thu Apr 2 00:23:56 2009 New Revision: 190635 URL: http://svn.freebsd.org/changeset/base/190635 Log: Chase GDT layout changes and unbreak suspend/resume on amd64. Modified: head/sys/amd64/acpica/acpi_switch.S head/sys/amd64/acpica/acpi_wakecode.S head/sys/amd64/acpica/acpi_wakeup.c Modified: head/sys/amd64/acpica/acpi_switch.S ============================================================================== --- head/sys/amd64/acpica/acpi_switch.S Wed Apr 1 21:14:01 2009 (r190634) +++ head/sys/amd64/acpica/acpi_switch.S Thu Apr 2 00:23:56 2009 (r190635) @@ -128,9 +128,19 @@ ENTRY(acpi_restorecpu) /* Restore descriptor tables. */ lidt WAKEUP_XPCB(IDT) lldt WAKEUP_XPCB(LDT) + +#define SDT_SYSTSS 9 +#define SDT_SYSBSY 11 + + /* Reset task busy bit and reload TR. */ + movq PCPU(TSS), %rax + andb $(~SDT_SYSBSY | SDT_SYSTSS), 5(%rax) movw WAKEUP_XPCB(TR), %ax ltr %ax +#undef SDT_SYSTSS +#undef SDT_SYSBSY + /* Restore other callee saved registers. */ movq WAKEUP_PCB(R15), %r15 movq WAKEUP_PCB(R14), %r14 Modified: head/sys/amd64/acpica/acpi_wakecode.S ============================================================================== --- head/sys/amd64/acpica/acpi_wakecode.S Wed Apr 1 21:14:01 2009 (r190634) +++ head/sys/amd64/acpica/acpi_wakecode.S Thu Apr 2 00:23:56 2009 (r190635) @@ -223,6 +223,12 @@ reset_video: bootgdt: .long 0x00000000 .long 0x00000000 + .long 0x00000000 + .long 0x00000000 + .long 0x00000000 + .long 0x00000000 + .long 0x00000000 + .long 0x00000000 bootcode64: .long 0x0000ffff @@ -261,6 +267,8 @@ wakeup_xpcb: wakeup_gdt: .word 0 .quad 0 + + ALIGN_DATA wakeup_efer: .quad 0 wakeup_pat: Modified: head/sys/amd64/acpica/acpi_wakeup.c ============================================================================== --- head/sys/amd64/acpica/acpi_wakeup.c Wed Apr 1 21:14:01 2009 (r190634) +++ head/sys/amd64/acpica/acpi_wakeup.c Thu Apr 2 00:23:56 2009 (r190635) @@ -78,7 +78,6 @@ static struct xpcb *stopxpcbs; int acpi_restorecpu(struct xpcb *, vm_offset_t); int acpi_savecpu(struct xpcb *); -static void acpi_reset_tss(int cpu); static void acpi_alloc_wakeup_handler(void); static void acpi_stop_beep(void *); @@ -116,8 +115,6 @@ acpi_wakeup_ap(struct acpi_softc *sc, in stopxpcbs[cpu].xpcb_gdt.rd_base); WAKECODE_FIXUP(wakeup_cpu, int, cpu); - acpi_reset_tss(cpu); - /* do an INIT IPI: assert RESET */ lapic_ipi_raw(APIC_DEST_DESTFLD | APIC_TRIGMOD_EDGE | APIC_LEVEL_ASSERT | APIC_DESTMODE_PHY | APIC_DELMODE_INIT, apic_id); @@ -220,19 +217,6 @@ acpi_wakeup_cpus(struct acpi_softc *sc, } #endif -static void -acpi_reset_tss(int cpu) -{ - uint32_t *tss; - - /* - * We have to clear "task busy" bit in TSS to restore - * task register later. Otherwise, ltr causes GPF. - */ - tss = (uint32_t *)&gdt[NGDT * cpu + GPROC0_SEL] + 1; - *tss &= ~((SDT_SYSBSY ^ SDT_SYSTSS) << 8); -} - int acpi_sleep_machdep(struct acpi_softc *sc, int state) { @@ -289,8 +273,6 @@ acpi_sleep_machdep(struct acpi_softc *sc stopxpcbs[0].xpcb_gdt.rd_base); WAKECODE_FIXUP(wakeup_cpu, int, 0); - acpi_reset_tss(0); - /* Call ACPICA to enter the desired sleep state */ if (state == ACPI_STATE_S4 && sc->acpi_s4bios) status = AcpiEnterSleepStateS4bios();