[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 7/7] Add support for ARM UEFI ("EFI") platforms
From: |
Vladimir 'φ-coder/phcoder' Serbinenko |
Subject: |
Re: [PATCH 7/7] Add support for ARM UEFI ("EFI") platforms |
Date: |
Mon, 01 Apr 2013 04:31:13 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:10.0.12) Gecko/20130116 Icedove/10.0.12 |
> +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
signature.asc
Description: OpenPGP digital signature