All of lore.kernel.org
 help / color / mirror / Atom feed
From: Marco Gerards <mgerards@xs4all.nl>
To: The development of GRUB 2 <grub-devel@gnu.org>
Subject: Re: [PATCH] Fix infinite loop in grub_pit_wait()
Date: Thu, 07 Aug 2008 18:26:34 +0200	[thread overview]
Message-ID: <87hc9wssed.fsf@xs4all.nl> (raw)
In-Reply-To: <489B159A.2000106@t-online.de> (Christian Franke's message of "Thu, 07 Aug 2008 17:32:42 +0200")

Christian Franke <Christian.Franke@t-online.de> writes:

> grub2 from current SVN hangs if run in VirtualPC, the problem was
> introduced with 'svn diff -r 1779:1780'.
>
> Here is a proposed fix.
>
> Christian
>
> 2008-08-07  Christian Franke  <franke@computer.org>
>
> 	* kern/i386/pit.c (TIMER2_SPEAKER): New define.
> 	(TIMER2_GATE): Likewise.
> 	(grub_pit_wait): Add enable/disable of the timer2 gate
> 	bit of port 0x61. This fixes a possible infinite loop.

Small nitpick: use a double space

> diff --git a/kern/i386/pit.c b/kern/i386/pit.c
> index d0a6eda..a3fab26 100644
> --- a/kern/i386/pit.c
> +++ b/kern/i386/pit.c
> @@ -28,13 +28,26 @@
>  #define TIMER_ENABLE_LSB	0x20
>  #define TIMER_ENABLE_MSB	0x10
>  #define TIMER2_LATCH		0x20
> +#define TIMER2_SPEAKER		0x02
> +#define TIMER2_GATE		0x01
>  
>  void
>  grub_pit_wait (grub_uint16_t tics)
>  {
> +  /* Disable timer2 gate and speaker.  */
> +  grub_outb (grub_inb (TIMER2_REG_LATCH) & ~ (TIMER2_SPEAKER | TIMER2_GATE), TIMER2_REG_LATCH);
> +
> +  /* Set tics.  */
>    grub_outb (TIMER2_SELECT | TIMER_ENABLE_LSB | TIMER_ENABLE_MSB, TIMER_REG_COMMAND);
>    grub_outb (tics & 0xff, TIMER2_REG_CONTROL);
>    grub_outb (tics >> 8, TIMER2_REG_CONTROL);
>  
> +  /* Enable timer2 gate, keep speaker disabled.  */
> +  grub_outb ((grub_inb (TIMER2_REG_LATCH) & ~ TIMER2_SPEAKER) | TIMER2_GATE, TIMER2_REG_LATCH);
> +
> +  /* Wait.  */
>    while ((grub_inb (TIMER2_REG_LATCH) & TIMER2_LATCH) == 0x00);
> +
> +  /* Disable timer2 gate and speaker.  */
> +  grub_outb (grub_inb (TIMER2_REG_LATCH) & ~ (TIMER2_SPEAKER | TIMER2_GATE), TIMER2_REG_LATCH);
These lines are too long, please break them properly.



--
Marco




  parent reply	other threads:[~2008-08-07 16:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-08-07 15:32 [PATCH] Fix infinite loop in grub_pit_wait() Christian Franke
2008-08-07 16:10 ` Robert Millan
2008-08-07 19:44   ` Christian Franke
2008-08-07 16:26 ` Marco Gerards [this message]
2008-08-07 19:46   ` Christian Franke

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=87hc9wssed.fsf@xs4all.nl \
    --to=mgerards@xs4all.nl \
    --cc=grub-devel@gnu.org \
    /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.