From: "H. Peter Anvin" <hpa@zytor.com>
To: Pavel Machek <pavel@ucw.cz>
Cc: kernel list <linux-kernel@vger.kernel.org>,
Linux-pm mailing list <linux-pm@lists.osdl.org>,
"Rafael J. Wysocki" <rjw@sisk.pl>
Subject: Re: factor out common s2ram wakeup code
Date: Fri, 25 Jan 2008 15:36:09 -0800 [thread overview]
Message-ID: <479A7269.1060007@zytor.com> (raw)
In-Reply-To: <20080125231215.GA2146@elf.ucw.cz>
Pavel Machek wrote:
> diff --git a/arch/x86/kernel/acpi/rm/wakemain.c b/arch/x86/kernel/acpi/rm/wakemain.c
> new file mode 100644
> index 0000000..d3173cc
> --- /dev/null
> +++ b/arch/x86/kernel/acpi/rm/wakemain.c
> @@ -0,0 +1,18 @@
> +#include "wakeup.h"
> +#include "boot.h"
> +
> +extern struct wakeup_header wakeup_header;
> +
> +void main(void)
> +{
> + asm volatile("lcallw $0xc000,$3; movw %cs, %ax; movw %ax, %ds; movw %ax, %es; movw %ax, %ss");
> +
> +// asm volatile("inb $97, %al; outb %al, $0x80; movb $3, %al; outb %al, $97; outb %al, $0x80; movb $-74, %al; outb %al, $67; outb %al, $0x80; movb $-119, %al; outb %al, $66; outb %al, $0x80; movb $15, %al; outb %al, $66");
> +
> + /* Need to call BIOS */
> + probe_cards(0);
> +// set_mode(wakeup_header.video_mode);
> + set_mode(6);
> +
> + /* Set up GDT and IDT here, possibly CR4 and EFER */
> +}
Surely this needs some cleaning up? ;)
> diff --git a/arch/x86/kernel/acpi/rm/wakeup.S b/arch/x86/kernel/acpi/rm/wakeup.S
> new file mode 100644
> index 0000000..bfa348c
> --- /dev/null
> +++ b/arch/x86/kernel/acpi/rm/wakeup.S
> @@ -0,0 +1,129 @@
> +/*
> + * ACPI wakeup real mode startup stub
> + */
> +#include <asm/segment.h>
> +#include <asm/msr-index.h>
> +
> +
> +#define BEEP \
> + inb $97, %al; \
> + outb %al, $0x80; \
> + movb $3, %al; \
> + outb %al, $97; \
> + outb %al, $0x80; \
> + movb $-74, %al; \
> + outb %al, $67; \
> + outb %al, $0x80; \
> + movb $-119, %al; \
> + outb %al, $66; \
> + outb %al, $0x80; \
> + movb $15, %al; \
> + outb %al, $66;
> +
BEEP isn't actually used here and should probably be a C function if
needed. Note: in real mode you can also produce a beep by calling
int $0x10 with %ax = 0x0e07. Please note that some int $0x10
implementations clobber certain registers... see the INT10 macro in the
bootup code.
Seriously cool, though, that you're getting this far.
-hpa
next prev parent reply other threads:[~2008-01-25 23:36 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-22 19:37 factor out common s2ram wakeup code Pavel Machek
2008-01-22 20:27 ` H. Peter Anvin
[not found] ` <20080122205625.GC4317@elf.ucw.cz>
[not found] ` <47965B13.9080705@zytor.com>
2008-01-22 21:24 ` Pavel Machek
2008-01-22 21:51 ` H. Peter Anvin
2008-01-22 22:03 ` Pavel Machek
2008-01-22 22:09 ` H. Peter Anvin
[not found] ` <47969BB2.2020409@zytor.com>
2008-01-25 23:12 ` Pavel Machek
2008-01-25 23:36 ` H. Peter Anvin [this message]
2008-01-24 0:20 ` Rafael J. Wysocki
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=479A7269.1060007@zytor.com \
--to=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.osdl.org \
--cc=pavel@ucw.cz \
--cc=rjw@sisk.pl \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.