2006-04-19 Yoshinori K. Okuji <okuji@enbug.org>
* DISTLIST: Added include/grub/efi/console.h, include/grub/efi/time.h, include/grub/i386/efi/kernel.h, kern/efi/init.c, kern/efi/mm.c, and term/efi/console.c. * include/grub/efi/console.h: New file. * include/grub/efi/time.h: Likewise. * include/grub/i386/efi/kernel.h: Likewise. * kern/efi/init.c: Likewise. * kern/efi/mm.c: Likewise. * term/efi/console.c: Likewise. * kern/i386/efi/init.c: Do not include grub/machine/time.h. (grub_stop): Removed. (grub_get_rtc): Likewise. (grub_machine_init): Simply call grub_efi_init. (grub_machine_fini): Call grub_efi_fini. * kern/efi/efi.c: Include grub/machine/time.h and grub/term.h. (grub_efi_output_string): Removed. (grub_efi_stall): New function. (grub_stop): Likewise. (grub_get_rtc): Likewise. * include/grub/efi/efi.h (grub_efi_output_string): Removed. (grub_efi_stall): New prototype. (grub_efi_allocate_pages): Likewise. (grub_efi_free_pages): Likewise. (grub_efi_get_memory_map): Likewise. (grub_efi_mm_init): Likewise. (grub_efi_mm_fini): Likewise. (grub_efi_init): Likewise. (grub_efi_fini): Likewise. * include/grub/i386/efi/time.h: Do not include grub/symbol.h. Include grub/efi/time.h. (GRUB_TICKS_PER_SECOND): Removed. (grub_get_rtc): Likewise. * include/grub/efi/api.h (struct grub_efi_memory_descriptor): Added padding. The EFI spec is buggy. (GRUB_EFI_BLACK): New macro. (GRUB_EFI_BLUE): Likewise. (GRUB_EFI_GREEN): Likewise. (GRUB_EFI_CYAN): Likewise. (GRUB_EFI_RED): Likewise. (GRUB_EFI_MAGENTA): Likewise. (GRUB_EFI_BROWN): Likewise. (GRUB_EFI_LIGHTGRAY): Likewise. (GRUB_EFI_BRIGHT): Likewise. (GRUB_EFI_DARKGRAY): Likewise. (GRUB_EFI_LIGHTBLUE): Likewise. (GRUB_EFI_LIGHTGREEN): Likewise. (GRUB_EFI_LIGHTCYAN): Likewise. (GRUB_EFI_LIGHTRED): Likewise. (GRUB_EFI_LIGHTMAGENTA): Likewise. (GRUB_EFI_YELLOW): Likewise. (GRUB_EFI_WHITE): Likewise. (GRUB_EFI_BACKGROUND_BLACK): Likewise. (GRUB_EFI_BACKGROUND_BLUE): Likewise. (GRUB_EFI_BACKGROUND_GREEN): Likewise. (GRUB_EFI_BACKGROUND_CYAN): Likewise. (GRUB_EFI_BACKGROUND_RED): Likewise. (GRUB_EFI_BACKGROUND_MAGENTA): Likewise. (GRUB_EFI_BACKGROUND_BROWN): Likewise. (GRUB_EFI_BACKGROUND_LIGHTGRAY): Likewise. (GRUB_EFI_TEXT_ATTR): Likewise. * conf/i386-efi.rmk (kernel_mod_SOURCES): Added kern/efi/efi.c, kern/efi/init.c, kern/efi/mm.c, and term/efi/console.c. (kernel_mod_HEADERS): Added efi/time.h.
This commit is contained in:
parent
e2a8c90448
commit
976a4ea036
15 changed files with 1053 additions and 52 deletions
|
@ -213,9 +213,12 @@ struct grub_efi_guid
|
|||
} __attribute__ ((aligned(8)));
|
||||
typedef struct grub_efi_guid grub_efi_guid_t;
|
||||
|
||||
/* XXX although the spec does not specify the padding, this actually
|
||||
must have the padding! */
|
||||
struct grub_efi_memory_descriptor
|
||||
{
|
||||
grub_efi_uint32_t type;
|
||||
grub_efi_uint32_t padding;
|
||||
grub_efi_physical_address_t physical_start;
|
||||
grub_efi_virtual_address_t virtual_start;
|
||||
grub_efi_uint64_t num_pages;
|
||||
|
@ -632,6 +635,35 @@ struct grub_efi_simple_text_output_interface
|
|||
};
|
||||
typedef struct grub_efi_simple_text_output_interface grub_efi_simple_text_output_interface_t;
|
||||
|
||||
#define GRUB_EFI_BLACK 0x00
|
||||
#define GRUB_EFI_BLUE 0x01
|
||||
#define GRUB_EFI_GREEN 0x02
|
||||
#define GRUB_EFI_CYAN 0x03
|
||||
#define GRUB_EFI_RED 0x04
|
||||
#define GRUB_EFI_MAGENTA 0x05
|
||||
#define GRUB_EFI_BROWN 0x06
|
||||
#define GRUB_EFI_LIGHTGRAY 0x07
|
||||
#define GRUB_EFI_BRIGHT 0x08
|
||||
#define GRUB_EFI_DARKGRAY 0x08
|
||||
#define GRUB_EFI_LIGHTBLUE 0x09
|
||||
#define GRUB_EFI_LIGHTGREEN 0x0A
|
||||
#define GRUB_EFI_LIGHTCYAN 0x0B
|
||||
#define GRUB_EFI_LIGHTRED 0x0C
|
||||
#define GRUB_EFI_LIGHTMAGENTA 0x0D
|
||||
#define GRUB_EFI_YELLOW 0x0E
|
||||
#define GRUB_EFI_WHITE 0x0F
|
||||
|
||||
#define GRUB_EFI_BACKGROUND_BLACK 0x00
|
||||
#define GRUB_EFI_BACKGROUND_BLUE 0x10
|
||||
#define GRUB_EFI_BACKGROUND_GREEN 0x20
|
||||
#define GRUB_EFI_BACKGROUND_CYAN 0x30
|
||||
#define GRUB_EFI_BACKGROUND_RED 0x40
|
||||
#define GRUB_EFI_BACKGROUND_MAGENTA 0x50
|
||||
#define GRUB_EFI_BACKGROUND_BROWN 0x60
|
||||
#define GRUB_EFI_BACKGROUND_LIGHTGRAY 0x70
|
||||
|
||||
#define GRUB_EFI_TEXT_ATTR(fg, bg) ((fg) | ((bg) << 4))
|
||||
|
||||
struct grub_efi_system_table
|
||||
{
|
||||
grub_efi_table_header_t hdr;
|
||||
|
|
45
include/grub/efi/console.h
Normal file
45
include/grub/efi/console.h
Normal file
|
@ -0,0 +1,45 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2005,2006 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_EFI_CONSOLE_HEADER
|
||||
#define GRUB_EFI_CONSOLE_HEADER 1
|
||||
|
||||
/* Define scan codes. */
|
||||
#define GRUB_CONSOLE_KEY_LEFT 0x4B00
|
||||
#define GRUB_CONSOLE_KEY_RIGHT 0x4D00
|
||||
#define GRUB_CONSOLE_KEY_UP 0x4800
|
||||
#define GRUB_CONSOLE_KEY_DOWN 0x5000
|
||||
#define GRUB_CONSOLE_KEY_IC 0x5200
|
||||
#define GRUB_CONSOLE_KEY_DC 0x5300
|
||||
#define GRUB_CONSOLE_KEY_BACKSPACE 0x0008
|
||||
#define GRUB_CONSOLE_KEY_HOME 0x4700
|
||||
#define GRUB_CONSOLE_KEY_END 0x4F00
|
||||
#define GRUB_CONSOLE_KEY_NPAGE 0x4900
|
||||
#define GRUB_CONSOLE_KEY_PPAGE 0x5100
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/symbol.h>
|
||||
|
||||
/* Initialize the console system. */
|
||||
void grub_console_init (void);
|
||||
|
||||
/* Finish the console system. */
|
||||
void grub_console_fini (void);
|
||||
|
||||
#endif /* ! GRUB_EFI_CONSOLE_HEADER */
|
|
@ -30,7 +30,21 @@ void *EXPORT_FUNC(grub_efi_locate_protocol) (grub_efi_guid_t *protocol,
|
|||
void *registration);
|
||||
int EXPORT_FUNC(grub_efi_set_text_mode) (int on);
|
||||
void EXPORT_FUNC(grub_efi_exit) (void) __attribute__((noreturn));
|
||||
int EXPORT_FUNC(grub_efi_output_string) (const char *str);
|
||||
void EXPORT_FUNC(grub_efi_stall) (grub_efi_uintn_t microseconds);
|
||||
void *EXPORT_FUNC(grub_efi_allocate_pages) (grub_efi_physical_address_t address,
|
||||
grub_efi_uintn_t pages);
|
||||
void EXPORT_FUNC(grub_efi_free_pages) (grub_efi_physical_address_t address,
|
||||
grub_efi_uintn_t pages);
|
||||
int EXPORT_FUNC(grub_efi_get_memory_map) (grub_efi_uintn_t *memory_map_size,
|
||||
grub_efi_memory_descriptor_t *memory_map,
|
||||
grub_efi_uintn_t *map_key,
|
||||
grub_efi_uintn_t *descriptor_size,
|
||||
grub_efi_uint32_t *descriptor_version);
|
||||
|
||||
void grub_efi_mm_init (void);
|
||||
void grub_efi_mm_fini (void);
|
||||
void grub_efi_init (void);
|
||||
void grub_efi_fini (void);
|
||||
|
||||
/* Variables. */
|
||||
extern grub_efi_system_table_t *EXPORT_VAR(grub_efi_system_table);
|
||||
|
|
32
include/grub/efi/time.h
Normal file
32
include/grub/efi/time.h
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2006 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||||
* MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_EFI_TIME_HEADER
|
||||
#define GRUB_EFI_TIME_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
|
||||
/* This is destined to overflow when one minute passes by. */
|
||||
#define GRUB_TICKS_PER_SECOND ((1UL << 31) / 60 / 60 * 2)
|
||||
|
||||
/* Return the real time in ticks. */
|
||||
grub_uint32_t EXPORT_FUNC (grub_get_rtc) (void);
|
||||
|
||||
#endif /* ! GRUB_EFI_TIME_HEADER */
|
28
include/grub/i386/efi/kernel.h
Normal file
28
include/grub/i386/efi/kernel.h
Normal file
|
@ -0,0 +1,28 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2002,2003 Free Software Foundation, Inc.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*/
|
||||
|
||||
#ifndef GRUB_MACHINE_KERNEL_HEADER
|
||||
#define GRUB_MACHINE_KERNEL_HEADER 1
|
||||
|
||||
/* The prefix which points to the directory where GRUB modules and its
|
||||
configuration file are located. */
|
||||
extern char grub_prefix[];
|
||||
|
||||
#endif /* ! GRUB_MACHINE_KERNEL_HEADER */
|
||||
|
|
@ -18,14 +18,9 @@
|
|||
* MA 02110-1301, USA.
|
||||
*/
|
||||
|
||||
#ifndef KERNEL_TIME_HEADER
|
||||
#define KERNEL_TIME_HEADER 1
|
||||
#ifndef GRUB_MACHINE_TIME_HEADER
|
||||
#define GRUB_MACHINE_TIME_HEADER 1
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/efi/time.h>
|
||||
|
||||
#define GRUB_TICKS_PER_SECOND 1193
|
||||
|
||||
/* Return the real time in ticks. */
|
||||
grub_uint32_t EXPORT_FUNC (grub_get_rtc) (void);
|
||||
|
||||
#endif /* ! KERNEL_TIME_HEADER */
|
||||
#endif /* ! GRUB_MACHINE_TIME_HEADER */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue