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
				
			
		|  | @ -22,6 +22,8 @@ | |||
| #include <grub/efi/api.h> | ||||
| #include <grub/efi/efi.h> | ||||
| #include <grub/efi/console_control.h> | ||||
| #include <grub/machine/time.h> | ||||
| #include <grub/term.h> | ||||
| 
 | ||||
| /* The handle of GRUB itself. Filled in by the startup code.  */ | ||||
| grub_efi_handle_t grub_efi_image_handle; | ||||
|  | @ -75,23 +77,34 @@ grub_efi_exit (void) | |||
| 					      0, 0); | ||||
| } | ||||
| 
 | ||||
| int | ||||
| grub_efi_output_string (const char *str) | ||||
| void | ||||
| grub_efi_stall (grub_efi_uintn_t microseconds) | ||||
| { | ||||
|   grub_efi_simple_text_output_interface_t *o; | ||||
|   grub_size_t len = grub_strlen (str); | ||||
|   grub_efi_char16_t utf16_str[len + 1]; | ||||
|   grub_efi_status_t status; | ||||
| 
 | ||||
|   /* XXX Assume that STR is all ASCII characters.  */ | ||||
|   do | ||||
|     { | ||||
|       utf16_str[len] = str[len]; | ||||
|     } | ||||
|   while (len--); | ||||
|    | ||||
|   o = grub_efi_system_table->con_out; | ||||
|   status = o->output_string (o, utf16_str); | ||||
|   return status >= 0; | ||||
|   grub_efi_system_table->boot_services->stall (microseconds); | ||||
| } | ||||
| 
 | ||||
| void | ||||
| grub_stop (void) | ||||
| { | ||||
|   grub_printf ("\nPress any key to abort.\n"); | ||||
|   grub_getkey (); | ||||
|    | ||||
|   grub_efi_fini (); | ||||
|   grub_efi_exit (); | ||||
| } | ||||
| 
 | ||||
| grub_uint32_t | ||||
| grub_get_rtc (void) | ||||
| { | ||||
|   grub_efi_time_t time; | ||||
|   grub_efi_runtime_services_t *r; | ||||
| 
 | ||||
|   r = grub_efi_system_table->runtime_services; | ||||
|   if (r->get_time (&time, 0) != GRUB_EFI_SUCCESS) | ||||
|     /* What is possible in this case?  */ | ||||
|     return 0; | ||||
| 
 | ||||
|   return (((time.minute * 60 + time.second) * 1000 | ||||
| 	   + time.nanosecond / 1000000) | ||||
| 	  * GRUB_TICKS_PER_SECOND / 1000); | ||||
| } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue