merge with mainline
This commit is contained in:
		
						commit
						9ec82092f1
					
				
					 170 changed files with 34663 additions and 3738 deletions
				
			
		|  | @ -32,6 +32,12 @@ typedef enum | |||
|     GRUB_ATA_LBA48 | ||||
|   } grub_ata_addressing_t; | ||||
| 
 | ||||
| #define GRUB_ATA_CH0_PORT1 0x1f0 | ||||
| #define GRUB_ATA_CH1_PORT1 0x170 | ||||
| 
 | ||||
| #define GRUB_ATA_CH0_PORT2 0x3f6 | ||||
| #define GRUB_ATA_CH1_PORT2 0x376 | ||||
| 
 | ||||
| #define GRUB_ATA_REG_DATA	0 | ||||
| #define GRUB_ATA_REG_ERROR	1 | ||||
| #define GRUB_ATA_REG_FEATURES	1 | ||||
|  |  | |||
|  | @ -117,5 +117,11 @@ grub_is_valid_utf8 (const grub_uint8_t *src, grub_size_t srcsize); | |||
| 
 | ||||
| int grub_utf8_to_ucs4_alloc (const char *msg, grub_uint32_t **unicode_msg, | ||||
| 			     grub_uint32_t **last_position); | ||||
| void | ||||
| grub_ucs4_to_utf8 (grub_uint32_t *src, grub_size_t size, | ||||
| 		   grub_uint8_t *dest, grub_size_t destsize); | ||||
| grub_size_t grub_utf8_to_ucs4 (grub_uint32_t *dest, grub_size_t destsize, | ||||
| 			       const grub_uint8_t *src, grub_size_t srcsize, | ||||
| 			       const grub_uint8_t **srcend); | ||||
| 
 | ||||
| #endif | ||||
|  |  | |||
|  | @ -22,6 +22,7 @@ | |||
| #include <grub/types.h> | ||||
| #include <grub/video.h> | ||||
| #include <grub/file.h> | ||||
| #include <grub/unicode.h> | ||||
| 
 | ||||
| /* Forward declaration of opaque structure grub_font.
 | ||||
|    Users only pass struct grub_font pointers to the font module functions, | ||||
|  | @ -69,6 +70,11 @@ struct grub_font_glyph | |||
|   grub_uint8_t bitmap[0]; | ||||
| }; | ||||
| 
 | ||||
| /* Part of code field which is really used as such.  */ | ||||
| #define GRUB_FONT_CODE_CHAR_MASK     0x001fffff | ||||
| #define GRUB_FONT_CODE_RIGHT_JOINED  0x80000000 | ||||
| #define GRUB_FONT_CODE_LEFT_JOINED   0x40000000 | ||||
| 
 | ||||
| /* Initialize the font loader.
 | ||||
|    Must be called before any fonts are loaded or used.  */ | ||||
| void grub_font_loader_init (void); | ||||
|  | @ -97,8 +103,7 @@ int EXPORT_FUNC (grub_font_get_leading) (grub_font_t font); | |||
| 
 | ||||
| int EXPORT_FUNC (grub_font_get_height) (grub_font_t font); | ||||
| 
 | ||||
| int EXPORT_FUNC (grub_font_get_string_width) (grub_font_t font, | ||||
| 					      const char *str); | ||||
| int EXPORT_FUNC (grub_font_get_xheight) (grub_font_t font); | ||||
| 
 | ||||
| struct grub_font_glyph *EXPORT_FUNC (grub_font_get_glyph) (grub_font_t font, | ||||
| 							   grub_uint32_t code); | ||||
|  | @ -110,9 +115,11 @@ grub_err_t EXPORT_FUNC (grub_font_draw_glyph) (struct grub_font_glyph *glyph, | |||
| 					       grub_video_color_t color, | ||||
| 					       int left_x, int baseline_y); | ||||
| 
 | ||||
| grub_err_t EXPORT_FUNC (grub_font_draw_string) (const char *str, | ||||
| 						grub_font_t font, | ||||
| 						grub_video_color_t color, | ||||
| 						int left_x, int baseline_y); | ||||
| int | ||||
| EXPORT_FUNC (grub_font_get_constructed_device_width) (grub_font_t hinted_font, | ||||
| 					const struct grub_unicode_glyph *glyph_id); | ||||
| struct grub_font_glyph * | ||||
| EXPORT_FUNC (grub_font_construct_glyph) (grub_font_t hinted_font, | ||||
| 			   const struct grub_unicode_glyph *glyph_id); | ||||
| 
 | ||||
| #endif /* ! GRUB_FONT_HEADER */ | ||||
|  |  | |||
|  | @ -91,11 +91,13 @@ typedef int (*grub_fs_autoload_hook_t) (void); | |||
| extern grub_fs_autoload_hook_t EXPORT_VAR(grub_fs_autoload_hook); | ||||
| extern grub_fs_t EXPORT_VAR (grub_fs_list); | ||||
| 
 | ||||
| #ifndef GRUB_LST_GENERATOR | ||||
| static inline void | ||||
| grub_fs_register (grub_fs_t fs) | ||||
| { | ||||
|   grub_list_push (GRUB_AS_LIST_P (&grub_fs_list), GRUB_AS_LIST (fs)); | ||||
| } | ||||
| #endif | ||||
| 
 | ||||
| static inline void | ||||
| grub_fs_unregister (grub_fs_t fs) | ||||
|  |  | |||
|  | @ -62,6 +62,14 @@ grub_gfxmenu_print_timeout (int timeout, void *data); | |||
| void | ||||
| grub_gfxmenu_set_chosen_entry (int entry, void *data); | ||||
| 
 | ||||
| grub_err_t grub_font_draw_string (const char *str, | ||||
| 				  grub_font_t font, | ||||
| 				  grub_video_color_t color, | ||||
| 				  int left_x, int baseline_y); | ||||
| int grub_font_get_string_width (grub_font_t font, | ||||
| 				const char *str); | ||||
| 
 | ||||
| 
 | ||||
| /* Implementation details -- this should not be used outside of the
 | ||||
|    view itself.  */ | ||||
| 
 | ||||
|  |  | |||
|  | @ -40,12 +40,15 @@ | |||
| #include <grub/i386/vga_common.h> | ||||
| 
 | ||||
| /* These are global to share code between C and asm.  */ | ||||
| int grub_console_checkkey (void); | ||||
| int grub_console_getkey (void); | ||||
| grub_uint16_t grub_console_getxy (void); | ||||
| void grub_console_gotoxy (grub_uint8_t x, grub_uint8_t y); | ||||
| void grub_console_cls (void); | ||||
| void grub_console_setcursor (int on); | ||||
| int grub_console_checkkey (struct grub_term_input *term); | ||||
| int grub_console_getkey (struct grub_term_input *term); | ||||
| grub_uint16_t grub_console_getxy (struct grub_term_output *term); | ||||
| void grub_console_gotoxy (struct grub_term_output *term, | ||||
| 			  grub_uint8_t x, grub_uint8_t y); | ||||
| void grub_console_cls (struct grub_term_output *term); | ||||
| void grub_console_setcursor (struct grub_term_output *term, int on); | ||||
| void grub_console_putchar (struct grub_term_output *term, | ||||
| 			   const struct grub_unicode_glyph *c); | ||||
| 
 | ||||
| /* Initialize the console system.  */ | ||||
| void grub_console_init (void); | ||||
|  |  | |||
|  | @ -34,6 +34,8 @@ extern grub_int32_t grub_kernel_image_size; | |||
| /* The total size of module images following the kernel.  */ | ||||
| extern grub_int32_t grub_total_module_size; | ||||
| 
 | ||||
| void grub_qemu_init_cirrus (void); | ||||
| 
 | ||||
| #endif /* ! ASM_FILE */ | ||||
| 
 | ||||
| #endif /* ! GRUB_KERNEL_MACHINE_HEADER */ | ||||
|  |  | |||
|  | @ -25,16 +25,8 @@ | |||
| 
 | ||||
| extern grub_uint8_t grub_console_cur_color; | ||||
| 
 | ||||
| void grub_console_putchar (grub_uint32_t c); | ||||
| grub_ssize_t grub_console_getcharwidth (grub_uint32_t c); | ||||
| grub_uint16_t grub_console_getwh (void); | ||||
| void grub_console_setcolorstate (grub_term_color_state state); | ||||
| void grub_console_setcolor (grub_uint8_t normal_color, grub_uint8_t highlight_color); | ||||
| void grub_console_getcolor (grub_uint8_t *normal_color, grub_uint8_t *highlight_color); | ||||
| 
 | ||||
| /* Implemented in both kern/i386/pc/startup.S and vga_text.c;  this symbol
 | ||||
|    is not exported, so there's no collision, but vga_common.c expects this | ||||
|    prototype to be the same.  */ | ||||
| void grub_console_real_putchar (int c); | ||||
| grub_uint16_t grub_console_getwh (struct grub_term_output *term); | ||||
| void grub_console_setcolorstate (struct grub_term_output *term, | ||||
| 				 grub_term_color_state state); | ||||
| 
 | ||||
| #endif /* ! GRUB_VGA_COMMON_CPU_HEADER */ | ||||
|  |  | |||
|  | @ -114,8 +114,6 @@ extern grub_uint32_t grub_xnu_stack; | |||
| extern grub_uint32_t grub_xnu_arg1; | ||||
| extern char grub_xnu_cmdline[1024]; | ||||
| grub_err_t grub_xnu_boot (void); | ||||
| grub_err_t grub_xnu_set_video (struct grub_xnu_boot_params *bootparams_relloc); | ||||
| grub_err_t | ||||
| grub_cpu_xnu_fill_devicetree (void); | ||||
| grub_err_t grub_cpu_xnu_fill_devicetree (void); | ||||
| extern grub_uint32_t grub_xnu_heap_will_be_at; | ||||
| #endif | ||||
|  |  | |||
|  | @ -22,7 +22,8 @@ | |||
| #include <grub/symbol.h> | ||||
| 
 | ||||
| /* Initialize the console system.  */ | ||||
| void grub_console_init (void); | ||||
| void grub_console_init_early (void); | ||||
| void grub_console_init_lately (void); | ||||
| 
 | ||||
| /* Finish the console system.  */ | ||||
| void grub_console_fini (void); | ||||
							
								
								
									
										90
									
								
								include/grub/mips/loongson.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										90
									
								
								include/grub/mips/loongson.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,90 @@ | |||
| /*
 | ||||
|  *  GRUB  --  GRand Unified Bootloader | ||||
|  *  Copyright (C) 2010  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/>.
 | ||||
|  */ | ||||
| 
 | ||||
| #ifndef GRUB_LOONGSON_CPU_HEADER | ||||
| #define GRUB_LOONGSON_CPU_HEADER	1 | ||||
| 
 | ||||
| #ifdef ASM_FILE | ||||
| #define GRUB_CPU_REGISTER_WRAP(x) x | ||||
| #else | ||||
| #define GRUB_CPU_REGISTER_WRAP(x) #x | ||||
| #endif | ||||
| 
 | ||||
| #define GRUB_CPU_LOONGSON_FLASH_START            0xbfc00000 | ||||
| #define GRUB_CPU_LOONGSON_FLASH_TLB_REFILL       0xbfc00200 | ||||
| #define GRUB_CPU_LOONGSON_FLASH_CACHE_ERROR      0xbfc00300 | ||||
| #define GRUB_CPU_LOONGSON_FLASH_OTHER_EXCEPTION  0xbfc00380 | ||||
| 
 | ||||
