source: grub-pc/trunk/fuentes/grub-core/kern/arm/efi/init.c @ 22

Last change on this file since 22 was 22, checked in by mabarracus, 4 years ago

updated version and apply net.ifnames=0 into debian/rules

File size: 1.9 KB
Line 
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
28static grub_uint64_t tmr;
29static grub_efi_event_t tmr_evt;
30
31static grub_uint64_t
32grub_efi_get_time_ms (void)
33{
34  return tmr;
35}
36
37static void 
38increment_timer (grub_efi_event_t event __attribute__ ((unused)),
39                 void *context __attribute__ ((unused)))
40{
41  tmr++;
42}
43
44void
45grub_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
60void
61grub_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}
Note: See TracBrowser for help on using the repository browser.