grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: "Vladimir 'φ-coder/phcoder' Serbinenko" <phcoder@gmail.com>
To: The development of GNU GRUB <grub-devel@gnu.org>
Subject: Re: [PATCH 7/7] Add support for ARM UEFI ("EFI") platforms
Date: Mon, 01 Apr 2013 04:31:13 +0200	[thread overview]
Message-ID: <5158F171.6030702@gmail.com> (raw)
In-Reply-To: <CAF7UmSwNhDDbgthWQJF-jVJhPp_Fjy8C7sD7UhFoih79PHjS6g@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 1297 bytes --]

> +static grub_uint64_t

> +grub_efi_get_time_ms(void)
> +{
> +  grub_efi_time_t now;
> +  grub_uint64_t retval;
> +  grub_efi_status_t status;
> +
> +  status = efi_call_2 (grub_efi_system_table->runtime_services->get_time,
> +		       &now, NULL);
> +  if (status != GRUB_EFI_SUCCESS)
> +    {
> +      grub_printf("No time!\n");
> +      return 0;

This is about the worse thing you can do. It will make any timeout go wrong.

> +    }
> +  retval = now.year * 365 * 24 * 60 * 60 * 1000;
> +  retval += now.month * 30 * 24 * 60 * 60 * 1000;
> +  retval += now.day * 24 * 60 * 60 * 1000;
> +  retval += now.hour * 60 * 60 * 1000;
> +  retval += now.minute * 60 * 1000;
> +  retval += now.second * 1000;
> +  retval += now.nanosecond / 1000;
> + 
> +  grub_dprintf("timer", "timestamp: 0x%llx\n", retval);
> +
> +  return retval;

This is almost a verbatim copy of what we had for i386 efi before but it
went haywire in many ways. Like jumps forward or backward around end of
month or when one sets datetime. Or around the summer/winter timezone
transition.
Does ARM have anything like TSC?

> +static inline grub_size_t
> +page_align (grub_size_t size)
> +{
> +  return (size + (1 << 12) - 1) & (~((1 << 12) - 1));
> +}

We already have ALIGN_UP




[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 294 bytes --]

  reply	other threads:[~2013-04-01  2:31 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-03-24 17:01 [PATCH 7/7] Add support for ARM UEFI ("EFI") platforms Leif Lindholm
2013-04-01  2:31 ` Vladimir 'φ-coder/phcoder' Serbinenko [this message]
2013-04-01 10:41   ` Francesco Lavra
2013-04-01 11:23     ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-04-01 14:10       ` Francesco Lavra
2013-04-01 14:16         ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-04-01 14:49           ` Francesco Lavra
2013-04-03 17:50   ` Leif Lindholm
2013-04-01 16:24 ` Francesco Lavra
2013-04-03 18:07   ` Leif Lindholm
2013-04-03 20:01     ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-04-04 12:54       ` Leif Lindholm
2013-04-09 17:30         ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-05-09 18:08           ` Leif Lindholm
2013-05-11  8:42             ` Vladimir 'φ-coder/phcoder' Serbinenko
2013-05-11 18:00             ` Francesco Lavra

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=5158F171.6030702@gmail.com \
    --to=phcoder@gmail.com \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).