| #define GRUB_CPU_LOONGSON_DDR2_BASE              0xaffffe00 | ||||
| #define GRUB_CPU_LOONGSON_DDR2_REG1_HI_8BANKS    0x00000001 | ||||
| #define GRUB_CPU_LOONGSON_DDR2_REG_SIZE          0x8 | ||||
| #define GRUB_CPU_LOONGSON_DDR2_REG_STEP          0x10 | ||||
| 
 | ||||
| #define GRUB_CPU_LOONGSON_COP0_CACHE_CONFIG GRUB_CPU_REGISTER_WRAP($16) | ||||
| #define GRUB_CPU_LOONGSON_COP0_CACHE_CONFIG_ILINESIZE 0x10 | ||||
| #define GRUB_CPU_LOONGSON_COP0_CACHE_CONFIG_DLINESIZE 0x8 | ||||
| #define GRUB_CPU_LOONGSON_COP0_CACHE_DSIZE_SHIFT 6 | ||||
| #define GRUB_CPU_LOONGSON_COP0_CACHE_ISIZE_SHIFT 9 | ||||
| #define GRUB_CPU_LOONGSON_COP0_CACHE_SIZE_MASK  0x7 | ||||
| #define GRUB_CPU_LOONGSON_COP0_CACHE_SIZE_OFFSET 12 | ||||
| 
 | ||||
| #define GRUB_CPU_LOONGSON_COP0_I_INDEX_INVALIDATE 0 | ||||
| #define GRUB_CPU_LOONGSON_COP0_D_INDEX_TAG_STORE  9 | ||||
| #define GRUB_CPU_LOONGSON_COP0_S_INDEX_TAG_STORE  11 | ||||
| 
 | ||||
| #define GRUB_CPU_LOONGSON_COP0_I_INDEX_BIT_OFFSET 5 | ||||
| #define GRUB_CPU_LOONGSON_COP0_D_INDEX_BIT_OFFSET 5 | ||||
| #define GRUB_CPU_LOONGSON_COP0_S_INDEX_BIT_OFFSET 5 | ||||
| 
 | ||||
| #define GRUB_CPU_LOONGSON_CACHE_ACCELERATED 7 | ||||
| #define GRUB_CPU_LOONGSON_CACHE_UNCACHED 2 | ||||
| #define GRUB_CPU_LOONGSON_CACHE_CACHED 3 | ||||
| #define GRUB_CPU_LOONGSON_CACHE_TYPE_MASK 7 | ||||
| #define GRUB_CPU_LOONGSON_CACHE_LINE_SIZE_LOG_SMALL 4 | ||||
| #define GRUB_CPU_LOONGSON_CACHE_LINE_SIZE_LOG_BIG 5 | ||||
| #define GRUB_CPU_LOONGSON_CACHE_LINE_SIZE_SMALL 16 | ||||
| #define GRUB_CPU_LOONGSON_CACHE_LINE_SIZE_BIG 32 | ||||
| 
 | ||||
| #define GRUB_CPU_LOONGSON_I_CACHE_LOG_WAYS 2 | ||||
| #define GRUB_CPU_LOONGSON_D_CACHE_LOG_WAYS 2 | ||||
| #define GRUB_CPU_LOONGSON_S_CACHE_LOG_WAYS 2 | ||||
| 
 | ||||
| /* FIXME: determine dynamically.  */ | ||||
| #define GRUB_CPU_LOONGSON_SECONDARY_CACHE_LOG_SIZE 19 | ||||
| 
 | ||||
| #define GRUB_CPU_LOONGSON_COP0_BADVADDR GRUB_CPU_REGISTER_WRAP($8) | ||||
| #define GRUB_CPU_LOONGSON_COP0_TIMER_COUNT GRUB_CPU_REGISTER_WRAP($9) | ||||
| #define GRUB_CPU_LOONGSON_COP0_CAUSE GRUB_CPU_REGISTER_WRAP($13) | ||||
| #define GRUB_CPU_LOONGSON_COP0_EPC GRUB_CPU_REGISTER_WRAP($14) | ||||
| #define GRUB_CPU_LOONGSON_COP0_CACHE_TAGLO GRUB_CPU_REGISTER_WRAP($28) | ||||
| #define GRUB_CPU_LOONGSON_COP0_CACHE_TAGHI GRUB_CPU_REGISTER_WRAP($29) | ||||
| 
 | ||||
| #define GRUB_CPU_LOONGSON_LIOCFG   0xbfe00108 | ||||
| #define GRUB_CPU_LOONGSON_ROM_DELAY_OFFSET 2 | ||||
| #define GRUB_CPU_LOONGSON_ROM_DELAY_MASK 0x1f | ||||
| #define GRUB_CPU_LOONGSON_CORECFG   0xbfe00180 | ||||
| #define GRUB_CPU_LOONGSON_CORECFG_DISABLE_DDR2_SPACE 0x100 | ||||
| #define GRUB_CPU_LOONGSON_CORECFG_BUFFER_CPU 0x200 | ||||
| 
 | ||||
| #define GRUB_CPU_LOONGSON_PCI_HIT1_SEL_LO   0xbfe00150 | ||||
| #define GRUB_CPU_LOONGSON_PCI_HIT1_SEL_HI   0xbfe00154 | ||||
| 
 | ||||
| #define GRUB_CPU_LOONGSON_GPIOCFG  0xbfe00120 | ||||
| #define GRUB_CPU_LOONGSON_SHUTDOWN_GPIO 1 | ||||
| 
 | ||||
| #endif | ||||
							
								
								
									
										41
									
								
								include/grub/mips/yeeloong/ec.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								include/grub/mips/yeeloong/ec.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,41 @@ | |||
| /*
 | ||||
|  *  GRUB  --  GRand Unified Bootloader | ||||
|  *  Copyright (C) 2010  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/>.
 | ||||
|  */ | ||||
| 
 | ||||
| #ifndef GRUB_EC_MACHINE_HEADER | ||||
| #define GRUB_EC_MACHINE_HEADER	1 | ||||
| 
 | ||||
| #define GRUB_MACHINE_EC_MAGIC_PORT1 0x381 | ||||
| #define GRUB_MACHINE_EC_MAGIC_PORT2 0x382 | ||||
| #define GRUB_MACHINE_EC_DATA_PORT 0x383 | ||||
| 
 | ||||
| #define GRUB_MACHINE_EC_MAGIC_VAL1 0xf4 | ||||
| #define GRUB_MACHINE_EC_MAGIC_VAL2 0xec | ||||
| 
 | ||||
| #define GRUB_MACHINE_EC_COMMAND_REBOOT 1 | ||||
| 
 | ||||
| static inline void | ||||
| grub_write_ec (grub_uint8_t value) | ||||
| { | ||||
|   grub_outb (GRUB_MACHINE_EC_MAGIC_VAL1, | ||||
| 	     GRUB_MACHINE_PCI_IO_BASE + GRUB_MACHINE_EC_MAGIC_PORT1); | ||||
|   grub_outb (GRUB_MACHINE_EC_MAGIC_VAL2, | ||||
| 	     GRUB_MACHINE_PCI_IO_BASE + GRUB_MACHINE_EC_MAGIC_PORT2); | ||||
|   grub_outb (value, GRUB_MACHINE_PCI_IO_BASE + GRUB_MACHINE_EC_DATA_PORT); | ||||
| } | ||||
| 
 | ||||
| #endif | ||||
|  | @ -19,6 +19,12 @@ | |||
| #ifndef GRUB_MACHINE_SERIAL_HEADER | ||||
| #define GRUB_MACHINE_SERIAL_HEADER	1 | ||||
| 
 | ||||
| #define GRUB_MACHINE_SERIAL_PORTS { 0xbff003f8 } | ||||
| #define GRUB_MACHINE_SERIAL_DIVISOR_115200 2 | ||||
| #define GRUB_MACHINE_SERIAL_PORT  0xbff003f8 | ||||
| 
 | ||||
| #ifndef ASM_FILE | ||||
| #define GRUB_MACHINE_SERIAL_PORTS { GRUB_MACHINE_SERIAL_PORT } | ||||
| #else | ||||
| #endif | ||||
| 
 | ||||
| #endif  | ||||
|  |  | |||
|  | @ -237,7 +237,19 @@ void *EXPORT_FUNC(grub_memset) (void *s, int c, grub_size_t n); | |||
| grub_size_t EXPORT_FUNC(grub_strlen) (const char *s); | ||||
| int EXPORT_FUNC(grub_printf) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); | ||||
| int EXPORT_FUNC(grub_printf_) (const char *fmt, ...) __attribute__ ((format (printf, 1, 2))); | ||||
| int EXPORT_FUNC(grub_puts) (const char *s); | ||||
| 
 | ||||
| extern void (*EXPORT_VAR (grub_xputs)) (const char *str); | ||||
| 
 | ||||
| static inline int | ||||
| grub_puts (const char *s) | ||||
| { | ||||
|   const char nl[2] = "\n"; | ||||
|   grub_xputs (s); | ||||
|   grub_xputs (nl); | ||||
| 
 | ||||
|   return 1;	/* Cannot fail.  */ | ||||
| } | ||||
| 
 | ||||
| int EXPORT_FUNC(grub_puts_) (const char *s); | ||||
| void EXPORT_FUNC(grub_real_dprintf) (const char *file, | ||||
|                                      const int line, | ||||
|  | @ -253,11 +265,6 @@ char *EXPORT_FUNC(grub_xasprintf) (const char *fmt, ...) | |||
| char *EXPORT_FUNC(grub_xvasprintf) (const char *fmt, va_list args); | ||||
| void EXPORT_FUNC(grub_exit) (void) __attribute__ ((noreturn)); | ||||
| void EXPORT_FUNC(grub_abort) (void) __attribute__ ((noreturn)); | ||||
| grub_size_t EXPORT_FUNC(grub_utf8_to_ucs4) (grub_uint32_t *dest, | ||||
| 					    grub_size_t destsize, | ||||
| 					    const grub_uint8_t *src, | ||||
| 					    grub_size_t srcsize, | ||||
| 					    const grub_uint8_t **srcend); | ||||
| grub_uint64_t EXPORT_FUNC(grub_divmod64) (grub_uint64_t n, | ||||
| 					  grub_uint32_t d, grub_uint32_t *r); | ||||
| 
 | ||||
|  | @ -307,14 +314,14 @@ grub_div_roundup (unsigned int x, unsigned int y) | |||
| } | ||||
| 
 | ||||
| /* Reboot the machine.  */ | ||||
| void EXPORT_FUNC (grub_reboot) (void); | ||||
| void EXPORT_FUNC (grub_reboot) (void) __attribute__ ((noreturn)); | ||||
| 
 | ||||
| #ifdef GRUB_MACHINE_PCBIOS | ||||
| /* Halt the system, using APM if possible. If NO_APM is true, don't
 | ||||
|  * use APM even if it is available.  */ | ||||
| void EXPORT_FUNC (grub_halt) (int no_apm); | ||||
| void EXPORT_FUNC (grub_halt) (int no_apm) __attribute__ ((noreturn)); | ||||
| #else | ||||
| void EXPORT_FUNC (grub_halt) (void); | ||||
| void EXPORT_FUNC (grub_halt) (void) __attribute__ ((noreturn)); | ||||
| #endif | ||||
| 
 | ||||
