From: Pavel Machek <pavel@ucw.cz>
To: "H. Peter Anvin" <hpa@zytor.com>
Cc: "Rafael J. Wysocki" <rjw@sisk.pl>,
kernel list <linux-kernel@vger.kernel.org>,
Linux-pm mailing list <linux-pm@lists.osdl.org>
Subject: Re: [rft] s2ram wakeup moves to .c, could fix few machines
Date: Thu, 7 Feb 2008 23:51:21 +0100 [thread overview]
Message-ID: <20080207225121.GE6096@elf.ucw.cz> (raw)
In-Reply-To: <47AB8A41.3040008@zytor.com>
On Thu 2008-02-07 14:46:25, H. Peter Anvin wrote:
> Pavel Machek wrote:
>>
>> This is probably more acceptable version of beep; but there are
>> probably even better ways to clean it...
>>
>> if (wakeup_header.realmode_flags & 4) {
>> inb(97);
>> outb(0, 0x80);
>> outb(3, 97);
>> outb(0, 0x80);
>> outb(-74, 67);
>> outb(0, 0x80);
>> outb(-119, 66);
>> outb(0, 0x80);
>> outb(15, 66);
>> }
>>
>
> What is available at this point -- are BIOS calls still accessible; are
> interrupts running?
No interrupts. BIOS calls work on some machines, but I'd like this to
work when bios does not.
Actually, matthieu's code is probably better to start from:
+/* one ISA cycle @8Mhz */
+#define PAUSE outb %al, $0x80
+#define WAIT_100MS \
+ movl $800000, %eax; \
+ 2: \
+ PAUSE; \
+ dec %eax; \
+ jne 2b
+
+/* What's the PIT rate */
+#define COUNT 0xf89
#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;
+ /* enable counter 2 */ \
+ inb $0x61, %al; \
+ PAUSE; \
+ orb $3, %al; \
+ outb %al, $0x61; \
+ PAUSE; \
+ /* set command for counter 2, 2 byte write */ \
+ movb $0xB6, %al; \
+ outb %al, $0x43; \
+ PAUSE; \
+ /* select desired HZ */ \
+ movb $(COUNT & 0xff), %al; \
+ outb %al, $0x42; \
+ PAUSE; \
+ movb $(COUNT >> 8), %al; \
+ outb %al, $0x42; \
+ WAIT_100MS; \
+ /* disable counter 2 */ \
+ inb $0x61, %al; \
+ PAUSE; \
+ andb $0xFC, %al; \
+ outb %al, $0x61; \
+ WAIT_100MS
+
+#define CBEEP \
+ testl $4, realmode_flags - wakeup_code; \
+ jz 1f; \
+ BEEP; \
+1:
...because it allows user to compute number of beeps.
Pavel
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
next prev parent reply other threads:[~2008-02-07 22:51 UTC|newest]
Thread overview: 62+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-02-05 19:06 [rft] s2ram wakeup moves to .c, could fix few machines Pavel Machek
2008-02-06 1:27 ` Rafael J. Wysocki
2008-02-06 1:36 ` H. Peter Anvin
2008-02-06 1:42 ` Rafael J. Wysocki
2008-02-06 1:51 ` H. Peter Anvin
2008-02-06 1:56 ` Rafael J. Wysocki
2008-02-06 11:29 ` Pavel Machek
2008-02-14 2:54 ` Bill Davidsen
2008-02-06 23:48 ` Rafael J. Wysocki
2008-02-07 22:12 ` Rafael J. Wysocki
2008-02-07 22:28 ` Sam Ravnborg
2008-02-07 22:34 ` H. Peter Anvin
2008-02-08 21:31 ` Pavel Machek
2008-02-08 21:34 ` Pavel Machek
2008-02-08 21:41 ` Pavel Machek
2008-02-08 21:47 ` Sam Ravnborg
2008-02-08 21:49 ` Pavel Machek
2008-02-07 22:28 ` Pavel Machek
2008-02-07 22:40 ` Rafael J. Wysocki
2008-02-07 22:44 ` H. Peter Anvin
2008-02-07 22:53 ` Rafael J. Wysocki
2008-02-07 22:45 ` H. Peter Anvin
2008-02-07 22:49 ` Pavel Machek
2008-02-08 21:13 ` Pavel Machek
2008-02-08 21:41 ` Maxim Levitsky
2008-02-08 21:51 ` Pavel Machek
2008-02-07 22:46 ` H. Peter Anvin
2008-02-07 22:51 ` Pavel Machek [this message]
2008-02-07 23:09 ` Rafael J. Wysocki
2008-02-07 22:57 ` Rafael J. Wysocki
2008-02-07 23:14 ` H. Peter Anvin
2008-02-08 21:35 ` Pavel Machek
2008-02-07 22:38 ` H. Peter Anvin
2008-02-07 23:06 ` Rafael J. Wysocki
2008-02-07 23:13 ` H. Peter Anvin
2008-02-07 23:35 ` Pavel Machek
2008-02-07 23:36 ` Rafael J. Wysocki
2008-02-07 23:41 ` Pavel Machek
2008-02-07 23:42 ` H. Peter Anvin
2008-02-08 7:04 ` Pavel Machek
2008-02-08 7:40 ` H. Peter Anvin
2008-02-08 16:23 ` Rafael J. Wysocki
2008-02-08 21:00 ` Pavel Machek
2008-02-08 21:02 ` H. Peter Anvin
2008-02-08 21:09 ` Pavel Machek
2008-02-08 21:18 ` H. Peter Anvin
2008-02-08 21:20 ` [linux-pm] " Alan Stern
2008-02-08 21:23 ` Pavel Machek
2008-02-08 21:27 ` H. Peter Anvin
2008-02-08 21:31 ` Pavel Machek
2008-02-08 21:56 ` Rafael J. Wysocki
2008-02-08 21:59 ` Pavel Machek
2008-02-08 21:56 ` Pavel Machek
2008-02-08 21:58 ` Pavel Machek
2008-02-08 22:01 ` Rafael J. Wysocki
2008-02-08 22:08 ` Pavel Machek
2008-02-09 0:18 ` Rafael J. Wysocki
2008-02-09 0:32 ` H. Peter Anvin
2008-02-09 13:48 ` Rafael J. Wysocki
2008-02-10 21:14 ` Pavel Machek
2008-02-10 21:21 ` Sam Ravnborg
2008-02-06 23:37 ` 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=20080207225121.GE6096@elf.ucw.cz \
--to=pavel@ucw.cz \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@lists.osdl.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox