~ubuntu-branches/ubuntu/trusty/grub2/trusty

« back to all changes in this revision

Viewing changes to grub-core/kern/arm/efi/init.c

  • Committer: Package Import Robot
  • Author(s): Colin Watson
  • Date: 2014-01-16 15:18:04 UTC
  • mfrom: (17.6.38 experimental)
  • Revision ID: package-import@ubuntu.com-20140116151804-3foouk7fpqcq3sxx
Tags: 2.02~beta2-2
* Convert patch handling to git-dpm.
* Add bi-endian support to ELF parser (Tomohiro B Berry).
* Adjust restore_mkdevicemap.patch to mark get_kfreebsd_version as static,
  to appease "gcc -Werror=missing-prototypes".
* Cherry-pick from upstream:
  - Change grub-macbless' manual page section to 8.
* Install grub-glue-efi, grub-macbless, grub-render-label, and
  grub-syslinux2cfg.
* grub-shell: Pass -no-pad to xorriso when building floppy images.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/* init.c - initialize an arm-based EFI system */
 
2
/*
 
3
 *  GRUB  --  GRand Unified Bootloader
 
4
 *  Copyright (C) 2013 Free Software Foundation, Inc.
 
5
 *
 
6
 *  GRUB is free software: you can redistribute it and/or modify
 
7
 *  it under the terms of the GNU General Public License as published by
 
8
 *  the Free Software Foundation, either version 3 of the License, or
 
9
 *  (at your option) any later version.
 
10
 *
 
11
 *  GRUB is distributed in the hope that it will be useful,
 
12
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
 *  GNU General Public License for more details.
 
15
 *
 
16
 *  You should have received a copy of the GNU General Public License
 
17
 *  along with GRUB.  If not, see <http://www.gnu.org/licenses/>.
 
18
 */
 
19
 
 
20
#include <grub/env.h>
 
21
#include <grub/kernel.h>
 
22
#include <grub/misc.h>
 
23
#include <grub/mm.h>
 
24
#include <grub/time.h>
 
25
#include <grub/efi/efi.h>
 
26
#include <grub/loader.h>
 
27
 
 
28
static grub_uint64_t tmr;
 
29
static grub_efi_event_t tmr_evt;
 
30
 
 
31
static grub_uint64_t
 
32
grub_efi_get_time_ms (void)
 
33
{
 
34
  return tmr;
 
35
}
 
36
 
 
37
static void 
 
38
increment_timer (grub_efi_event_t event __attribute__ ((unused)),
 
39
                 void *context __attribute__ ((unused)))
 
40
{
 
41
  tmr++;
 
42
}
 
43
 
 
44
void
 
45
grub_machine_init (void)
 
46
{
 
47
  grub_efi_boot_services_t *b;
 
48
 
 
49
  grub_efi_init ();
 
50
 
 
51
  b = grub_efi_system_table->boot_services;
 
52
 
 
53
  efi_call_5 (b->create_event, GRUB_EFI_EVT_TIMER | GRUB_EFI_EVT_NOTIFY_SIGNAL,
 
54
              GRUB_EFI_TPL_CALLBACK, increment_timer, NULL, &tmr_evt);
 
55
  efi_call_3 (b->set_timer, tmr_evt, GRUB_EFI_TIMER_PERIODIC, 10000);
 
56
 
 
57
  grub_install_get_time_ms (grub_efi_get_time_ms);
 
58
}
 
59
 
 
60
void
 
61
grub_machine_fini (int flags)
 
62
{
 
63
  grub_efi_boot_services_t *b;
 
64
 
 
65
  if (!(flags & GRUB_LOADER_FLAG_NORETURN))
 
66
    return;
 
67
 
 
68
  b = grub_efi_system_table->boot_services;
 
69
 
 
70
  efi_call_3 (b->set_timer, tmr_evt, GRUB_EFI_TIMER_PERIODIC, 0);
 
71
  efi_call_1 (b->close_event, tmr_evt);
 
72
 
 
73
  grub_efi_fini ();
 
74
}