| #endif /* ! GRUB_MISC_HEADER */ | ||||
|  |  | |||
|  | @ -77,9 +77,11 @@ void grub_parse_color_name_pair (grub_uint8_t *ret, const char *name); | |||
| 
 | ||||
| /* Defined in `menu_text.c'.  */ | ||||
| void grub_wait_after_message (void); | ||||
| void grub_print_ucs4 (const grub_uint32_t * str, | ||||
| 		      const grub_uint32_t * last_position, | ||||
| 		      struct grub_term_output *term); | ||||
| void | ||||
| grub_print_ucs4 (const grub_uint32_t * str, | ||||
| 		 const grub_uint32_t * last_position, | ||||
| 		 int margin_left, int margin_right, | ||||
| 		 struct grub_term_output *term); | ||||
| grub_ssize_t grub_getstringwidth (grub_uint32_t * str, | ||||
| 				  const grub_uint32_t * last_position, | ||||
| 				  struct grub_term_output *term); | ||||
|  | @ -110,7 +112,9 @@ void read_terminal_list (const char *prefix); | |||
| 
 | ||||
| void grub_set_more (int onoff); | ||||
| 
 | ||||
| int grub_normal_get_line_counter (void); | ||||
| void grub_install_newline_hook (void); | ||||
| int grub_normal_get_char_counter (void); | ||||
| void grub_normal_reset_more (void); | ||||
| 
 | ||||
| void grub_xputs_normal (const char *str); | ||||
| 
 | ||||
| #endif /* ! GRUB_NORMAL_HEADER */ | ||||
|  |  | |||
|  | @ -83,7 +83,7 @@ struct grub_parser | |||
| }; | ||||
| typedef struct grub_parser *grub_parser_t; | ||||
| 
 | ||||
| grub_err_t EXPORT_FUNC(grub_parser_execute) (char *source); | ||||
| grub_err_t grub_parser_execute (char *source); | ||||
| 
 | ||||
| grub_err_t | ||||
| grub_rescue_parse_line (char *line, grub_reader_getline_t getline); | ||||
|  |  | |||
|  | @ -77,12 +77,14 @@ char *EXPORT_FUNC(grub_partition_get_name) (const grub_partition_t partition); | |||
| 
 | ||||
| extern grub_partition_map_t EXPORT_VAR(grub_partition_map_list); | ||||
| 
 | ||||
| #ifndef GRUB_LST_GENERATOR | ||||
| static inline void | ||||
| grub_partition_map_register (grub_partition_map_t partmap) | ||||
| { | ||||
|   grub_list_push (GRUB_AS_LIST_P (&grub_partition_map_list), | ||||
| 		  GRUB_AS_LIST (partmap)); | ||||
| } | ||||
| #endif | ||||
| 
 | ||||
| static inline void | ||||
| grub_partition_map_unregister (grub_partition_map_t partmap) | ||||
|  |  | |||
|  | @ -1,28 +0,0 @@ | |||
| /*
 | ||||
|  *  GRUB  --  GRand Unified Bootloader | ||||
|  *  Copyright (C) 2002,2004,2005,2007  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/>.
 | ||||
|  */ | ||||
| 
 | ||||
| #ifndef GRUB_CONSOLE_MACHINE_HEADER | ||||
| #define GRUB_CONSOLE_MACHINE_HEADER	1 | ||||
| 
 | ||||
| /* Initialize the console system.  */ | ||||
| void grub_console_init (void); | ||||
| 
 | ||||
| /* Finish the console system.  */ | ||||
| void grub_console_fini (void); | ||||
| 
 | ||||
| #endif /* ! GRUB_CONSOLE_MACHINE_HEADER */ | ||||
|  | @ -26,16 +26,35 @@ void grub_scsi_dev_unregister (grub_scsi_dev_t dev); | |||
| 
 | ||||
| struct grub_scsi; | ||||
| 
 | ||||
| enum | ||||
|   { | ||||
|     GRUB_SCSI_SUBSYSTEM_USBMS, | ||||
|     GRUB_SCSI_SUBSYSTEM_ATAPI | ||||
|   }; | ||||
| 
 | ||||
| #define GRUB_SCSI_ID_SUBSYSTEM_SHIFT 24 | ||||
| #define GRUB_SCSI_ID_BUS_SHIFT 8 | ||||
| #define GRUB_SCSI_ID_LUN_SHIFT 0 | ||||
| 
 | ||||
| static inline grub_uint32_t | ||||
| grub_make_scsi_id (int subsystem, int bus, int lun) | ||||
| { | ||||
|   return (subsystem << GRUB_SCSI_ID_SUBSYSTEM_SHIFT) | ||||
|     | (bus << GRUB_SCSI_ID_BUS_SHIFT) | (lun << GRUB_SCSI_ID_BUS_SHIFT); | ||||
| } | ||||
| 
 | ||||
| struct grub_scsi_dev | ||||
| { | ||||
|   /* The device name.  */ | ||||
|   const char *name; | ||||
| 
 | ||||
|   grub_uint8_t id; | ||||
| 
 | ||||
|   /* Call HOOK with each device name, until HOOK returns non-zero.  */ | ||||
|   int (*iterate) (int (*hook) (const char *name, int luns)); | ||||
|   int (*iterate) (int (*hook) (int bus, int luns)); | ||||
| 
 | ||||
|   /* Open the device named NAME, and set up SCSI.  */ | ||||
|   grub_err_t (*open) (const char *name, struct grub_scsi *scsi); | ||||
|   grub_err_t (*open) (int bus, struct grub_scsi *scsi); | ||||
| 
 | ||||
|   /* Close the scsi device SCSI.  */ | ||||
|   void (*close) (struct grub_scsi *scsi); | ||||
|  | @ -56,15 +75,14 @@ struct grub_scsi_dev | |||
| 
 | ||||
| struct grub_scsi | ||||
| { | ||||
|   /* The scsi device name.  */ | ||||
|   char *name; | ||||
| 
 | ||||
|   /* The underlying scsi device.  */ | ||||
|   grub_scsi_dev_t dev; | ||||
| 
 | ||||
|   /* Type of SCSI device.  XXX: Make enum.  */ | ||||
|   grub_uint8_t devtype; | ||||
| 
 | ||||
|   int bus; | ||||
| 
 | ||||
|   /* Number of LUNs.  */ | ||||
|   int luns; | ||||
| 
 | ||||
|  |  | |||
|  | @ -59,9 +59,15 @@ | |||
| #define UART_DLAB	0x80 | ||||
| 
 | ||||
| /* Enable the FIFO.  */ | ||||
| #define UART_ENABLE_FIFO	0xC7 | ||||
| #define UART_ENABLE_FIFO_TRIGGER14	0xC7 | ||||
| 
 | ||||
| /* Enable the FIFO.  */ | ||||
| #define UART_ENABLE_FIFO_TRIGGER1       0x07 | ||||
| 
 | ||||
| /* Turn on DTR, RTS, and OUT2.  */ | ||||
| #define UART_ENABLE_MODEM	0x0B | ||||
| #define UART_ENABLE_DTRRTS	0x03 | ||||
| 
 | ||||
| /* Turn on DTR, RTS, and OUT2.  */ | ||||
| #define UART_ENABLE_OUT2	0x08 | ||||
| 
 | ||||
| #endif /* ! GRUB_SERIAL_MACHINE_HEADER */ | ||||
|  |  | |||
|  | @ -1,28 +0,0 @@ | |||
| /*
 | ||||
|  *  GRUB  --  GRand Unified Bootloader | ||||
|  *  Copyright (C) 2002,2004,2005,2007  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/>.
 | ||||
|  */ | ||||
| 
 | ||||
| #ifndef GRUB_CONSOLE_MACHINE_HEADER | ||||
| #define GRUB_CONSOLE_MACHINE_HEADER	1 | ||||
| 
 | ||||
| /* Initialize the console system.  */ | ||||
| void grub_console_init (void); | ||||
| 
 | ||||
| /* Finish the console system.  */ | ||||
| void grub_console_fini (void); | ||||
| 
 | ||||
| #endif /* ! GRUB_CONSOLE_MACHINE_HEADER */ | ||||
|  | @ -38,6 +38,7 @@ | |||
| #include <grub/err.h> | ||||
| #include <grub/symbol.h> | ||||
| #include <grub/types.h> | ||||
| #include <grub/unicode.h> | ||||
| #include <grub/list.h> | ||||
| 
 | ||||
| /* These are used to represent the various color states we use.  */ | ||||
|  | @ -63,11 +64,25 @@ grub_term_color_state; | |||
|    to NULL.  */ | ||||
| 
 | ||||
| /* Set when input characters shouldn't be echoed back.  */ | ||||
| #define GRUB_TERM_NO_ECHO	(1 << 0) | ||||
| #define GRUB_TERM_NO_ECHO	        (1 << 0) | ||||
| /* Set when the editing feature should be disabled.  */ | ||||
| #define GRUB_TERM_NO_EDIT	(1 << 1) | ||||
| #define GRUB_TERM_NO_EDIT	        (1 << 1) | ||||
| /* Set when the terminal cannot do fancy things.  */ | ||||
| #define GRUB_TERM_DUMB		(1 << 2) | ||||
| #define GRUB_TERM_DUMB		        (1 << 2) | ||||
| /* Which encoding does terminal expect stream to be.  */ | ||||
| #define GRUB_TERM_CODE_TYPE_SHIFT       3 | ||||
| #define GRUB_TERM_CODE_TYPE_MASK	        (7 << GRUB_TERM_CODE_TYPE_SHIFT) | ||||
| /* Only ASCII characters accepted.  */ | ||||
| #define GRUB_TERM_CODE_TYPE_ASCII	        (0 << GRUB_TERM_CODE_TYPE_SHIFT) | ||||
| /* Expects CP-437 characters (ASCII + pseudographics).  */ | ||||
| #define GRUB_TERM_CODE_TYPE_CP437	                (1 << GRUB_TERM_CODE_TYPE_SHIFT) | ||||
| /* UTF-8 stream in logical order. Usually used for terminals
 | ||||
|    which just forward the stream to another computer.  */ | ||||
| #define GRUB_TERM_CODE_TYPE_UTF8_LOGICAL	(2 << GRUB_TERM_CODE_TYPE_SHIFT) | ||||
| /* UTF-8 in visual order. Like UTF-8 logical but for buggy endpoints.  */ | ||||
| #define GRUB_TERM_CODE_TYPE_UTF8_VISUAL	        (3 << GRUB_TERM_CODE_TYPE_SHIFT) | ||||
| /* Glyph description in visual order.  */ | ||||
| #define GRUB_TERM_CODE_TYPE_VISUAL_GLYPHS       (4 << GRUB_TERM_CODE_TYPE_SHIFT) | ||||
| 
 | ||||
| 
 | ||||
| /* Bitmasks for modifier keys returned by grub_getkeystatus.  */ | ||||
|  | @ -75,20 +90,6 @@ grub_term_color_state; | |||
| #define GRUB_TERM_STATUS_CTRL	(1 << 1) | ||||
| #define GRUB_TERM_STATUS_ALT	(1 << 2) | ||||
| 
 | ||||
| 
 | ||||
| /* Unicode characters for fancy graphics.  */ | ||||
| #define GRUB_TERM_DISP_LEFT	0x2190 | ||||
| #define GRUB_TERM_DISP_UP	0x2191 | ||||
| #define GRUB_TERM_DISP_RIGHT	0x2192 | ||||
| #define GRUB_TERM_DISP_DOWN	0x2193 | ||||
| #define GRUB_TERM_DISP_HLINE	0x2501 | ||||
| #define GRUB_TERM_DISP_VLINE	0x2503 | ||||
| #define GRUB_TERM_DISP_UL	0x250F | ||||
| #define GRUB_TERM_DISP_UR	0x2513 | ||||
| #define GRUB_TERM_DISP_LL	0x2517 | ||||
| #define GRUB_TERM_DISP_LR	0x251B | ||||
| 
 | ||||
| 
 | ||||
| /* Menu-related geometrical constants.  */ | ||||
| 
 | ||||
| /* The number of lines of "GRUB version..." at the top.  */ | ||||
|  | @ -122,19 +123,21 @@ struct grub_term_input | |||
|   const char *name; | ||||
| 
 | ||||
|   /* Initialize the terminal.  */ | ||||
|   grub_err_t (*init) (void); | ||||
|   grub_err_t (*init) (struct grub_term_input *term); | ||||
| 
 | ||||
|   /* Clean up the terminal.  */ | ||||
|   grub_err_t (*fini) (void); | ||||
|   grub_err_t (*fini) (struct grub_term_input *term); | ||||
| 
 | ||||
|   /* Check if any input character is available.  */ | ||||
|   int (*checkkey) (void); | ||||
|   int (*checkkey) (struct grub_term_input *term); | ||||
| 
 | ||||
|   /* Get a character.  */ | ||||
|   int (*getkey) (void); | ||||
|   int (*getkey) (struct grub_term_input *term); | ||||
| 
 | ||||
|   /* Get keyboard modifier status.  */ | ||||
|   int (*getkeystatus) (void); | ||||
|   int (*getkeystatus) (struct grub_term_input *term); | ||||
| 
 | ||||
|   void *data; | ||||
| }; | ||||
| typedef struct grub_term_input *grub_term_input_t; | ||||
| 
 | ||||
|  | @ -147,52 +150,58 @@ struct grub_term_output | |||
|   const char *name; | ||||
| 
 | ||||
|   /* Initialize the terminal.  */ | ||||
|   grub_err_t (*init) (void); | ||||
|   grub_err_t (*init) (struct grub_term_output *term); | ||||
| 
 | ||||
|   /* Clean up the terminal.  */ | ||||
|   grub_err_t (*fini) (void); | ||||
|   grub_err_t (*fini) (struct grub_term_output *term); | ||||
| 
 | ||||
|   /* Put a character. C is encoded in Unicode.  */ | ||||
|   void (*putchar) (grub_uint32_t c); | ||||
|   void (*putchar) (struct grub_term_output *term, | ||||
| 		   const struct grub_unicode_glyph *c); | ||||
| 
 | ||||
|   /* Get the number of columns occupied by a given character C. C is
 | ||||
|      encoded in Unicode.  */ | ||||
|   grub_ssize_t (*getcharwidth) (grub_uint32_t c); | ||||
|   grub_ssize_t (*getcharwidth) (struct grub_term_output *term, | ||||
| 				const struct grub_unicode_glyph *c); | ||||
| 
 | ||||
|   /* Get the screen size. The return value is ((Width << 8) | Height).  */ | ||||
|   grub_uint16_t (*getwh) (void); | ||||
|   grub_uint16_t (*getwh) (struct grub_term_output *term); | ||||
| 
 | ||||
|   /* Get the cursor position. The return value is ((X << 8) | Y).  */ | ||||
|   grub_uint16_t (*getxy) (void); | ||||
|   grub_uint16_t (*getxy) (struct grub_term_output *term); | ||||
| 
 | ||||
|   /* Go to the position (X, Y).  */ | ||||
|   void (*gotoxy) (grub_uint8_t x, grub_uint8_t y); | ||||
|   void (*gotoxy) (struct grub_term_output *term, | ||||
| 		  grub_uint8_t x, grub_uint8_t y); | ||||
| 
 | ||||
|   /* Clear the screen.  */ | ||||
|   void (*cls) (void); | ||||
|   void (*cls) (struct grub_term_output *term); | ||||
| 
 | ||||
|   /* Set the current color to be used */ | ||||
|   void (*setcolorstate) (grub_term_color_state state); | ||||
| 
 | ||||
|   /* Set the normal color and the highlight color. The format of each
 | ||||
|      color is VGA's.  */ | ||||
|   void (*setcolor) (grub_uint8_t normal_color, grub_uint8_t highlight_color); | ||||
| 
 | ||||
|   /* Get the normal color and the highlight color. The format of each
 | ||||
|      color is VGA's.  */ | ||||
|   void (*getcolor) (grub_uint8_t *normal_color, grub_uint8_t *highlight_color); | ||||
|   void (*setcolorstate) (struct grub_term_output *term, | ||||
| 			 grub_term_color_state state); | ||||
| 
 | ||||
|   /* Turn on/off the cursor.  */ | ||||
|   void (*setcursor) (int on); | ||||
|   void (*setcursor) (struct grub_term_output *term, int on); | ||||
| 
 | ||||
|   /* Update the screen.  */ | ||||
|   void (*refresh) (void); | ||||
|   void (*refresh) (struct grub_term_output *term); | ||||
| 
 | ||||
|   /* The feature flags defined above.  */ | ||||
|   grub_uint32_t flags; | ||||
| 
 | ||||
|   /* Current color state.  */ | ||||
|   grub_uint8_t normal_color; | ||||
|   grub_uint8_t highlight_color; | ||||
| 
 | ||||
|   void *data; | ||||
| }; | ||||
| typedef struct grub_term_output *grub_term_output_t; | ||||
| 
 | ||||
