svn commit: r197863 - head/sys/amd64/acpica
Attilio Rao
attilio at freebsd.org
Thu Oct 8 18:22:57 UTC 2009
2009/10/8 Jung-uk Kim <jkim at freebsd.org>:
> Author: jkim
> Date: Thu Oct 8 17:41:53 2009
> New Revision: 197863
> URL: http://svn.freebsd.org/changeset/base/197863
>
> Log:
> Clean up amd64 suspend/resume code.
> @@ -322,49 +316,50 @@ out:
> return (ret);
> }
>
> -static vm_offset_t acpi_wakeaddr;
> -
> -static void
> +static void *
> acpi_alloc_wakeup_handler(void)
> {
> void *wakeaddr;
>
> - if (!cold)
> - return;
> -
> /*
> * Specify the region for our wakeup code. We want it in the low 1 MB
> - * region, excluding video memory and above (0xa0000). We ask for
> - * it to be page-aligned, just to be safe.
> + * region, excluding real mode IVT (0-0x3ff), BDA (0x400-0x4ff), EBDA
> + * (less than 128KB, below 0xa0000, must be excluded by SMAP and DSDT),
> + * and ROM area (0xa0000 and above). The temporary page tables must be
> + * page-aligned.
> */
> - wakeaddr = contigmalloc(4 * PAGE_SIZE, M_DEVBUF, M_NOWAIT, 0, 0x9ffff,
> - PAGE_SIZE, 0ul);
> + wakeaddr = contigmalloc(4 * PAGE_SIZE, M_DEVBUF, M_NOWAIT, 0x500,
> + 0xa0000, PAGE_SIZE, 0ul);
> if (wakeaddr == NULL) {
> printf("%s: can't alloc wake memory\n", __func__);
> - return;
> + return (NULL);
> }
> stopxpcbs = malloc(mp_ncpus * sizeof(*stopxpcbs), M_DEVBUF, M_NOWAIT);
> if (stopxpcbs == NULL) {
> contigfree(wakeaddr, 4 * PAGE_SIZE, M_DEVBUF);
> printf("%s: can't alloc CPU state memory\n", __func__);
> - return;
> + return (NULL);
> }
> - acpi_wakeaddr = (vm_offset_t)wakeaddr;
> -}
>
> -SYSINIT(acpiwakeup, SI_SUB_KMEM, SI_ORDER_ANY, acpi_alloc_wakeup_handler, 0);
> + return (wakeaddr);
> +}
>
> void
> acpi_install_wakeup_handler(struct acpi_softc *sc)
> {
> + static void *wakeaddr = NULL;
> uint64_t *pt4, *pt3, *pt2;
> int i;
Maybe it was better to have a non-reentrat function here?
Attilio
--
Peace can only be achieved by understanding - A. Einstein
More information about the svn-src-head
mailing list