be used directly if it's really a module and GRUB_MOD_INIT shouldn't
	be used on non-modules.
	* grub-core/commands/boot.c (GRUB_MOD_INIT) [LOONGSON || QEMU_MIPS]:
	Rename to grub_boot_init.
	(GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to grub_boot_fini.
	* grub-core/commands/keylayouts.c (GRUB_MOD_INIT)
	[LOONGSON || QEMU_MIPS]: Rename to grub_keylayouts_init.
	(GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to grub_keylayouts_fini.
	* grub-core/font/font_cmd.c (GRUB_MOD_INIT)
	[LOONGSON || QEMU_MIPS]: Rename to grub_font_init.
	(GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to grub_font_fini.
	* grub-core/kern/mips/loongson/init.c: Replace explicit protos with
	includes.
	(grub_machine_init): Remove empty inits.
	* grub-core/kern/mips/qemu_mips/init.c: Replace explicit protos with
	includes.
	(grub_machine_init): Remove empty inits.
	* grub-core/term/arc/console.c: Remove explicit proto.
	* grub-core/term/at_keyboard.c (GRUB_MOD_INIT)
	[LOONGSON || QEMU_MIPS]: Rename to grub_at_keyboard_init.
	(GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to
	grub_at_keyboard_fini.
	* grub-core/term/gfxterm.c (GRUB_MOD_INIT)
	[LOONGSON || QEMU_MIPS]: Rename to grub_gfxterm_init.
	(GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to
	grub_gfxterm_fini.
	* grub-core/term/i386/pc/vga_text.c (GRUB_MOD_INIT)
	[LOONGSON || QEMU_MIPS]: Rename to grub_vgatext_init.
	(GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to
	grub_vgatext_fini.
	* grub-core/term/ieee1275/console.c: Remove explicit proto.
	* grub-core/term/serial.c (GRUB_MOD_INIT)
	[LOONGSON || QEMU_MIPS]: Rename to grub_serial_init.
	(GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to
	grub_serial_fini.
	* grub-core/term/terminfo.c (GRUB_MOD_INIT)
	[LOONGSON || QEMU_MIPS]: Rename to grub_terminfo_init.
	(GRUB_MOD_FINI) [LOONGSON || QEMU_MIPS]: Rename to
	grub_terminfo_fini.
	* grub-core/video/bitmap.c (GRUB_MOD_INIT): Removed.
	(GRUB_MOD_FINI): Likewise.
	* grub-core/video/radeon_fuloong2e.c (GRUB_MOD_INIT)
	[LOONGSON]: Rename to grub_video_radeon_fuloong2e_init.
	(GRUB_MOD_FINI) [LOONGSON]: Rename to
	grub_video_radeon_fuloong2e_fini.
	* grub-core/video/sis315pro.c (GRUB_MOD_INIT)
	[LOONGSON]: Rename to grub_video_sis315pro_init.
	(GRUB_MOD_FINI) [LOONGSON]: Rename to
	grub_video_sis315pro_fini.
	* grub-core/video/sm712.c (GRUB_MOD_INIT)
	[LOONGSON]: Rename to grub_video_sm712_init.
	(GRUB_MOD_FINI) [LOONGSON]: Rename to
	grub_video_sm712_fini.
	* include/grub/at_keyboard.h (grub_at_keyboard_init): New proto.
	(grub_at_keyboard_fini): Likewise.
	* include/grub/dl.h (GRUB_MOD_INIT) [!GRUB_UTIL && !EMU]:
	Don't declare grub_{modname}_init.
	(GRUB_MOD_INIT) [!GRUB_UTIL && !EMU]: Don't declare grub_{modname}_fini.
	* include/grub/keyboard_layouts.h (grub_keylayouts_init) [!EMU]:
	New proto.
	(grub_keylayouts_fini) [!EMU]: Likewise.
	* include/grub/serial.h (grub_serial_init) [!EMU]:
	New proto.
	(grub_serial_fini) [!EMU]: Likewise.
	* include/grub/terminfo.h (grub_terminfo_init) [!EMU]:
	New proto.
	(grub_terminfo_fini) [!EMU]: Likewise.
	* include/grub/video.h (grub_font_init) [!EMU]:
	New proto.
	(grub_font_fini) [!EMU]: Likewise.
	(grub_gfxterm_init) [!EMU]: Likewise.
	(grub_gfxterm_fini) [!EMU]: Likewise.
	(grub_video_sm712_init) [!EMU]: Likewise.
	(grub_video_sm712_fini) [!EMU]: Likewise.
	(grub_video_sis315pro_init) [!EMU]: Likewise.
	(grub_video_sis315pro_fini) [!EMU]: Likewise.
	(grub_video_radeon_fuloong2e_init) [!EMU]: Likewise.
	(grub_video_radeon_fuloong2e_fini) [!EMU]: Likewise.
		
	
			
		
			
				
	
	
		
			121 lines
		
	
	
	
		
			3.3 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
			
		
		
	
	
			121 lines
		
	
	
	
		
			3.3 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| /*
 | |
|  *  GRUB  --  GRand Unified Bootloader
 | |
|  *  Copyright (C) 2011  Free Software Foundation, Inc.
 | |
|  *
 | |
|  *  GRUB 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 3 of the License, or
 | |
|  *  (at your option) any later version.
 | |
|  *
 | |
|  *  GRUB 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 GRUB.  If not, see <http://www.gnu.org/licenses/>.
 | |
|  */
 | |
| 
 | |
| #include <grub/arc/arc.h>
 | |
| #include <grub/arc/console.h>
 | |
| #include <grub/term.h>
 | |
| #include <grub/terminfo.h>
 | |
| 
 | |
| /* FIXME: use unicode.  */
 | |
| 
 | |
| static int
 | |
| readkey (struct grub_term_input *term __attribute__ ((unused)))
 | |
| {
 | |
|   unsigned long count;
 | |
|   char chr;
 | |
| 
 | |
|   if (GRUB_ARC_FIRMWARE_VECTOR->get_read_status (GRUB_ARC_STDIN))
 | |
|     return -1;
 | |
| 
 | |
|   if (GRUB_ARC_FIRMWARE_VECTOR->read (GRUB_ARC_STDIN, &chr, 1, &count))
 | |
|     return -1;
 | |
|   if (!count)
 | |
|     return -1;
 | |
|   return chr;
 | |
| }
 | |
| 
 | |
| static void
 | |
| put (struct grub_term_output *term __attribute__ ((unused)), const int c)
 | |
| {
 | |
|   unsigned long count;
 | |
|   char chr = c;
 | |
| 
 | |
|   GRUB_ARC_FIRMWARE_VECTOR->write (GRUB_ARC_STDOUT, &chr, 1, &count);
 | |
| }
 | |
| 
 | |
| static struct grub_terminfo_output_state grub_console_terminfo_output;
 | |
| 
 | |
| static grub_err_t
 | |
| grub_console_init_output (struct grub_term_output *term)
 | |
| {
 | |
|   struct grub_arc_display_status *info = NULL;
 | |
|   if (GRUB_ARC_SYSTEM_PARAMETER_BLOCK->firmware_vector_length
 | |
|       >= ((char *) (&GRUB_ARC_FIRMWARE_VECTOR->getdisplaystatus + 1)
 | |
| 	  - (char *) GRUB_ARC_FIRMWARE_VECTOR)
 | |
|       && GRUB_ARC_FIRMWARE_VECTOR->getdisplaystatus)
 | |
|     info = GRUB_ARC_FIRMWARE_VECTOR->getdisplaystatus (GRUB_ARC_STDOUT);
 | |
|   if (info)
 | |
|     {
 | |
|       grub_console_terminfo_output.width = info->w;
 | |
|       grub_console_terminfo_output.height = info->h;
 | |
|     }
 | |
|   grub_terminfo_output_init (term);
 | |
| 
 | |
|   return 0;
 | |
| }
 | |
| 
 | |
| static struct grub_terminfo_input_state grub_console_terminfo_input =
 | |
|   {
 | |
|     .readkey = readkey
 | |
|   };
 | |
| 
 | |
| static struct grub_terminfo_output_state grub_console_terminfo_output =
 | |
|   {
 | |
|     .put = put,
 | |
|     .width = 80,
 | |
|     .height = 36
 | |
|   };
 | |
| 
 | |
| static struct grub_term_input grub_console_term_input =
 | |
|   {
 | |
|     .name = "console",
 | |
|     .init = grub_terminfo_input_init,
 | |
|     .getkey = grub_terminfo_getkey,
 | |
|     .data = &grub_console_terminfo_input
 | |
|   };
 | |
| 
 | |
| static struct grub_term_output grub_console_term_output =
 | |
|   {
 | |
|     .name = "console",
 | |
|     .init = grub_console_init_output,
 | |
|     .putchar = grub_terminfo_putchar,
 | |
|     .getxy = grub_terminfo_getxy,
 | |
|     .getwh = grub_terminfo_getwh,
 | |
|     .gotoxy = grub_terminfo_gotoxy,
 | |
|     .cls = grub_terminfo_cls,
 | |
|     .setcolorstate = grub_terminfo_setcolorstate,
 | |
|     .setcursor = grub_terminfo_setcursor,
 | |
|     .flags = GRUB_TERM_CODE_TYPE_ASCII,
 | |
|     .data = &grub_console_terminfo_output,
 | |
|     .normal_color = GRUB_TERM_DEFAULT_NORMAL_COLOR,
 | |
|     .highlight_color = GRUB_TERM_DEFAULT_HIGHLIGHT_COLOR,
 | |
|   };
 | |
| 
 | |
| void
 | |
| grub_console_init_early (void)
 | |
| {
 | |
|   grub_term_register_input ("console", &grub_console_term_input);
 | |
|   grub_term_register_output ("console", &grub_console_term_output);
 | |
| }
 | |
| 
 | |
| void
 | |
| grub_console_init_lately (void)
 | |
| {
 | |
|   grub_terminfo_init ();
 | |
|   grub_terminfo_output_register (&grub_console_term_output, "arc");
 | |
| }
 |