| #define GRUB_TERM_DEFAULT_NORMAL_COLOR 0x07 | ||||
| #define GRUB_TERM_DEFAULT_HIGHLIGHT_COLOR 0x70 | ||||
| #define GRUB_TERM_DEFAULT_STANDARD_COLOR 0x07 | ||||
| 
 | ||||
| extern struct grub_term_output *EXPORT_VAR(grub_term_outputs_disabled); | ||||
| extern struct grub_term_input *EXPORT_VAR(grub_term_inputs_disabled); | ||||
| extern struct grub_term_output *EXPORT_VAR(grub_term_outputs); | ||||
|  | @ -208,11 +217,19 @@ grub_term_register_input (const char *name __attribute__ ((unused)), | |||
|   else | ||||
|     { | ||||
|       /* If this is the first terminal, enable automatically.  */ | ||||
|       if (! term->init || term->init () == GRUB_ERR_NONE) | ||||
|       if (! term->init || term->init (term) == GRUB_ERR_NONE) | ||||
| 	grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs), GRUB_AS_LIST (term)); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| static inline void | ||||
| grub_term_register_input_active (const char *name __attribute__ ((unused)), | ||||
| 				 grub_term_input_t term) | ||||
| { | ||||
|   if (! term->init || term->init (term) == GRUB_ERR_NONE) | ||||
|     grub_list_push (GRUB_AS_LIST_P (&grub_term_inputs), GRUB_AS_LIST (term)); | ||||
| } | ||||
| 
 | ||||
| static inline void | ||||
| grub_term_register_output (const char *name __attribute__ ((unused)), | ||||
| 			   grub_term_output_t term) | ||||
|  | @ -223,12 +240,21 @@ grub_term_register_output (const char *name __attribute__ ((unused)), | |||
|   else | ||||
|     { | ||||
|       /* If this is the first terminal, enable automatically.  */ | ||||
|       if (! term->init || term->init () == GRUB_ERR_NONE) | ||||
|       if (! term->init || term->init (term) == GRUB_ERR_NONE) | ||||
| 	grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs), | ||||
| 			GRUB_AS_LIST (term)); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| static inline void | ||||
| grub_term_register_output_active (const char *name __attribute__ ((unused)), | ||||
| 				  grub_term_output_t term) | ||||
| { | ||||
|   if (! term->init || term->init (term) == GRUB_ERR_NONE) | ||||
|     grub_list_push (GRUB_AS_LIST_P (&grub_term_outputs), | ||||
| 		    GRUB_AS_LIST (term)); | ||||
| } | ||||
| 
 | ||||
