Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 8 Oct 2009 20:22:54 +0200
From:      Attilio Rao <attilio@freebsd.org>
To:        Jung-uk Kim <jkim@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, src-committers@freebsd.org
Subject:   Re: svn commit: r197863 - head/sys/amd64/acpica
Message-ID:  <3bbf2fe10910081122t2e23d1cep44846da4a7035227@mail.gmail.com>
In-Reply-To: <200910081741.n98HfrI3028811@svn.freebsd.org>
References:  <200910081741.n98HfrI3028811@svn.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
2009/10/8 Jung-uk Kim <jkim@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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?3bbf2fe10910081122t2e23d1cep44846da4a7035227>