| static inline void | ||||
| grub_term_unregister_input (grub_term_input_t term) | ||||
| { | ||||
|  | @ -250,14 +276,11 @@ grub_term_unregister_output (grub_term_output_t term) | |||
| #define FOR_ACTIVE_TERM_OUTPUTS(var) FOR_LIST_ELEMENTS((var), (grub_term_outputs)) | ||||
| #define FOR_DISABLED_TERM_OUTPUTS(var) FOR_LIST_ELEMENTS((var), (grub_term_outputs_disabled)) | ||||
| 
 | ||||
| void EXPORT_FUNC(grub_putchar) (int c); | ||||
| void EXPORT_FUNC(grub_putcode) (grub_uint32_t code, | ||||
| 				struct grub_term_output *term); | ||||
| void grub_putcode (grub_uint32_t code, struct grub_term_output *term); | ||||
| int EXPORT_FUNC(grub_getkey) (void); | ||||
| int EXPORT_FUNC(grub_checkkey) (void); | ||||
| int EXPORT_FUNC(grub_getkeystatus) (void); | ||||
| void EXPORT_FUNC(grub_cls) (void); | ||||
| void EXPORT_FUNC(grub_setcolorstate) (grub_term_color_state state); | ||||
| void grub_cls (void); | ||||
| void EXPORT_FUNC(grub_refresh) (void); | ||||
| void grub_puts_terminal (const char *str, struct grub_term_output *term); | ||||
| grub_uint16_t *grub_term_save_pos (void); | ||||
|  | @ -265,12 +288,12 @@ void grub_term_restore_pos (grub_uint16_t *pos); | |||
| 
 | ||||
| static inline unsigned grub_term_width (struct grub_term_output *term) | ||||
| { | ||||
|   return ((term->getwh()&0xFF00)>>8); | ||||
|   return ((term->getwh(term)&0xFF00)>>8); | ||||
| } | ||||
| 
 | ||||
| static inline unsigned grub_term_height (struct grub_term_output *term) | ||||
| { | ||||
|   return (term->getwh()&0xFF); | ||||
|   return (term->getwh(term)&0xFF); | ||||
| } | ||||
| 
 | ||||
| /* The width of the border.  */ | ||||
|  | @ -314,20 +337,20 @@ grub_term_cursor_x (struct grub_term_output *term) | |||
| static inline grub_uint16_t | ||||
| grub_term_getxy (struct grub_term_output *term) | ||||
| { | ||||
|   return term->getxy (); | ||||
|   return term->getxy (term); | ||||
| } | ||||
| 
 | ||||
| static inline void | ||||
| grub_term_refresh (struct grub_term_output *term) | ||||
| { | ||||
|   if (term->refresh) | ||||
|     term->refresh (); | ||||
|     term->refresh (term); | ||||
| } | ||||
| 
 | ||||
| static inline void | ||||
| grub_term_gotoxy (struct grub_term_output *term, grub_uint8_t x, grub_uint8_t y) | ||||
| { | ||||
|   term->gotoxy (x, y); | ||||
|   term->gotoxy (term, x, y); | ||||
| } | ||||
| 
 | ||||
| static inline void  | ||||
|  | @ -335,17 +358,26 @@ grub_term_setcolorstate (struct grub_term_output *term, | |||
| 			 grub_term_color_state state) | ||||
| { | ||||
|   if (term->setcolorstate) | ||||
|     term->setcolorstate (state); | ||||
|     term->setcolorstate (term, state); | ||||
| } | ||||
| 
 | ||||
|   /* Set the normal color and the highlight color. The format of each
 | ||||
|      color is VGA's.  */ | ||||
| static inline void | ||||
| grub_setcolorstate (grub_term_color_state state) | ||||
| { | ||||
|   struct grub_term_output *term; | ||||
|    | ||||
|   FOR_ACTIVE_TERM_OUTPUTS(term) | ||||
|     grub_term_setcolorstate (term, state); | ||||
| } | ||||
| 
 | ||||
| /* Set the normal color and the highlight color. The format of each
 | ||||
|    color is VGA's.  */ | ||||
| static inline void  | ||||
| grub_term_setcolor (struct grub_term_output *term, | ||||
| 		    grub_uint8_t normal_color, grub_uint8_t highlight_color) | ||||
| { | ||||
|   if (term->setcolor) | ||||
|     term->setcolor (normal_color, highlight_color); | ||||
|   term->normal_color = normal_color; | ||||
|   term->highlight_color = highlight_color; | ||||
| } | ||||
| 
 | ||||
| /* Turn on/off the cursor.  */ | ||||
|  | @ -353,14 +385,14 @@ static inline void | |||
| grub_term_setcursor (struct grub_term_output *term, int on) | ||||
| { | ||||
|   if (term->setcursor) | ||||
|     term->setcursor (on); | ||||
|     term->setcursor (term, on); | ||||
| } | ||||
| 
 | ||||
| static inline void  | ||||
| grub_term_cls (struct grub_term_output *term) | ||||
| { | ||||
|   if (term->cls) | ||||
|     (term->cls) (); | ||||
|     (term->cls) (term); | ||||
|   else | ||||
|     { | ||||
|       grub_putcode ('\n', term); | ||||
|  | @ -368,11 +400,36 @@ grub_term_cls (struct grub_term_output *term) | |||
|     } | ||||
| } | ||||
| 
 | ||||
| #ifdef HAVE_UNIFONT_WIDTHSPEC | ||||
| 
 | ||||
| grub_ssize_t | ||||
| grub_unicode_estimate_width (const struct grub_unicode_glyph *c); | ||||
| 
 | ||||
| #else | ||||
| 
 | ||||
| static inline grub_ssize_t | ||||
| grub_unicode_estimate_width (const struct grub_unicode_glyph *c __attribute__ ((unused))) | ||||
| { | ||||
|   if (grub_unicode_get_comb_type (c->base)) | ||||
|     return 0; | ||||
|   return 1; | ||||
| } | ||||
| 
 | ||||
| #endif | ||||
| 
 | ||||
| static inline grub_ssize_t  | ||||
| grub_term_getcharwidth (struct grub_term_output *term, grub_uint32_t c) | ||||
| grub_term_getcharwidth (struct grub_term_output *term, | ||||
| 			const struct grub_unicode_glyph *c) | ||||
| { | ||||
|   if (term->getcharwidth) | ||||
|     return term->getcharwidth (c); | ||||
|     return term->getcharwidth (term, c); | ||||
|   else if (((term->flags & GRUB_TERM_CODE_TYPE_MASK) | ||||
| 	    == GRUB_TERM_CODE_TYPE_UTF8_LOGICAL) | ||||
| 	   || ((term->flags & GRUB_TERM_CODE_TYPE_MASK) | ||||
| 	       == GRUB_TERM_CODE_TYPE_UTF8_VISUAL) | ||||
| 	   || ((term->flags & GRUB_TERM_CODE_TYPE_MASK) | ||||
| 	       == GRUB_TERM_CODE_TYPE_VISUAL_GLYPHS)) | ||||
|     return grub_unicode_estimate_width (c); | ||||
|   else | ||||
|     return 1; | ||||
| } | ||||
|  | @ -381,17 +438,10 @@ static inline void | |||
| grub_term_getcolor (struct grub_term_output *term,  | ||||
| 		    grub_uint8_t *normal_color, grub_uint8_t *highlight_color) | ||||
| { | ||||
|   if (term->getcolor) | ||||
|     term->getcolor (normal_color, highlight_color); | ||||
|   else | ||||
|     { | ||||
|       *normal_color = 0x07; | ||||
|       *highlight_color = 0x07; | ||||
|     } | ||||
|   *normal_color = term->normal_color; | ||||
|   *highlight_color = term->highlight_color; | ||||
| } | ||||
| 
 | ||||
| extern void (*EXPORT_VAR (grub_newline_hook)) (void); | ||||
| 
 | ||||
| struct grub_term_autoload | ||||
| { | ||||
|   struct grub_term_autoload *next; | ||||
|  |  | |||
|  | @ -23,15 +23,55 @@ | |||
| #include <grub/types.h> | ||||
| #include <grub/term.h> | ||||
| 
 | ||||
| char *grub_terminfo_get_current (void); | ||||
| grub_err_t grub_terminfo_set_current (const char *); | ||||
| char *EXPORT_FUNC(grub_terminfo_get_current) (struct grub_term_output *term); | ||||
| grub_err_t EXPORT_FUNC(grub_terminfo_set_current) (struct grub_term_output *term, | ||||
| 												const char *); | ||||
| 
 | ||||
| void grub_terminfo_gotoxy (grub_uint8_t x, grub_uint8_t y, | ||||
| 			   grub_term_output_t oterm); | ||||
| void grub_terminfo_cls (grub_term_output_t oterm); | ||||
| void grub_terminfo_reverse_video_on (grub_term_output_t oterm); | ||||
| void grub_terminfo_reverse_video_off (grub_term_output_t oterm); | ||||
| void grub_terminfo_cursor_on (grub_term_output_t oterm); | ||||
| void grub_terminfo_cursor_off (grub_term_output_t oterm); | ||||
| #define GRUB_TERMINFO_READKEY_MAX_LEN 4 | ||||
| struct grub_terminfo_input_state | ||||
| { | ||||
|   int input_buf[GRUB_TERMINFO_READKEY_MAX_LEN]; | ||||
|   int npending; | ||||
|   int (*readkey) (void); | ||||
| }; | ||||
| 
 | ||||
| struct grub_terminfo_output_state | ||||
| { | ||||
|   struct grub_term_output *next; | ||||
| 
 | ||||
|   char *name; | ||||
| 
 | ||||
|   char *gotoxy; | ||||
|   char *cls; | ||||
|   char *reverse_video_on; | ||||
|   char *reverse_video_off; | ||||
|   char *cursor_on; | ||||
|   char *cursor_off; | ||||
|   char *setcolor; | ||||
| 
 | ||||
|   unsigned int xpos, ypos; | ||||
| 
 | ||||
|   void (*put) (const int c); | ||||
| }; | ||||
| 
 | ||||
| void EXPORT_FUNC(grub_terminfo_gotoxy) (grub_term_output_t term, | ||||
| 					grub_uint8_t x, grub_uint8_t y); | ||||
| void EXPORT_FUNC(grub_terminfo_cls) (grub_term_output_t term); | ||||
| grub_uint16_t EXPORT_FUNC (grub_terminfo_getxy) (struct grub_term_output *term); | ||||
| void EXPORT_FUNC (grub_terminfo_setcursor) (struct grub_term_output *term, | ||||
| 					    const int on); | ||||
| void EXPORT_FUNC (grub_terminfo_setcolorstate) (struct grub_term_output *term, | ||||
| 				  const grub_term_color_state state); | ||||
| 
 | ||||
| 
 | ||||
| int EXPORT_FUNC (grub_terminfo_checkkey) (struct grub_term_input *term); | ||||
| grub_err_t EXPORT_FUNC (grub_terminfo_input_init) (struct grub_term_input *term); | ||||
| int EXPORT_FUNC (grub_terminfo_getkey) (struct grub_term_input *term); | ||||
| void EXPORT_FUNC (grub_terminfo_putchar) (struct grub_term_output *term, | ||||
| 					  const struct grub_unicode_glyph *c); | ||||
| 
 | ||||
| grub_err_t EXPORT_FUNC (grub_terminfo_output_register) (struct grub_term_output *term, | ||||
| 							const char *type); | ||||
| grub_err_t EXPORT_FUNC (grub_terminfo_output_unregister) (struct grub_term_output *term); | ||||
| 
 | ||||
| #endif /* ! GRUB_TERMINFO_HEADER */ | ||||
|  |  | |||
|  | @ -60,7 +60,7 @@ | |||
| typedef signed char		grub_int8_t; | ||||
| typedef short			grub_int16_t; | ||||
| typedef int			grub_int32_t; | ||||
| #if GRUB_CPU_SIZEOF_VOID_P == 8 | ||||
| #if GRUB_CPU_SIZEOF_LONG == 8 | ||||
| typedef long			grub_int64_t; | ||||
| #else | ||||
| typedef long long		grub_int64_t; | ||||
|  | @ -69,7 +69,7 @@ typedef long long		grub_int64_t; | |||
| typedef unsigned char		grub_uint8_t; | ||||
| typedef unsigned short		grub_uint16_t; | ||||
| typedef unsigned		grub_uint32_t; | ||||
| #if GRUB_CPU_SIZEOF_VOID_P == 8 | ||||
| #if GRUB_CPU_SIZEOF_LONG == 8 | ||||
| typedef unsigned long		grub_uint64_t; | ||||
| #else | ||||
| typedef unsigned long long	grub_uint64_t; | ||||
|  | @ -92,13 +92,21 @@ typedef grub_int32_t	grub_target_ssize_t; | |||
| typedef grub_uint64_t	grub_addr_t; | ||||
| typedef grub_uint64_t	grub_size_t; | ||||
| typedef grub_int64_t	grub_ssize_t; | ||||
| 
 | ||||
| # if GRUB_CPU_SIZEOF_LONG == 8 | ||||
| #  define PRIxGRUB_SIZE	"lx" | ||||
| # else | ||||
| #  define PRIxGRUB_SIZE	"llx" | ||||
| # endif | ||||
| #else | ||||
| typedef grub_uint32_t	grub_addr_t; | ||||
| typedef grub_uint32_t	grub_size_t; | ||||
| typedef grub_int32_t	grub_ssize_t; | ||||
| 
 | ||||
| # define PRIxGRUB_SIZE	"x" | ||||
| #endif | ||||
| 
 | ||||
| #if GRUB_CPU_SIZEOF_VOID_P == 8 | ||||
| #if GRUB_CPU_SIZEOF_LONG == 8 | ||||
| # define GRUB_ULONG_MAX 18446744073709551615UL | ||||
| # define GRUB_LONG_MAX 9223372036854775807L | ||||
| # define GRUB_LONG_MIN (-9223372036854775807L - 1) | ||||
|  |  | |||
							
								
								
									
										272
									
								
								include/grub/unicode.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										272
									
								
								include/grub/unicode.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,272 @@ | |||
| /*
 | ||||
|  *  GRUB  --  GRand Unified Bootloader | ||||
|  *  Copyright (C) 2010  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/>.
 | ||||
|  */ | ||||
| 
 | ||||
| #ifndef GRUB_BIDI_HEADER | ||||
| #define GRUB_BIDI_HEADER	1 | ||||
| 
 | ||||
| #include <grub/types.h> | ||||
| #include <grub/mm.h> | ||||
| #include <grub/misc.h> | ||||
| 
 | ||||
| struct grub_unicode_bidi_pair | ||||
| { | ||||
|   grub_uint32_t key; | ||||
|   grub_uint32_t replace; | ||||
| }; | ||||
| 
 | ||||
| struct grub_unicode_compact_range | ||||
| { | ||||
|   grub_uint32_t start:21; | ||||
|   grub_uint32_t end:21; | ||||
|   grub_uint8_t bidi_type:5; | ||||
|   grub_uint8_t comb_type; | ||||
|   grub_uint8_t bidi_mirror:1; | ||||
|   grub_uint8_t join_type:3; | ||||
| } __attribute__ ((packed)); | ||||
| 
 | ||||
| /* Old-style Arabic shaping. Used for "visual UTF-8" and
 | ||||
|    in grub-mkfont to find variant glyphs in absence of GPOS tables.  */ | ||||
| struct grub_unicode_arabic_shape | ||||
| { | ||||
|   grub_uint32_t code; | ||||
|   grub_uint32_t isolated; | ||||
|   grub_uint32_t right_linked; | ||||
|   grub_uint32_t both_linked; | ||||
|   grub_uint32_t left_linked; | ||||
| }; | ||||
| 
 | ||||
| extern struct grub_unicode_arabic_shape grub_unicode_arabic_shapes[]; | ||||
| 
 | ||||
| enum grub_bidi_type | ||||
|   { | ||||
|     GRUB_BIDI_TYPE_L = 0, | ||||
|     GRUB_BIDI_TYPE_LRE, | ||||
|     GRUB_BIDI_TYPE_LRO, | ||||
|     GRUB_BIDI_TYPE_R, | ||||
|     GRUB_BIDI_TYPE_AL, | ||||
|     GRUB_BIDI_TYPE_RLE, | ||||
|     GRUB_BIDI_TYPE_RLO, | ||||
|     GRUB_BIDI_TYPE_PDF, | ||||
|     GRUB_BIDI_TYPE_EN, | ||||
|     GRUB_BIDI_TYPE_ES, | ||||
|     GRUB_BIDI_TYPE_ET, | ||||
|     GRUB_BIDI_TYPE_AN, | ||||
|     GRUB_BIDI_TYPE_CS, | ||||
|     GRUB_BIDI_TYPE_NSM, | ||||
|     GRUB_BIDI_TYPE_BN, | ||||
|     GRUB_BIDI_TYPE_B, | ||||
|     GRUB_BIDI_TYPE_S, | ||||
|     GRUB_BIDI_TYPE_WS, | ||||
|     GRUB_BIDI_TYPE_ON | ||||
|   }; | ||||
| 
 | ||||
| enum grub_join_type | ||||
|   { | ||||
|     GRUB_JOIN_TYPE_NONJOINING = 0, | ||||
|     GRUB_JOIN_TYPE_LEFT = 1, | ||||
|     GRUB_JOIN_TYPE_RIGHT = 2, | ||||
|     GRUB_JOIN_TYPE_DUAL = 3, | ||||
|     GRUB_JOIN_TYPE_CAUSING = 4, | ||||
|     GRUB_JOIN_TYPE_TRANSPARENT = 5 | ||||
|   }; | ||||
| 
 | ||||
| enum grub_comb_type | ||||
|   { | ||||
|     GRUB_UNICODE_COMB_NONE = 0, | ||||
|     GRUB_UNICODE_COMB_OVERLAY = 1, | ||||
|     GRUB_UNICODE_COMB_HEBREW_SHEVA = 10, | ||||
|     GRUB_UNICODE_COMB_HEBREW_HATAF_SEGOL = 11, | ||||
|     GRUB_UNICODE_COMB_HEBREW_HATAF_PATAH = 12, | ||||
|     GRUB_UNICODE_COMB_HEBREW_HATAF_QAMATS = 13, | ||||
|     GRUB_UNICODE_COMB_HEBREW_HIRIQ = 14, | ||||
|     GRUB_UNICODE_COMB_HEBREW_TSERE = 15, | ||||
|     GRUB_UNICODE_COMB_HEBREW_SEGOL = 16, | ||||
|     GRUB_UNICODE_COMB_HEBREW_PATAH = 17, | ||||
|     GRUB_UNICODE_COMB_HEBREW_QAMATS = 18, | ||||
|     GRUB_UNICODE_COMB_HEBREW_HOLAM = 19, | ||||
|     GRUB_UNICODE_COMB_HEBREW_QUBUTS = 20, | ||||
|     GRUB_UNICODE_COMB_HEBREW_DAGESH = 21, | ||||
|     GRUB_UNICODE_COMB_HEBREW_METEG = 22, | ||||
|     GRUB_UNICODE_COMB_HEBREW_RAFE = 23, | ||||
|     GRUB_UNICODE_COMB_HEBREW_SHIN_DOT = 24, | ||||
|     GRUB_UNICODE_COMB_HEBREW_SIN_DOT = 25, | ||||
|     GRUB_UNICODE_COMB_HEBREW_VARIKA = 26, | ||||
|     GRUB_UNICODE_COMB_ARABIC_FATHATAN = 27, | ||||
|     GRUB_UNICODE_COMB_ARABIC_DAMMATAN = 28, | ||||
|     GRUB_UNICODE_COMB_ARABIC_KASRATAN = 29, | ||||
|     GRUB_UNICODE_COMB_ARABIC_FATHAH = 30, | ||||
|     GRUB_UNICODE_COMB_ARABIC_DAMMAH = 31, | ||||
|     GRUB_UNICODE_COMB_ARABIC_KASRA = 32, | ||||
|     GRUB_UNICODE_COMB_ARABIC_SHADDA = 33, | ||||
|     GRUB_UNICODE_COMB_ARABIC_SUKUN = 34, | ||||
|     GRUB_UNICODE_COMB_ARABIC_SUPERSCRIPT_ALIF = 35, | ||||
|     GRUB_UNICODE_COMB_SYRIAC_SUPERSCRIPT_ALAPH = 36, | ||||
|     GRUB_UNICODE_STACK_ATTACHED_BELOW = 202, | ||||
|     GRUB_UNICODE_STACK_ATTACHED_ABOVE = 214, | ||||
|     GRUB_UNICODE_COMB_ATTACHED_ABOVE_RIGHT = 216, | ||||
|     GRUB_UNICODE_STACK_BELOW = 220, | ||||
|     GRUB_UNICODE_COMB_BELOW_RIGHT = 222, | ||||
|     GRUB_UNICODE_COMB_ABOVE_LEFT = 228, | ||||
|     GRUB_UNICODE_STACK_ABOVE = 230, | ||||
|     GRUB_UNICODE_COMB_ABOVE_RIGHT = 232, | ||||
|     GRUB_UNICODE_COMB_YPOGEGRAMMENI = 240, | ||||
|     /* If combining nature is indicated only by class and
 | ||||
|        not "combining type".  */ | ||||
|     GRUB_UNICODE_COMB_ME = 253, | ||||
|     GRUB_UNICODE_COMB_MC = 254, | ||||
|     GRUB_UNICODE_COMB_MN = 255, | ||||
|   }; | ||||
| 
 | ||||
| /* This structure describes a glyph as opposed to character.  */ | ||||
| struct grub_unicode_glyph | ||||
| { | ||||
|   grub_uint32_t base; | ||||
|   grub_uint16_t variant:9; | ||||
|   grub_uint8_t attributes:5; | ||||
|   grub_size_t ncomb; | ||||
|   struct grub_unicode_combining { | ||||
|     grub_uint32_t code; | ||||
|     enum grub_comb_type type; | ||||
|   } *combining; | ||||
|   /* Hint by unicode subsystem how wide this character usually is.
 | ||||
|      Real width is determined by font. Set only in UTF-8 stream.  */ | ||||
|   int estimated_width; | ||||
| }; | ||||
| 
 | ||||
| #define GRUB_UNICODE_GLYPH_ATTRIBUTE_MIRROR 0x1 | ||||
| #define GRUB_UNICODE_GLYPH_ATTRIBUTES_JOIN_LEFT_TO_RIGHT_SHIFT 1 | ||||
| #define GRUB_UNICODE_GLYPH_ATTRIBUTE_LEFT_JOINED 0x2 | ||||
| #define GRUB_UNICODE_GLYPH_ATTRIBUTE_RIGHT_JOINED \ | ||||
|   (GRUB_UNICODE_GLYPH_ATTRIBUTE_LEFT_JOINED \ | ||||
|    << GRUB_UNICODE_GLYPH_ATTRIBUTES_JOIN_LEFT_TO_RIGHT_SHIFT) | ||||
| /* Set iff the corresponding joining flags come from ZWJ or ZWNJ.  */ | ||||
| #define GRUB_UNICODE_GLYPH_ATTRIBUTE_LEFT_JOINED_EXPLICIT 0x8 | ||||
| #define GRUB_UNICODE_GLYPH_ATTRIBUTE_RIGHT_JOINED_EXPLICIT \ | ||||
|   (GRUB_UNICODE_GLYPH_ATTRIBUTE_LEFT_JOINED_EXPLICIT \ | ||||
|    << GRUB_UNICODE_GLYPH_ATTRIBUTES_JOIN_LEFT_TO_RIGHT_SHIFT) | ||||
| #define GRUB_UNICODE_GLYPH_ATTRIBUTES_JOIN \ | ||||
|   (GRUB_UNICODE_GLYPH_ATTRIBUTE_LEFT_JOINED \ | ||||
|    | GRUB_UNICODE_GLYPH_ATTRIBUTE_RIGHT_JOINED \ | ||||
|    | GRUB_UNICODE_GLYPH_ATTRIBUTE_LEFT_JOINED_EXPLICIT \ | ||||
|    | GRUB_UNICODE_GLYPH_ATTRIBUTE_RIGHT_JOINED_EXPLICIT) | ||||
| 
 | ||||
| enum | ||||
|   { | ||||
|     GRUB_UNICODE_COMBINING_GRAPHEME_JOINER = 0x034f, | ||||
|     GRUB_UNICODE_HEBREW_WAW                = 0x05d5, | ||||
|     GRUB_UNICODE_ARABIC_START              = 0x0600, | ||||
|     GRUB_UNICODE_ARABIC_END                = 0x0700, | ||||
|     GRUB_UNICODE_THAANA_ABAFILI            = 0x07a6, | ||||
|     GRUB_UNICODE_THAANA_AABAAFILI          = 0x07a7, | ||||
|     GRUB_UNICODE_THAANA_IBIFILI            = 0x07a8, | ||||
|     GRUB_UNICODE_THAANA_EEBEEFILI          = 0x07a9, | ||||
|     GRUB_UNICODE_THAANA_UBUFILI            = 0x07aa, | ||||
|     GRUB_UNICODE_THAANA_OOBOOFILI          = 0x07ab, | ||||
|     GRUB_UNICODE_THAANA_EBEFILI            = 0x07ac, | ||||
|     GRUB_UNICODE_THAANA_EYBEYFILI          = 0x07ad, | ||||
|     GRUB_UNICODE_THAANA_OBOFILI            = 0x07ae, | ||||
|     GRUB_UNICODE_THAANA_OABOAFILI          = 0x07af, | ||||
|     GRUB_UNICODE_THAANA_SUKUN              = 0x07b0, | ||||
|     GRUB_UNICODE_ZWNJ                      = 0x200c, | ||||
|     GRUB_UNICODE_ZWJ                       = 0x200d, | ||||
|     GRUB_UNICODE_LEFTARROW                 = 0x2190, | ||||
|     GRUB_UNICODE_UPARROW                   = 0x2191, | ||||
|     GRUB_UNICODE_RIGHTARROW                = 0x2192, | ||||
|     GRUB_UNICODE_DOWNARROW                 = 0x2193, | ||||
|     GRUB_UNICODE_LIGHT_HLINE               = 0x2500, | ||||
|     GRUB_UNICODE_HLINE                     = 0x2501, | ||||
|     GRUB_UNICODE_LIGHT_VLINE               = 0x2502, | ||||
|     GRUB_UNICODE_VLINE                     = 0x2503, | ||||
|     GRUB_UNICODE_LIGHT_CORNER_UL           = 0x250c, | ||||
|     GRUB_UNICODE_CORNER_UL                 = 0x250f, | ||||
|     GRUB_UNICODE_LIGHT_CORNER_UR           = 0x2510, | ||||
|     GRUB_UNICODE_CORNER_UR                 = 0x2513, | ||||
|     GRUB_UNICODE_LIGHT_CORNER_LL           = 0x2514, | ||||
|     GRUB_UNICODE_CORNER_LL                 = 0x2517, | ||||
|     GRUB_UNICODE_LIGHT_CORNER_LR           = 0x2518, | ||||
|     GRUB_UNICODE_CORNER_LR                 = 0x251b, | ||||
|     GRUB_UNICODE_BLACK_UP_TRIANGLE         = 0x25b2, | ||||
|     GRUB_UNICODE_BLACK_RIGHT_TRIANGLE      = 0x25ba, | ||||
|     GRUB_UNICODE_BLACK_DOWN_TRIANGLE       = 0x25bc, | ||||
|     GRUB_UNICODE_BLACK_LEFT_TRIANGLE       = 0x25c4, | ||||
|     GRUB_UNICODE_VARIATION_SELECTOR_1      = 0xfe00, | ||||
|     GRUB_UNICODE_VARIATION_SELECTOR_16     = 0xfe0f, | ||||
|     GRUB_UNICODE_VARIATION_SELECTOR_17     = 0xe0100, | ||||
|     GRUB_UNICODE_VARIATION_SELECTOR_256    = 0xe01ef | ||||
|   }; | ||||
| 
 | ||||
| extern struct grub_unicode_compact_range grub_unicode_compact[]; | ||||
| extern struct grub_unicode_bidi_pair grub_unicode_bidi_pairs[]; | ||||
| 
 | ||||
| #define GRUB_UNICODE_MAX_CACHED_CHAR 0x20000 | ||||
| /*  Unicode mandates an arbitrary limit.  */ | ||||
| #define GRUB_BIDI_MAX_EXPLICIT_LEVEL 61 | ||||
| 
 | ||||
| grub_ssize_t | ||||
| grub_bidi_logical_to_visual (const grub_uint32_t *logical, | ||||
| 			     grub_size_t logical_len, | ||||
| 			     struct grub_unicode_glyph **visual_out, | ||||
| 			     grub_ssize_t (*getcharwidth) (const struct grub_unicode_glyph *visual), | ||||
| 			     grub_size_t max_width, | ||||
| 			     grub_size_t start_width); | ||||
| 
 | ||||
| enum grub_comb_type | ||||
| grub_unicode_get_comb_type (grub_uint32_t c); | ||||
| grub_size_t | ||||
| grub_unicode_aglomerate_comb (const grub_uint32_t *in, grub_size_t inlen, | ||||
| 			      struct grub_unicode_glyph *out); | ||||
| 
 | ||||
| static inline struct grub_unicode_glyph * | ||||
| grub_unicode_glyph_dup (const struct grub_unicode_glyph *in) | ||||
| { | ||||
|   struct grub_unicode_glyph *out = grub_malloc (sizeof (*out)); | ||||
|   if (!out) | ||||
|     return NULL; | ||||
|   grub_memcpy (out, in, sizeof (*in)); | ||||
|   if (in->combining) | ||||
|     { | ||||
|       out->combining = grub_malloc (in->ncomb * sizeof (*in)); | ||||
|       if (!out->combining) | ||||
| 	{ | ||||
| 	  grub_free (out); | ||||
| 	  return NULL; | ||||
| 	} | ||||
|       grub_memcpy (out->combining, in->combining, in->ncomb * sizeof (*in)); | ||||
|     } | ||||
|   return out; | ||||
| } | ||||
| 
 | ||||
| static inline struct grub_unicode_glyph * | ||||
| grub_unicode_glyph_from_code (grub_uint32_t code) | ||||
| { | ||||
|   struct grub_unicode_glyph *ret; | ||||
|   ret = grub_zalloc (sizeof (*ret)); | ||||
|   if (!ret) | ||||
|     return NULL; | ||||
| 
 | ||||
|   ret->base = code; | ||||
| 
 | ||||
|   return ret; | ||||
| } | ||||
| 
 | ||||
| grub_uint32_t | ||||
| grub_unicode_mirror_code (grub_uint32_t in); | ||||
| grub_uint32_t | ||||
| grub_unicode_shape_code (grub_uint32_t in, grub_uint8_t attr); | ||||
| 
 | ||||
| #endif | ||||
|  | @ -87,15 +87,17 @@ typedef struct grub_usb_transfer *grub_usb_transfer_t; | |||
| #define GRUB_USB_REQ_SET_INTERFACE	0x0B | ||||
| #define GRUB_USB_REQ_SYNC_FRAME		0x0C | ||||
| 
 | ||||
| #define GRUB_USB_REQ_HUB_GET_PORT_STATUS 0x00 | ||||
| 
 | ||||
| #define GRUB_USB_FEATURE_ENDP_HALT	0x00 | ||||
| #define GRUB_USB_FEATURE_DEV_REMOTE_WU	0x01 | ||||
| #define GRUB_USB_FEATURE_TEST_MODE	0x02 | ||||
| 
 | ||||
| #define GRUB_USB_HUB_STATUS_CONNECTED	(1 << 0) | ||||
| #define GRUB_USB_HUB_STATUS_LOWSPEED	(1 << 9) | ||||
| #define GRUB_USB_HUB_STATUS_HIGHSPEED	(1 << 10) | ||||
| #define GRUB_USB_HUB_FEATURE_PORT_RESET   0x04 | ||||
| #define GRUB_USB_HUB_FEATURE_PORT_POWER   0x08 | ||||
| 
 | ||||
| #define GRUB_USB_HUB_STATUS_CONNECTED	 (1 << 0) | ||||
| #define GRUB_USB_HUB_STATUS_LOWSPEED	 (1 << 9) | ||||
| #define GRUB_USB_HUB_STATUS_HIGHSPEED	 (1 << 10) | ||||
| #define GRUB_USB_HUB_STATUS_C_PORT_RESET (1 << 20) | ||||
| 
 | ||||
| struct grub_usb_packet_setup | ||||
| { | ||||
|  |  | |||
							
								
								
									
										195
									
								
								include/grub/vga.h
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										195
									
								
								include/grub/vga.h
									
										
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,195 @@ | |||
| /*
 | ||||
|  *  GRUB  --  GRand Unified Bootloader | ||||
|  *  Copyright (C) 2010  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/>.
 | ||||
|  */ | ||||
| 
 | ||||
| #ifndef GRUB_VGA_HEADER | ||||
| #define GRUB_VGA_HEADER	1 | ||||
| 
 | ||||
| enum | ||||
|   { | ||||
|     GRUB_VGA_IO_ARX = 0x3c0, | ||||
|     GRUB_VGA_IO_SR_INDEX = 0x3c4, | ||||
|     GRUB_VGA_IO_SR_DATA = 0x3c5, | ||||
|     GRUB_VGA_IO_PIXEL_MASK = 0x3c6, | ||||
|     GRUB_VGA_IO_PALLETTE_READ_INDEX = 0x3c7, | ||||
|     GRUB_VGA_IO_PALLETTE_WRITE_INDEX = 0x3c8, | ||||
|     GRUB_VGA_IO_PALLETTE_DATA = 0x3c9, | ||||
|     GRUB_VGA_IO_GR_INDEX = 0x3ce, | ||||
|     GRUB_VGA_IO_GR_DATA = 0x3cf, | ||||
|     GRUB_VGA_IO_CR_INDEX = 0x3d4, | ||||
|     GRUB_VGA_IO_CR_DATA = 0x3d5, | ||||
|     GRUB_VGA_IO_INPUT_STATUS1_REGISTER = 0x3da | ||||
|   }; | ||||
| 
 | ||||
| #define GRUB_VGA_IO_INPUT_STATUS1_VERTR_BIT 0x08 | ||||
| 
 | ||||
| enum | ||||
|   { | ||||
|     GRUB_VGA_CR_WIDTH = 0x01, | ||||
|     GRUB_VGA_CR_OVERFLOW = 0x07, | ||||
|     GRUB_VGA_CR_CELL_HEIGHT = 0x09, | ||||
|     GRUB_VGA_CR_CURSOR_START = 0x0a, | ||||
|     GRUB_VGA_CR_CURSOR_END = 0x0b, | ||||
|     GRUB_VGA_CR_START_ADDR_HIGH_REGISTER = 0x0c, | ||||
|     GRUB_VGA_CR_START_ADDR_LOW_REGISTER = 0x0d, | ||||
|     GRUB_VGA_CR_CURSOR_ADDR_HIGH = 0x0e, | ||||
|     GRUB_VGA_CR_CURSOR_ADDR_LOW = 0x0f, | ||||
|     GRUB_VGA_CR_VSYNC_END = 0x11, | ||||
|     GRUB_VGA_CR_HEIGHT = 0x12, | ||||
|     GRUB_VGA_CR_PITCH = 0x13, | ||||
|     GRUB_VGA_CR_MODE = 0x17, | ||||
|     GRUB_VGA_CR_LINE_COMPARE = 0x18, | ||||
|   }; | ||||
| 
 | ||||
| #define GRUB_VGA_CR_WIDTH_DIVISOR 8 | ||||
| #define GRUB_VGA_CR_OVERFLOW_HEIGHT1_SHIFT 7 | ||||
| #define GRUB_VGA_CR_OVERFLOW_HEIGHT1_MASK 0x02 | ||||
| #define GRUB_VGA_CR_OVERFLOW_HEIGHT2_SHIFT 3 | ||||
| #define GRUB_VGA_CR_OVERFLOW_HEIGHT2_MASK 0xc0 | ||||
| #define GRUB_VGA_CR_OVERFLOW_LINE_COMPARE_SHIFT 4 | ||||
| #define GRUB_VGA_CR_OVERFLOW_LINE_COMPARE_MASK 0x10 | ||||
| 
 | ||||
| #define GRUB_VGA_CR_CELL_HEIGHT_LINE_COMPARE_MASK 0x40 | ||||
| #define GRUB_VGA_CR_CELL_HEIGHT_LINE_COMPARE_SHIFT 3 | ||||
| 
 | ||||
| enum | ||||
|   { | ||||
|     GRUB_VGA_CR_CURSOR_START_DISABLE = (1 << 5) | ||||
|   }; | ||||
| 
 | ||||
| #define GRUB_VGA_CR_PITCH_DIVISOR 8 | ||||
| 
 | ||||
| enum | ||||
|   { | ||||
|     GRUB_VGA_CR_MODE_NO_CGA = 0x01, | ||||
|     GRUB_VGA_CR_MODE_NO_HERCULES = 0x02, | ||||
|     GRUB_VGA_CR_MODE_BYTE_MODE = 0x40, | ||||
|     GRUB_VGA_CR_MODE_TIMING_ENABLE = 0x80 | ||||
|   }; | ||||
| 
 | ||||
| enum | ||||
|   { | ||||
|     GRUB_VGA_SR_CLOCKING_MODE = 1, | ||||
|     GRUB_VGA_SR_MAP_MASK_REGISTER = 2, | ||||
|     GRUB_VGA_SR_MEMORY_MODE = 4, | ||||
|   }; | ||||
| 
 | ||||
| enum | ||||
|   { | ||||
|     GRUB_VGA_SR_CLOCKING_MODE_8_DOT_CLOCK = 1 | ||||
|   }; | ||||
| 
 | ||||
| enum | ||||
|   { | ||||
|     GRUB_VGA_SR_MEMORY_MODE_NORMAL = 0, | ||||
|     GRUB_VGA_SR_MEMORY_MODE_CHAIN4 = 8 | ||||
|   }; | ||||
| 
 | ||||
| enum | ||||
|   { | ||||
|     GRUB_VGA_GR_DATA_ROTATE = 3, | ||||
|     GRUB_VGA_GR_READ_MAP_REGISTER = 4, | ||||
|     GRUB_VGA_GR_MODE = 5, | ||||
|     GRUB_VGA_GR_GR6 = 6, | ||||
|     GRUB_VGA_GR_BITMASK = 8, | ||||
|     GRUB_VGA_GR_MAX | ||||
|   }; | ||||
| 
 | ||||
| enum | ||||
|   { | ||||
|     GRUB_VGA_TEXT_TEXT_PLANE = 0, | ||||
|     GRUB_VGA_TEXT_ATTR_PLANE = 1, | ||||
|     GRUB_VGA_TEXT_FONT_PLANE = 2 | ||||
|   }; | ||||
| 
 | ||||
| enum | ||||
|   { | ||||
|     GRUB_VGA_GR_GR6_GRAPHICS_MODE = 1, | ||||
|     GRUB_VGA_GR_GR6_MMAP_CGA = (3 << 2) | ||||
|   }; | ||||
| 
 | ||||
| enum | ||||
|   { | ||||
|     GRUB_VGA_GR_MODE_READ_MODE1 = 0x08, | ||||
|     GRUB_VGA_GR_MODE_ODD_EVEN = 0x10, | ||||
|     GRUB_VGA_GR_MODE_256_COLOR = 0x40 | ||||
|   }; | ||||
| 
 | ||||
| static inline void | ||||
| grub_vga_gr_write (grub_uint8_t val, grub_uint8_t addr) | ||||
| { | ||||
|   grub_outb (addr, GRUB_VGA_IO_GR_INDEX); | ||||
|   grub_outb (val, GRUB_VGA_IO_GR_DATA); | ||||
| } | ||||
| 
 | ||||
| static inline grub_uint8_t | ||||
| grub_vga_gr_read (grub_uint8_t addr) | ||||
| { | ||||
|   grub_outb (addr, GRUB_VGA_IO_GR_INDEX); | ||||
|   return grub_inb (GRUB_VGA_IO_GR_DATA); | ||||
| } | ||||
| 
 | ||||
| static inline void | ||||
| grub_vga_cr_write (grub_uint8_t val, grub_uint8_t addr) | ||||
| { | ||||
|   grub_outb (addr, GRUB_VGA_IO_CR_INDEX); | ||||
|   grub_outb (val, GRUB_VGA_IO_CR_DATA); | ||||
| } | ||||
| 
 | ||||
| static inline grub_uint8_t | ||||
| grub_vga_cr_read (grub_uint8_t addr) | ||||
| { | ||||
|   grub_outb (addr, GRUB_VGA_IO_CR_INDEX); | ||||
|   return grub_inb (GRUB_VGA_IO_CR_DATA); | ||||
| } | ||||
| 
 | ||||
| static inline void | ||||
| grub_vga_sr_write (grub_uint8_t val, grub_uint8_t addr) | ||||
| { | ||||
|   grub_outb (addr, GRUB_VGA_IO_SR_INDEX); | ||||
|   grub_outb (val, GRUB_VGA_IO_SR_DATA); | ||||
| } | ||||
| 
 | ||||
| static inline grub_uint8_t | ||||
| grub_vga_sr_read (grub_uint8_t addr) | ||||
| { | ||||
|   grub_outb (addr, GRUB_VGA_IO_SR_INDEX); | ||||
|   return grub_inb (GRUB_VGA_IO_SR_DATA); | ||||
| } | ||||
| 
 | ||||
| static inline void | ||||
| grub_vga_palette_read (grub_uint8_t addr, grub_uint8_t *r, grub_uint8_t *g, | ||||
| 		       grub_uint8_t *b) | ||||
| { | ||||
|   grub_outb (addr, GRUB_VGA_IO_PALLETTE_READ_INDEX); | ||||
|   *r = grub_inb (GRUB_VGA_IO_PALLETTE_DATA); | ||||
|   *g = grub_inb (GRUB_VGA_IO_PALLETTE_DATA); | ||||
|   *b = grub_inb (GRUB_VGA_IO_PALLETTE_DATA); | ||||
| } | ||||
| 
 | ||||
| static inline void | ||||
| grub_vga_palette_write (grub_uint8_t addr, grub_uint8_t r, grub_uint8_t g, | ||||
| 			grub_uint8_t b) | ||||
| { | ||||
|   grub_outb (addr, GRUB_VGA_IO_PALLETTE_WRITE_INDEX); | ||||
|   grub_outb (r, GRUB_VGA_IO_PALLETTE_DATA); | ||||
|   grub_outb (g, GRUB_VGA_IO_PALLETTE_DATA); | ||||
|   grub_outb (b, GRUB_VGA_IO_PALLETTE_DATA); | ||||
| } | ||||
| 
 | ||||
| 
 | ||||
| #endif | ||||
|  | @ -168,6 +168,15 @@ struct grub_video_rect | |||
| }; | ||||
| typedef struct grub_video_rect grub_video_rect_t; | ||||
| 
 | ||||
| struct grub_video_signed_rect | ||||
| { | ||||
|   signed x; | ||||
|   signed y; | ||||
|   unsigned width; | ||||
|   unsigned height; | ||||
| }; | ||||
| typedef struct grub_video_signed_rect grub_video_signed_rect_t; | ||||
| 
 | ||||
| struct grub_video_palette_data | ||||
| { | ||||
|   grub_uint8_t r; /* Red color value (0-255).  */ | ||||
|  | @ -183,9 +192,21 @@ typedef enum grub_video_driver_id | |||
|     GRUB_VIDEO_DRIVER_EFI_UGA, | ||||
|     GRUB_VIDEO_DRIVER_EFI_GOP, | ||||
|     GRUB_VIDEO_DRIVER_SM712, | ||||
|     GRUB_VIDEO_DRIVER_VGA | ||||
|     GRUB_VIDEO_DRIVER_VGA, | ||||
|     GRUB_VIDEO_DRIVER_CIRRUS, | ||||
|     GRUB_VIDEO_DRIVER_BOCHS, | ||||
|     GRUB_VIDEO_DRIVER_SDL | ||||
|   } grub_video_driver_id_t; | ||||
| 
 | ||||
| typedef enum grub_video_adapter_prio | ||||
|   { | ||||
|     GRUB_VIDEO_ADAPTER_PRIO_FALLBACK = 60, | ||||
|     GRUB_VIDEO_ADAPTER_PRIO_FIRMWARE_DIRTY = 70, | ||||
|     GRUB_VIDEO_ADAPTER_PRIO_FIRMWARE = 80, | ||||
|     GRUB_VIDEO_ADAPTER_PRIO_NATIVE = 100 | ||||
|   } grub_video_adapter_prio_t; | ||||
| 
 | ||||
| 
 | ||||
| struct grub_video_adapter | ||||
| { | ||||
|   /* The next video adapter.  */ | ||||
|  | @ -195,6 +216,8 @@ struct grub_video_adapter | |||
|   const char *name; | ||||
|   grub_video_driver_id_t id; | ||||
| 
 | ||||
|   grub_video_adapter_prio_t prio; | ||||
| 
 | ||||
|   /* Initialize the video adapter.  */ | ||||
|   grub_err_t (*init) (void); | ||||
| 
 | ||||
|  | @ -264,13 +287,18 @@ typedef struct grub_video_adapter *grub_video_adapter_t; | |||
| 
 | ||||
| extern grub_video_adapter_t EXPORT_VAR(grub_video_adapter_list); | ||||
| 
 | ||||
| #ifndef GRUB_LST_GENERATOR | ||||
| /* Register video driver.  */ | ||||
| static inline void | ||||
| grub_video_register (grub_video_adapter_t adapter) | ||||
| { | ||||
|   grub_list_push (GRUB_AS_LIST_P (&grub_video_adapter_list), | ||||
| 		  GRUB_AS_LIST (adapter)); | ||||
|   grub_video_adapter_t *p; | ||||
|   for (p = &grub_video_adapter_list; *p && (*p)->prio > adapter->prio;  | ||||
|        p = &((*p)->next)); | ||||
|   adapter->next = *p; | ||||
|   *p = adapter; | ||||
| } | ||||
| #endif | ||||
| 
 | ||||
| /* Unregister video driver.  */ | ||||
| static inline void | ||||
|  |  | |||
|  | @ -89,8 +89,8 @@ grub_video_fb_blit_bitmap (struct grub_video_bitmap *bitmap, | |||
| 
 | ||||
| grub_err_t | ||||
| grub_video_fb_blit_render_target (struct grub_video_fbrender_target *source, | ||||
|                                    enum grub_video_blit_operators oper, | ||||
|                                    int x, int y, int offset_x, int offset_y, | ||||
| 				  enum grub_video_blit_operators oper, | ||||
| 				  int x, int y, int offset_x, int offset_y, | ||||
| 				  unsigned int width, unsigned int height); | ||||
| 
 | ||||
| grub_err_t | ||||
|  | @ -119,11 +119,18 @@ typedef grub_err_t | |||
| (*grub_video_fb_doublebuf_update_screen_t) (struct grub_video_fbrender_target *front, | ||||
| 					  struct grub_video_fbrender_target *back); | ||||
| 
 | ||||
| typedef grub_err_t (*grub_video_fb_set_page_t) (int page); | ||||
| 
 | ||||
| grub_err_t | ||||
| grub_video_fb_doublebuf_blit_init (struct grub_video_fbrender_target **front, | ||||
| 				   struct grub_video_fbrender_target **back, | ||||
| 				   grub_video_fb_doublebuf_update_screen_t *update_screen, | ||||
| 				   struct grub_video_mode_info mode_info, | ||||
| 				   void *framebuf); | ||||
| grub_video_fb_setup (unsigned int mode_type, unsigned int mode_mask, | ||||
| 		     struct grub_video_mode_info *mode_info, | ||||
| 		     volatile void *page0_ptr, | ||||
| 		     grub_video_fb_set_page_t set_page_in, | ||||
| 		     volatile void *page1_ptr); | ||||
| grub_err_t | ||||
| grub_video_fb_swap_buffers (void); | ||||
| grub_err_t | ||||
| grub_video_fb_get_info_and_fini (struct grub_video_mode_info *mode_info, | ||||
| 				 void **framebuf); | ||||
| 
 | ||||
| #endif /* ! GRUB_VIDEO_FB_HEADER */ | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue