Merge mainline into yeeloongfw
This commit is contained in:
commit
b7e79e8a6a
155 changed files with 5949 additions and 2562 deletions
|
@ -2,7 +2,10 @@
|
|||
10_*
|
||||
30_os-prober
|
||||
40_custom
|
||||
41_custom
|
||||
aclocal.m4
|
||||
ascii.bitmaps
|
||||
ascii.h
|
||||
autom4te.cache
|
||||
build_env.mk
|
||||
.bzrignore
|
||||
|
@ -48,6 +51,8 @@ grub_script_check_init.c
|
|||
grub_script_check_init.h
|
||||
grub_script.tab.c
|
||||
grub_script.tab.h
|
||||
grub_script.yy.c
|
||||
grub_script.yy.h
|
||||
grub-set-default
|
||||
grub-setup
|
||||
grub_setup_init.c
|
||||
|
|
963
ChangeLog
963
ChangeLog
|
@ -1,3 +1,966 @@
|
|||
2010-06-28 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Use normal parser for menu entries.
|
||||
Reported by: Thomas Frauendorfer
|
||||
|
||||
* include/grub/parser.h (grub_parser_execute): Don't export.
|
||||
* normal/menu.c (grub_menu_execute_entry_real): New function.
|
||||
(grub_menu_execute_entry): Use grub_menu_execute_entry_real.
|
||||
|
||||
2010-06-28 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* docs/grub.texi (Embedded configuration): New section (replacing
|
||||
old "Preset Menu" stub).
|
||||
(Images): New section.
|
||||
(configfile): Note that any menu entries defined in `file' are shown
|
||||
immediately.
|
||||
|
||||
2010-06-28 Josh Triplett <josh@joshtriplett.org>
|
||||
|
||||
* mmap/i386/pc/mmap_helper.S: Set CF on return.
|
||||
|
||||
2010-06-28 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/grub-install.in: Add --debug-image= option.
|
||||
|
||||
2010-06-28 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
Change grub-mkdevicemap to emit /dev/disk/by-id/ names where
|
||||
possible on Linux.
|
||||
|
||||
* util/deviceiter.c (check_device): Rename to ...
|
||||
(check_device_readable_unique): ... this. Update all callers.
|
||||
Maintain and check a list of which devices (by canonicalized name)
|
||||
have already been seen.
|
||||
(clear_seen_devices): New function.
|
||||
(compare_file_names) [__linux__]: New function.
|
||||
(grub_util_iterate_devices): Clear the list of seen devices on exit
|
||||
and (just in case) on entry.
|
||||
(grub_util_iterate_devices) [__linux__]: Iterate over non-partition
|
||||
devices in /dev/disk/by-id/, in sorted order. Remove DM-RAID
|
||||
seen-devices list, superseded by general code in check_device.
|
||||
|
||||
2010-06-28 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* commands/cat.c (options): New variable.
|
||||
(grub_cmd_cat): Parse options. If the --dos option is given, print
|
||||
DOS-style "\r\n" line endings as simple newlines (Debian bug
|
||||
#586358).
|
||||
(GRUB_MOD_INIT): Use extcmd.
|
||||
(GRUB_MOD_FINI): Likewise.
|
||||
* docs/grub.texi (cat): Document --dos.
|
||||
|
||||
2010-06-28 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
XEN with Linux grub-mkconfig support.
|
||||
|
||||
* conf/common.rmk (grub-mkconfig_SCRIPTS) [linux]: Add 20_linux_xen.
|
||||
* util/grub-mkconfig.in: Export GRUB_CMDLINE_XEN and
|
||||
GRUB_CMDLINE_XEN_DEFAULT.
|
||||
* util/grub.d/20_linux_xen.in: New file.
|
||||
|
||||
2010-06-28 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Initialise VGA video on qemu ourselves.
|
||||
|
||||
* boot/i386/qemu/boot.S: Don't call 0xc000.
|
||||
* conf/i386-qemu.rmk (kern/i386/qemu/init.c_DEPENDENCIES): New variable.
|
||||
(kernel_img_SOURCES): Add kern/i386/qemu/init.c and bus/pci.c.
|
||||
(kernel_img_HEADERS): Add pci.h.
|
||||
* conf/i386.rmk (pkglib_MODULES) [qemu]: Remove pci.mod.
|
||||
* configure.ac: Force unifont on qemu and yeeloong.
|
||||
* include/grub/i386/qemu/kernel.h (grub_qemu_init_cirrus): New proto.
|
||||
(grub_vga_palette_write): Use correct register.
|
||||
* kern/i386/coreboot/init.c (grub_machine_init) [GRUB_MACHINE_QEMU]:
|
||||
Call grub_qemu_init_cirrus.
|
||||
* kern/i386/qemu/init.c: New file.
|
||||
* term/i386/pc/vga_text.c (inc_y): Never read outside the screen.
|
||||
|
||||
* commands/videotest.c (grub_cmd_videotest): Handle double buffering.
|
||||
|
||||
2010-06-26 Pavel Roskin <proski@gnu.org>
|
||||
|
||||
* util/grub.d/10_linux.in: Add support for initrd images on Fedora
|
||||
13.
|
||||
|
||||
2010-06-26 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* docs/grub.texi (Simple configuration): Explain that
|
||||
GRUB_DISABLE_LINUX_RECOVERY and GRUB_DISABLE_NETBSD_RECOVERY must be
|
||||
set to `true' to disable their respective recovery entries, not
|
||||
merely set.
|
||||
|
||||
2010-06-26 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
Make the `source' command slightly faster.
|
||||
|
||||
* normal/main.c (grub_normal_execute): Don't re-read list files when
|
||||
nested.
|
||||
|
||||
2010-06-23 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* loader/i386/multiboot_mbi.c (retrieve_video_parameters): Set red
|
||||
field position and mask size to red fields from mode_info, not
|
||||
green.
|
||||
* loader/multiboot_mbi2.c (retrieve_video_parameters): Likewise.
|
||||
Remove redundant tag->common.framebuffer_type assignment.
|
||||
Reported by: Seth Goldberg.
|
||||
|
||||
2010-06-23 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
Sync up other versions of the Linux loader with Robert Millan's
|
||||
change of 2010-01-09, "Make loader output a bit more user-friendly".
|
||||
|
||||
* loader/i386/efi/linux.c (grub_linux_boot): Move debug info to
|
||||
grub_dprintf().
|
||||
(grub_cmd_linux): Likewise.
|
||||
(grub_cmd_initrd): Likewise.
|
||||
* loader/i386/ieee1275/linux.c (grub_cmd_linux): Likewise.
|
||||
* loader/i386/pc/linux.c (grub_cmd_linux): Likewise.
|
||||
|
||||
2010-06-21 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* kern/efi/mm.c (grub_efi_mm_init): Handle systems with memory maps
|
||||
larger than MEMORY_MAP_SIZE.
|
||||
|
||||
2010-06-21 BVK Chaitanya <bvk.groups@gmail.com>
|
||||
|
||||
Fix parallel build.
|
||||
|
||||
* conf/common.rmk: Add grub_script.tab.h as a grub-script-check
|
||||
dependency.
|
||||
* script/parser.y: #include grub_script.tab.h header.
|
||||
|
||||
2010-06-20 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Support >3GiB and <16MiB RAM in i386-qemu.
|
||||
|
||||
* kern/i386/qemu/mmap.c (QEMU_CMOS_MEMSIZE2_HIGH): New const.
|
||||
(QEMU_CMOS_MEMSIZE2_LOW): Likewise.
|
||||
(grub_lower_mem): Removed.
|
||||
(grub_upper_mem): Likewise.
|
||||
(mem_size): Made static.
|
||||
(above_4g): New variable.
|
||||
(grub_machine_mmap_init): Detect small mem_size and above_4g.
|
||||
(grub_machine_mmap_iterate): Order in ascending order and add above_4g
|
||||
support.
|
||||
|
||||
2010-06-20 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Cirrus 5446 and Bochs video cards support.
|
||||
|
||||
* conf/i386.rmk (pkglib_MODULES): Add video_cirrus.mod and
|
||||
video_bochs.mod
|
||||
(video_cirrus_mod_SOURCES): New variable.
|
||||
(video_cirrus_mod_CFLAGS): Likewise.
|
||||
(video_cirrus_mod_LDFLAGS): Likewise.
|
||||
(video_bochs_mod_SOURCES): Likewise.
|
||||
(video_bochs_mod_CFLAGS): Likewise.
|
||||
(video_bochs_mod_LDFLAGS): Likewise.
|
||||
* include/grub/vga.h: New file.
|
||||
* include/grub/video_fb.h (grub_video_fb_doublebuf_blit_init): Removed.
|
||||
(grub_video_fb_set_page_t): New type.
|
||||
(grub_video_fb_setup): New prototype.
|
||||
(grub_video_fb_swap_buffers): Likewise.
|
||||
(grub_video_fb_get_info_and_fini): Likewise.
|
||||
* term/i386/pc/vga_text.c (CRTC_ADDR_PORT): Moved to include/grub/vga.h.
|
||||
(CRTC_DATA_PORT): Likewise.
|
||||
(CRTC_CURSOR): Likewise.
|
||||
(CRTC_CURSOR_ADDR_HIGH): Likewise.
|
||||
(CRTC_CURSOR_ADDR_LOW): Likewise.
|
||||
(CRTC_CURSOR_DISABLE): Likewise.
|
||||
(update_cursor): Use grub_vga_cr_write.
|
||||
(grub_vga_text_setcursor): Likewise.
|
||||
* video/bochs.c: New file.
|
||||
* video/fb/video_fb.c (render_target): Moved into framebuffer variable.
|
||||
(palette): Likewise.
|
||||
(palette_size): Likewise.
|
||||
(framebuffer): New variable.
|
||||
(grub_video_fb_init): Use 'framebuffer'.
|
||||
(grub_video_fb_fini): Likewise.
|
||||
(grub_video_fb_get_info): Likewise.
|
||||
(grub_video_fb_get_palette): Likewise.
|
||||
(grub_video_fb_set_palette): Likewise.
|
||||
(grub_video_fb_set_viewport): Likewise.
|
||||
(grub_video_fb_get_viewport): Likewise.
|
||||
(grub_video_fb_map_color): Likewise.
|
||||
(grub_video_fb_map_rgb): Likewise.
|
||||
(grub_video_fb_map_rgba): Likewise.
|
||||
(grub_video_fb_unmap_color): Likewise.
|
||||
(grub_video_fb_unmap_color_int): Likewise.
|
||||
(grub_video_fb_fill_rect): Likewise.
|
||||
(grub_video_fb_blit_bitmap): Likewise.
|
||||
(grub_video_fb_blit_render_target): Likewise.
|
||||
(grub_video_fb_scroll): Likewise.
|
||||
(grub_video_fb_create_render_target): Likewise.
|
||||
(grub_video_fb_doublebuf_blit_init): Likewise.
|
||||
(grub_video_fb_set_active_render_target): Handle doublebuffering.
|
||||
(doublebuf_pageflipping_update_screen): New function.
|
||||
(doublebuf_pageflipping_init): Likewise.
|
||||
(grub_video_fb_setup): Likewise.
|
||||
(grub_video_fb_swap_buffers): Likewise.
|
||||
(grub_video_fb_get_info_and_fini): Likewise.
|
||||
* video/i386/pc/vbe.c (framebuffer): Remove all doublebuffering fields.
|
||||
All users updated.
|
||||
(doublebuf_pageflipping_commit): Restructured into ...
|
||||
(doublebuf_pageflipping_set_page): ... this.
|
||||
(doublebuf_pageflipping_update_screen): Removed.
|
||||
(doublebuf_pageflipping_init): Likewise.
|
||||
(double_buffering_init): Likewise.
|
||||
(grub_video_vbe_setup): Use grub_video_fb_setup.
|
||||
(grub_video_vbe_swap_buffers): Removed.
|
||||
(grub_video_vbe_set_active_render_target): Likewise.
|
||||
(grub_video_vbe_get_active_render_target): Likewise.
|
||||
(grub_video_vbe_get_info_and_fini): Use grub_video_fb_get_info_and_fini.
|
||||
(grub_video_vbe_adapter): Use grub_video_fb_swap_buffers,
|
||||
grub_video_fb_set_active_render_target and
|
||||
grub_video_fb_get_active_render_target.
|
||||
* video/i386/pc/vga.c (SEQUENCER_ADDR_PORT): Move to include/grub/vga.h.
|
||||
(SEQUENCER_DATA_PORT): Likewise.
|
||||
(MAP_MASK_REGISTER): Likewise.
|
||||
(CRTC_ADDR_PORT): Likewise.
|
||||
(CRTC_DATA_PORT): Likewise.
|
||||
(START_ADDR_HIGH_REGISTER): Likewise.
|
||||
(START_ADDR_LOW_REGISTER): Likewise.
|
||||
(GRAPHICS_ADDR_PORT): Likewise.
|
||||
(GRAPHICS_DATA_PORT): Likewise.
|
||||
(READ_MAP_REGISTER): Likewise.
|
||||
(INPUT_STATUS1_REGISTER): Likewise.
|
||||
(INPUT_STATUS1_VERTR_BIT): Likewise.
|
||||
(get_map_mask): Use grub_vga_sr_read.
|
||||
(set_map_mask): Use grub_vga_sr_write.
|
||||
(set_read_map): Use grub_vga_gr_write.
|
||||
(set_start_address): Use grub_vga_cr_write.
|
||||
* video/sm712.c (framebuffer): Remove leftover fields.
|
||||
|
||||
2010-06-20 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/grub-mkconfig.in: Capitalise and export GRUB_PREFIX. Stop
|
||||
setting GRUB_VIDEO_BACKEND. Make it available as a user override
|
||||
instead. Replace the gfxterm backend check with a check that
|
||||
${GRUB_PREFIX}/video.lst is non-empty.
|
||||
* util/grub.d/00_header.in: Use GRUB_PREFIX rather than computing it
|
||||
again.
|
||||
(load_video): New generated function. Call it before loading
|
||||
gfxterm rather than loading ${GRUB_VIDEO_BACKEND}.
|
||||
* util/grub.d/10_linux.in (linux_entry): Call load_video.
|
||||
* util/grub.d/30_os-prober.in (osx_entry): Likewise.
|
||||
* docs/grub.texi (Simple configuration): Document
|
||||
GRUB_VIDEO_BACKEND.
|
||||
|
||||
2010-06-20 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Use video functions in linux and xnu loaders.
|
||||
|
||||
* conf/i386-pc.rmk (xnu_mod_SOURCES): Remove loader/i386/pc/xnu.c.
|
||||
* conf/x86-efi.rmk (xnu_mod_SOURCES): Remove loader/i386/efi/xnu.c.
|
||||
* include/grub/i386/xnu.h (grub_xnu_set_video): Removed.
|
||||
* loader/i386/efi/linux.c (grub_linux_setup_video): Copied from
|
||||
loader/i386/pc/linux.c.
|
||||
(grub_linux_boot): Resynced with loader/i386/pc/linux.c.
|
||||
(find_line_len): Removed.
|
||||
(find_framebuf): Likewise.
|
||||
(grub_cmd_linux): Declare grub_linux_boot as possibly returning.
|
||||
* loader/i386/efi/xnu.c: Removed.
|
||||
* loader/i386/pc/xnu.c: Moved from here...
|
||||
* loader/i386/xnu.c: ...here.
|
||||
|
||||
Enable priorities in video drivers.
|
||||
|
||||
* include/grub/video.h (grub_video_adapter_prio_t): New type.
|
||||
(grub_video_adapter): New field prio.
|
||||
(grub_video_register): Respect prio when inserting.
|
||||
* video/efi_gop.c (grub_video_gop_adapter): Add prio.
|
||||
* video/efi_uga.c (grub_video_uga_adapter): Likewise.
|
||||
* video/emu/sdl.c (grub_video_sdl_adapter): Likewise.
|
||||
* video/i386/pc/vbe.c (grub_video_vbe_adapter): Likewise.
|
||||
* video/i386/pc/vga.c (grub_video_vga_adapter): Likewise.
|
||||
* video/ieee1275.c (grub_video_ieee1275_adapter): Likewise.
|
||||
* video/sm712.c (grub_video_sm712_adapter): Likewise.
|
||||
|
||||
Fix SDL driver ID.
|
||||
|
||||
* include/grub/video.h (grub_video_driver_id_t): New value
|
||||
GRUB_VIDEO_DRIVER_SDL.
|
||||
* video/emu/sdl.c (grub_video_sdl_adapter): Add id.
|
||||
|
||||
2010-06-17 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/i386/pc/grub-setup.c (usage): Pass an extra `program_name'
|
||||
argument to printf.
|
||||
* util/sparc64/ieee1275/grub-setup.c (usage): Likewise.
|
||||
|
||||
2010-06-17 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/i386/pc/grub-setup.c (usage): Fix syntax error.
|
||||
* util/sparc64/ieee1275/grub-setup.c (usage): Likewise.
|
||||
|
||||
2010-06-17 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/i386/pc/grub-setup.c (usage): Warn against running grub-setup
|
||||
directly, and recommend grub-install instead.
|
||||
* util/sparc64/ieee1275/grub-setup.c (usage): Likewise.
|
||||
|
||||
2010-06-17 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
Fix i386-pc prefix handling with nested partitions (Debian bug
|
||||
#585068). Note that the case where the core image is booted using
|
||||
multiboot and relocated from its original location still requires
|
||||
more work.
|
||||
|
||||
* kern/i386/pc/init.c (make_install_device): If the prefix starts
|
||||
with "(,", fill the boot drive in between those two characters, but
|
||||
expect that a full partition specification including partition map
|
||||
names will follow.
|
||||
* util/i386/pc/grub-setup.c (setup): Unless an explicit prefix was
|
||||
specified, write a prefix without the drive name but including a
|
||||
full partition specification.
|
||||
|
||||
2010-06-16 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/grub-mkconfig.in: Ignore non-option arguments, for
|
||||
compatibility with older versions (before 2010-06-12) which did the
|
||||
same. In particular, this makes it easier to ship an update-grub
|
||||
wrapper which is compatible with that used with GRUB Legacy (Debian
|
||||
bug #586056).
|
||||
|
||||
2010-06-14 Grégoire Sutre <gregoire.sutre@gmail.com>
|
||||
|
||||
* Makefile.in (install-local): Use $$file.h2m instead of $$dest.h2m
|
||||
for manual page generation.
|
||||
|
||||
2010-06-14 Grégoire Sutre <gregoire.sutre@gmail.com>
|
||||
|
||||
* po/POTFILES: Remove leftover commands/handler.c.
|
||||
|
||||
2010-06-14 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/grub-mkconfig.in: Remove vestige of old argument parsing that
|
||||
left this script non-functional.
|
||||
|
||||
2010-06-14 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* docs/man/grub-emu.h2m: New file.
|
||||
|
||||
2010-06-13 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* docs/grub.texi (Commands): Document reduced command set in rescue
|
||||
mode.
|
||||
(cpuid): New section.
|
||||
|
||||
2010-06-13 Grégoire Sutre <gregoire.sutre@gmail.com>
|
||||
|
||||
* kern/emu/hostdisk.c (grub_util_biosdisk_get_grub_dev): Use the
|
||||
new partition naming style.
|
||||
* util/grub-install.in: Adapt sed subtitutions in grub-probe calls.
|
||||
|
||||
2010-06-12 BVK Chaitanya <bvk.groups@gmail.com>
|
||||
|
||||
Add "-o grub.iso" like cmdline options support.
|
||||
|
||||
* util/grub-install.in: Improve cmdline option parsing.
|
||||
* util/grub-mkconfig.in: Likewise.
|
||||
* util/grub-mkrescue.in: Likewise.
|
||||
* util/grub-reboot.in: Likewise.
|
||||
* util/grub-set-default.in: Likewise.
|
||||
* util/i386/efi/grub-install.in: Likewise.
|
||||
* util/ieee1275/grub-install.in: Likewise.
|
||||
* util/powerpc/ieee1275/grub-mkrescue.in: Likewise.
|
||||
|
||||
2010-06-12 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* .bzrignore: Ignore 41_custom.
|
||||
|
||||
2010-06-12 Thomas Schmitt <scdbackup@gmx.net>
|
||||
|
||||
* util/grub-mkrescue.in: Pass unrecognized options to xorriso.
|
||||
|
||||
2010-06-12 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
Avoid false positives in fs.lst, partmap.lst, and video.lst due to
|
||||
prototype declarations.
|
||||
|
||||
* genmk.rb (PModule::rule): Define GRUB_LST_GENERATOR when
|
||||
generating fs, partmap, and video lists.
|
||||
* include/grub/fs.h (grub_fs_register): Omit prototype if
|
||||
GRUB_LST_GENERATOR is defined.
|
||||
* include/grub/partition.h (grub_partition_map_register): Likewise.
|
||||
* include/grub/video.h (grub_video_register): Likewise.
|
||||
|
||||
2010-06-12 Javier Martín <lordhabbit@gmail.com>
|
||||
|
||||
* include/grub/types.h: Check for GRUB_CPU_SIZEOF_LONG when appropriate.
|
||||
|
||||
2010-06-12 Thomas Schmitt <scdbackup@gmx.net>
|
||||
|
||||
* util/grub-mkrescue.in: Support --xorriso argument.
|
||||
|
||||
2010-06-12 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* util/grub-mkrescue.in: Use -graft-points instead of -pathspecs.
|
||||
Suggested by: Thomas Schmitt.
|
||||
|
||||
2010-06-12 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* util/grub-mkrescue.in: Add --sort-weight arguments to xorriso.
|
||||
Suggested by: Thomas Schmitt.
|
||||
|
||||
2010-06-12 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
custom.cfg support.
|
||||
|
||||
* conf/common.rmk (grub-mkconfig_SCRIPTS): Add 41_custom.
|
||||
* util/grub.d/41_custom.in: New file.
|
||||
|
||||
2010-06-12 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/grub-mkrescue.in (make_image): Remove sh module, which has
|
||||
been merged back into normal.
|
||||
|
||||
2010-06-11 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* include/grub/efi/uga_draw.h (GRUB_EFI_UGA_GLT_MAX): Rename to ...
|
||||
(GRUB_EFI_UGA_BLT_MAX): ... this (typo fix).
|
||||
|
||||
2010-06-11 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* Makefile.in (install-local): Include $(srcdir)/docs/man/$$dest.h2m
|
||||
when generating manual pages.
|
||||
* docs/man/grub-bin2h.h2m: New file.
|
||||
* docs/man/grub-editenv.h2m: New file.
|
||||
* docs/man/grub-fstest.h2m: New file.
|
||||
* docs/man/grub-install.h2m: New file.
|
||||
* docs/man/grub-macho2img.h2m: New file.
|
||||
* docs/man/grub-mkconfig.h2m: New file.
|
||||
* docs/man/grub-mkdevicemap.h2m: New file.
|
||||
* docs/man/grub-mkfont.h2m: New file.
|
||||
* docs/man/grub-mkimage.h2m: New file.
|
||||
* docs/man/grub-mkpasswd-pbkdf2.h2m: New file.
|
||||
* docs/man/grub-mkrelpath.h2m: New file.
|
||||
* docs/man/grub-mkrescue.h2m: New file.
|
||||
* docs/man/grub-ofpathname.h2m: New file.
|
||||
* docs/man/grub-pe2elf.h2m: New file.
|
||||
* docs/man/grub-probe.h2m: New file.
|
||||
* docs/man/grub-reboot.h2m: New file.
|
||||
* docs/man/grub-script-check.h2m: New file.
|
||||
* docs/man/grub-set-default.h2m: New file.
|
||||
* docs/man/grub-setup.h2m: New file.
|
||||
|
||||
2010-06-10 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Use FOR_* macros instead of *_iterate whenever possible.
|
||||
|
||||
* commands/handler.c: Removed.
|
||||
* commands/help.c (grub_cmd_help): Use FOR_COMMANDS.
|
||||
* commands/minicmd.c (grub_mini_cmd_lsmod): Use FOR_DL_MODULES.
|
||||
* conf/any-emu.rmk (kernel_img_SOURCES): Remove kern/handler.c.
|
||||
* conf/common.rmk (script/lexer.c_DEPENDENCIES): Add grub_script.yy.h.
|
||||
(grub_probe_SOURCES): Remove kern/parser.c.
|
||||
(util/grub-script-check.c_DEPENDENCIES): Removed.
|
||||
(grub_script_check_SOURCES): Remove kern/handler.c, kern/parser.c
|
||||
and grub_script_check_init.c.
|
||||
(grub_script_check_init.lst): Removed.
|
||||
(grub_script_check_init.h): Likewise.
|
||||
(grub_script_check_init.c): Likewise.
|
||||
(pkglib_MODULES): Remove handler.mod and sh.mod.
|
||||
(handler_mod_SOURCES): Removed.
|
||||
(handler_mod_CFLAGS): Likewise.
|
||||
(handler_mod_LDFLAGS): Likewise.
|
||||
(normal_mod_SOURCES): Remove normal/handler.c.
|
||||
Add script/main.c, script/script.c, script/execute.c,
|
||||
script/function.c, script/lexer.c, grub_script.tab.c
|
||||
and grub_script.yy.c.
|
||||
* conf/i386-coreboot.rmk (kernel_img_SOURCES): Remove kern/handler.c.
|
||||
* conf/i386-ieee1275.rmk (kernel_img_SOURCES): Likewise.
|
||||
* conf/i386-pc.rmk (kernel_img_SOURCES): Likewise.
|
||||
(grub_setup_SOURCES): Remove kern/parser.c.
|
||||
* conf/i386-qemu.rmk (kernel_img_SOURCES): Remove kern/handler.c.
|
||||
* conf/mips-qemu-mips.rmk (kernel_img_SOURCES): Likewise.
|
||||
* conf/mips-yeeloong.rmk (kernel_img_SOURCES): Likewise.
|
||||
* conf/powerpc-ieee1275.rmk (kernel_img_SOURCES): Likewise.
|
||||
* conf/sparc64-ieee1275.rmk (kernel_img_SOURCES): Likewise.
|
||||
(grub_setup_SOURCES): Remove kern/parser.c.
|
||||
* conf/x86-efi.rmk (kernel_img_SOURCES): Remove kern/handler.c.
|
||||
* gettext/gettext.c (grub_gettext_delete_list): Don't use grub_list_pop.
|
||||
* include/grub/command.h (grub_command_iterate): Removed.
|
||||
(FOR_COMMANDS): New macro.
|
||||
* include/grub/dl.h (grub_dl): New member next.
|
||||
(grub_dl_iterate): Removed.
|
||||
(grub_dl_head): New variable declaration.
|
||||
(FOR_DL_MODULES): New macro.
|
||||
* include/grub/fs.h: Include list.h.
|
||||
(grub_fs): Make next first element.
|
||||
(grub_fs_list): New variable declaration.
|
||||
(grub_fs_register): Make inline.
|
||||
(grub_fs_unregister): Likewise.
|
||||
(grub_fs_iterate): Removed.
|
||||
(FOR_FILESYSTEMS): New macro.
|
||||
* include/grub/handler.h: Removed.
|
||||
* include/grub/list.h (grub_list_hook_t): Removed.
|
||||
(grub_list_test_t): Likewise.
|
||||
(grub_list_pop): Likewise.
|
||||
(grub_list_iterate): Likewise.
|
||||
(grub_list_insert): Likewise.
|
||||
(FOR_LIST_ELEMENTS): New macro.
|
||||
* include/grub/parser.h (grub_parser_class): Removed.
|
||||
(grub_parser_register): Likewise.
|
||||
(grub_parser_unregister): Likewise.
|
||||
(grub_parser_get_current): Likewise.
|
||||
(grub_parser_set_current): Likewise.
|
||||
(grub_register_rescue_parser): Likewise.
|
||||
(grub_rescue_parse_line): New function.
|
||||
* include/grub/partition.h (FOR_PARTITION_MAPS): Use FOR_LIST_ELEMENTS.
|
||||
* include/grub/script_sh.h (grub_script_function_list): New variable
|
||||
declaration.
|
||||
(FOR_SCRIPT_FUNCTIONS): New macro.
|
||||
(grub_script_function_iterate): Removed.
|
||||
(grub_normal_parse_line): New prototype.
|
||||
* include/grub/term.h (FOR_ACTIVE_TERM_INPUTS): Use FOR_LIST_ELEMENTS.
|
||||
(FOR_DISABLED_TERM_INPUTS): Likewise.
|
||||
(FOR_ACTIVE_TERM_OUTPUTS): Likewise.
|
||||
(FOR_DISABLED_TERM_OUTPUTS): Likewise.
|
||||
* include/grub/video.h (grub_video_adapter): Move 'next' to first
|
||||
element.
|
||||
(grub_video_register): Inline.
|
||||
(grub_video_unregister): Likewise.
|
||||
(grub_video_adapter_list): New variable declaration.
|
||||
(grub_video_iterate): Removed.
|
||||
(FOR_VIDEO_ADAPTERS): New macro.
|
||||
* kern/dl.c (grub_dl_list): Removed. All users updated.
|
||||
(grub_dl_iterate): Removed.
|
||||
* kern/fs.c (grub_fs_list): Make global.
|
||||
(grub_fs_register): Removed.
|
||||
(grub_fs_unregister): Likewise.
|
||||
(grub_fs_iterate): Likewise.
|
||||
* kern/handler.c: Removed.
|
||||
* kern/list.c (grub_list_pop): Removed.
|
||||
(grub_list_iterate): Likewise.
|
||||
(grub_list_insert): Likewise.
|
||||
(grub_named_list_find): Use FOR_LIST_ELEMENTS.
|
||||
(grub_prio_list_insert): Don't use grub_list_insert.
|
||||
* kern/main.c (grub_register_rescue_parser): Don't call
|
||||
grub_register_rescue_parser.
|
||||
* kern/parser.c (grub_parser_class): Removed.
|
||||
(grub_parser_execute): Use grub_rescue_parse_line.
|
||||
* kern/rescue_parser.c (grub_rescue_parse_line): Make global.
|
||||
(grub_rescue_parser): Removed.
|
||||
(grub_register_rescue_parser): Likewise.
|
||||
* kern/rescue_reader.c (grub_rescue_run): Use grub_rescue_parse_line.
|
||||
* normal/auth.c (is_authenticated): Use FOR_LIST_ELEMENTS.
|
||||
(grub_auth_check_authentication): Likewise.
|
||||
* normal/completion.c (iterate_command): Removed.
|
||||
(grub_normal_do_completion): Use FOR_COMMANDS.
|
||||
* normal/handler.c: Removed.
|
||||
* normal/main.c (read_config_file): Remove parser changing.
|
||||
(grub_normal_execute): Don't call read_handler_list.
|
||||
(grub_normal_read_line_real): Statically allocate prompt.
|
||||
(grub_cmdline_run): Use grub_normal_parse_line.
|
||||
(GRUB_MOD_FINI): Don't call free_handler_list.
|
||||
* normal/menu_entry.c (run): Likewise.
|
||||
* script/function.c (grub_script_function_list): Make global.
|
||||
(grub_script_function_iterate): Removed.
|
||||
* script/main.c (grub_normal_parse_line): Make global.
|
||||
(grub_sh_parser): Removed.
|
||||
(GRUB_MOD_INIT): Likewise.
|
||||
(GRUB_MOD_FINI): Likewise.
|
||||
* tests/lib/functional_test.c (grub_functional_test): Use
|
||||
FOR_LIST_ELEMENTS.
|
||||
* tests/lib/test.c (free_failures): Don't use grub_list_pop.
|
||||
(grub_test_run): Use FOR_LIST_ELEMENTS.
|
||||
* tests/lib/unit_test.c (main): Likewise.
|
||||
* util/deviceiter.c (grub_util_iterate_devices): Don't use
|
||||
grub_list_pop.
|
||||
* util/grub-fstest.c (grub_term_input_class): Removed.
|
||||
(grub_term_output_class): Likewise.
|
||||
* util/grub-probe.c: Likewise.
|
||||
* util/i386/pc/grub-setup.c: Likewise.
|
||||
* util/sparc64/ieee1275/grub-setup.c: Likewise.
|
||||
* util/grub-script-check.c (main): Don't call grub_init_all and
|
||||
grub_fini_all.
|
||||
* video/video.c (grub_video_adapter_list): Make global.
|
||||
(grub_video_register): Removed.
|
||||
(grub_video_unregister): Likewise.
|
||||
(grub_video_iterate): Likewise.
|
||||
|
||||
2010-06-09 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* docs/grub.texi (Vendor power-on button): Add Asus EeePC 1005PE as
|
||||
reported by Henrique Ferreiro.
|
||||
|
||||
2010-06-09 Robert Millan <rmh@gnu.org>
|
||||
|
||||
* util/grub.d/10_linux.in: Prefer compressed images over non-compressed
|
||||
ones, when both are available.
|
||||
|
||||
2010-06-08 Grégoire Sutre <gregoire.sutre@gmail.com>
|
||||
|
||||
Make --version uniform and avoid hard-coded program name.
|
||||
|
||||
* util/grub-mkimage.c (main): Use `program_name' instead of
|
||||
hard-coded string.
|
||||
* util/i386/pc/grub-setup.c (main): Likewise.
|
||||
* util/sparc64/ieee1275/grub-setup.c (parse_options): Likewise.
|
||||
* util/grub-install.in: Save the basename of $0 in $self, and use the
|
||||
latter in informational messages. Use the same format for --version
|
||||
as the binary programs.
|
||||
* util/grub-mkconfig.in: Likewise.
|
||||
* util/grub-mkrescue.in: Likewise.
|
||||
* util/grub-reboot.in: Likewise.
|
||||
* util/grub-set-default.in: Likewise.
|
||||
* util/i386/efi/grub-install.in: Likewise.
|
||||
* util/ieee1275/grub-install.in: Likewise.
|
||||
* util/powerpc/ieee1275/grub-mkrescue.in: Likewise.
|
||||
|
||||
2010-06-08 Grégoire Sutre <gregoire.sutre@gmail.com>
|
||||
|
||||
* util/i386/pc/grub-setup.c (setup): Use absolute offsets for start of
|
||||
embedding area. Use <= instead of == when checking for non-emptiness.
|
||||
|
||||
2010-06-08 Grégoire Sutre <gregoire.sutre@gmail.com>
|
||||
|
||||
* configure.ac: Add `.' to the directories searched for unifont.
|
||||
|
||||
2010-06-08 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* .bzrignore: Add ascii.bitmaps, ascii.h, grub_script.yy.c, and
|
||||
grub_script.yy.h.
|
||||
|
||||
2010-06-08 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* docs/grub.texi (History): Expand to cover GRUB 2.
|
||||
(Serial terminal): Refer to `terminal_input' and `terminal_output'
|
||||
commands, not `terminal'.
|
||||
(serial): Likewise.
|
||||
(terminal_input): New section.
|
||||
(terminal_output): New section.
|
||||
(uppermem): New section (stub).
|
||||
(Obtaining and Building GRUB): Refer to Bazaar, not Subversion.
|
||||
|
||||
2010-06-08 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* docs/grub.texi (Security): Menu entries are unrestricted by
|
||||
default, not restricted to superusers as I had previously thought.
|
||||
Reword to account for this.
|
||||
|
||||
2010-06-07 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* kern/emu/misc.c (device_mapper_null_log): New function.
|
||||
(grub_device_mapper_supported): New function.
|
||||
* include/grub/emu/misc.h (grub_device_mapper_supported): Add
|
||||
prototype.
|
||||
* kern/emu/hostdisk.c (find_partition_start): Check whether
|
||||
device-mapper is supported before trying to use it.
|
||||
* util/deviceiter.c (grub_util_iterate_devices): Likewise.
|
||||
|
||||
2010-06-07 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* docs/grub.texi (Naming convention): Use GRUB 2 syntax.
|
||||
(File name syntax): Likewise.
|
||||
(help): --all is no longer supported in GRUB 2. Be more precise
|
||||
about pattern matching.
|
||||
|
||||
2010-06-07 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* normal/completion.c (grub_normal_do_completion): When completing
|
||||
arguments to "set" and the current word contains an equals sign,
|
||||
skip to after the equals sign before starting completion.
|
||||
|
||||
2010-06-07 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* fs/i386/pc/pxe.c (grub_pxe_open): Fix parsing of gateway_ip.
|
||||
|
||||
2010-06-07 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* docs/grub.texi (Network): New section.
|
||||
(Device syntax): The network device is called `(pxe)' in GRUB 2, not
|
||||
`(nd)' as in GRUB Legacy.
|
||||
(pxe_unload): New section.
|
||||
|
||||
2010-06-07 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* docs/grub.texi (Troubleshooting): `echo' is not usually available
|
||||
in the rescue shell, so recommend using `set' instead. Thanks,
|
||||
Jordan Uggla.
|
||||
|
||||
2010-06-07 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* docs/grub.texi (Filesystem): Refer to `search' instead of `find'.
|
||||
(password): New section.
|
||||
(password_pbkdf2): New section.
|
||||
(search): New section.
|
||||
(Security): New section.
|
||||
(Troubleshooting): New section, currently very incomplete.
|
||||
(Invoking grub-mkpasswd-pbkdf2): New section.
|
||||
(Internals): New section, currently very incomplete.
|
||||
|
||||
2010-06-07 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/grub.d/00_header.in: Add some more quoting (of
|
||||
"${prev_saved_entry}" and "${boot_once}") needed to make savedefault
|
||||
work again.
|
||||
Reported by: Mario 'BitKoenig' Holbe (Debian bug #584812).
|
||||
|
||||
2010-06-07 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/grub-mkpasswd-pbkdf2.c (main): Rename top-level `c' variable
|
||||
to `count', fixing variable shadowing that broke the -c option.
|
||||
|
||||
2010-06-05 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/grub.d/00_header.in: Quote values assigned to `saved_entry',
|
||||
in case they contain spaces.
|
||||
|
||||
2010-06-04 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/grub-mkconfig_lib.in (prepare_grub_to_access_device): Prepend
|
||||
"part_" to partmap module names, in line with grub-install.
|
||||
Reported by: Jindřich Makovička (Debian bug #584426).
|
||||
|
||||
2010-06-04 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/grub-mkimage.c: Make target-related error messages slightly
|
||||
more helpful; -O talks about "format". Explicitly point to the use
|
||||
of -O if no target is specified.
|
||||
Reported by: Didier Raboud (Debian bug #584415).
|
||||
|
||||
2010-06-03 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* INSTALL: Document several build requirements for optional features
|
||||
(libdevmapper, ncurses, libusb, SDL, FreeType, GNU Unifont).
|
||||
|
||||
2010-06-02 Grégoire Sutre <gregoire.sutre@gmail.com>
|
||||
|
||||
* kern/emu/hostdisk.c (convert_system_partition_to_system_disk)
|
||||
[__NetBSD__]: Handle all device names matching /dev/r[a-z]+[0-9][a-z].
|
||||
(find_partition_start) [__NetBSD__]: Correct error messages for NetBSD.
|
||||
|
||||
2010-06-02 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* docs/grub.texi (Simple configuration): Fix copy-and-paste typo.
|
||||
Thanks to Jordan Uggla for spotting this.
|
||||
|
||||
2010-06-02 Aleš Nesrsta <starous@volny.cz>
|
||||
|
||||
Finally make USB usable.
|
||||
|
||||
* bus/usb/ohci.c (grub_ohci_reg_t): Add missing values.
|
||||
(GRUB_OHCI_RHUB_PORT_POWER_MASK): New macro.
|
||||
(GRUB_OHCI_RHUB_PORT_ALL_POWERED): Likewise.
|
||||
(GRUB_OHCI_REG_FRAME_INTERVAL_FSMPS_MASK): Likewise.
|
||||
(GRUB_OHCI_REG_FRAME_INTERVAL_FSMPS_SHIFT): Likewise.
|
||||
(GRUB_OHCI_REG_FRAME_INTERVAL_FI_SHIFT): Likewise.
|
||||
(GRUB_OHCI_FSMPS): Likewise.
|
||||
(GRUB_OHCI_PERIODIC_START): Likewise.
|
||||
(GRUB_OHCI_FRAME_INTERVAL): Likewise.
|
||||
(GRUB_OHCI_SET_PORT_ENABLE): Likewise.
|
||||
(GRUB_OHCI_CLEAR_PORT_ENABLE): Likewise.
|
||||
(GRUB_OHCI_SET_PORT_RESET): Likewise.
|
||||
(GRUB_OHCI_SET_PORT_RESET_STATUS_CHANGE): Likewise.
|
||||
* bus/usb/ohci.c (grub_ohci_pci_iter): Various important fixups.
|
||||
(grub_ohci_transaction): Likewise.
|
||||
(grub_ohci_transfer): Improve condition detection algorithms.
|
||||
Handle toggle property. Program the transactions correctly.
|
||||
Improve error handling. Various important fixups.
|
||||
(grub_ohci_portstatus): Put register writes in right order.
|
||||
* bus/usb/uhci.c (grub_free_queue): Compute last_trans.
|
||||
(grub_uhci_transfer): Don't show "failed" message on success.
|
||||
* bus/usb/usb.c (grub_usb_set_configuration): Zero-fill whole "toggle"
|
||||
array.
|
||||
(grub_usb_device_initialize): Read first 8 bytes of descriptor to
|
||||
determine its size.
|
||||
* bus/usb/usbtrans.c (grub_usb_control_msg): Use descdev.maxsize0 even
|
||||
before initialization is completed. Use IN direction for empty
|
||||
transfers. Use last_trans and compute toggle.
|
||||
* include/grub/usbtrans.h (grub_usb_transfer): New field last_trans.
|
||||
(GRUB_USB_FEATURE_ENDP_HALT): Correct the value.
|
||||
(GRUB_USB_FEATURE_DEV_REMOTE_WU): Likewise.
|
||||
(GRUB_USB_FEATURE_TEST_MODE): Likewise.
|
||||
* include/grub/usb.h (grub_usb_err_t): New value GRUB_USB_ERR_UNRECOVERABLE.
|
||||
(grub_usb_device): Increase toggle to 256.
|
||||
(grub_usbms_subclass_t): New values GRUB_USBMS_SUBCLASS_RBC,
|
||||
GRUB_USBMS_SUBCLASS_MMC2, GRUB_USBMS_SUBCLASS_UFI and
|
||||
GRUB_USBMS_SUBCLASS_SFF8070.
|
||||
* include/grub/scsicmd.h (grub_scsi_test_unit_ready): New structure.
|
||||
(grub_scsi_inquiry): New member page and alloc_length.
|
||||
(grub_scsi_request_sense): New structure.
|
||||
(grub_scsi_request_sense_data): Likewise.
|
||||
(grub_scsi_read_capacity): New fields logical_block_addr, PMI and
|
||||
control.
|
||||
* disk/scsi.c (grub_scsi_request_sense): New function.
|
||||
(grub_scsi_test_unit_ready): Likewise.
|
||||
(grub_scsi_inquiry): Fill new fields.
|
||||
(grub_scsi_read_capacity): Likewise.
|
||||
(grub_scsi_read10): Add request sense at the end.
|
||||
(grub_scsi_read12): Likewise.
|
||||
(grub_scsi_write10): Likewise.
|
||||
(grub_scsi_write12): Likewise.
|
||||
(grub_scsi_open): Add Test Unit Ready.
|
||||
* disk/usbms.c (grub_usbms_finddevs): Check configcnt.
|
||||
Support additional subclasses. Con't clear halt yet. Activate the
|
||||
proper config. Calculate LUNs correctly.
|
||||
(grub_usbms_transfer): Various important fixups.
|
||||
|
||||
2010-06-02 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* bus/pci.c (grub_pci_iterate) [GRUB_MACHINE_MIPS_YEELOONG]: Skip ghosts.
|
||||
* bus/usb/ohci.c (grub_ohci_portstatus): Handle R/WC correctly.
|
||||
(grub_ohci_fini_hw): New function.
|
||||
(grub_ohci_restore_hw): Likewise.
|
||||
(GRUB_MOD_INIT(ohci)): Register preboot hook.
|
||||
(GRUB_MOD_FINI(ohci)): Shutdown OHCI.
|
||||
* term/usb_keyboard.c: Remove include of grub/machine/console.h.
|
||||
|
||||
2010-06-02 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
Dedicated DMA allocations.
|
||||
|
||||
* bus/pci.c (grub_memalign_dma32): New function
|
||||
(grub_dma_free): Likewise.
|
||||
(grub_dma_get_virt): Likewise.
|
||||
(grub_dma_get_phys): Likewise.
|
||||
* bus/usb/ohci.c (grub_ohci): New members hcca_addr and hcca_chunk.
|
||||
(grub_ohci_pci_iter): Use dma32_alloc.
|
||||
(grub_ohci_transfer): Likewise.
|
||||
* bus/usb/usbtrans.c (grub_usb_control_msg): Likewise.
|
||||
(grub_usb_bulk_readwrite): Likewise.
|
||||
* include/grub/pci.h: Add declarations.
|
||||
|
||||
2010-06-02 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
CS5536 support.
|
||||
|
||||
* bus/cs5536.c: New file.
|
||||
* bus/usb/ohci.c (grub_ohci_pci_iter): Check for CS5536.
|
||||
* conf/i386.rmk (pkglib_MODULES): Add cs5536.mod.
|
||||
(cs5536_mod_SOURCES): New variable.
|
||||
(cs5536_mod_CFLAGS): Likewise.
|
||||
(cs5536_mod_LDFLAGS): Likewise.
|
||||
* conf/mips-yeeloong.rmk (kernel_img_HEADERS): Add cs5536.h and
|
||||
machine/pci.h.
|
||||
(kernel_img_SOURCES): Add bus/cs5536.c.
|
||||
(pkglib_MODULES): Add usb.mod, usbtest.mod, ohci.mod, usbms.mod and
|
||||
usb_keyboard.mod.
|
||||
(usb_mod_SOURCES): New variable.
|
||||
(usb_mod_CFLAGS): New variable.
|
||||
(usb_mod_LDFLAGS): New variable.
|
||||
(usbtest_mod_SOURCES): New variable.
|
||||
(usbtest_mod_CFLAGS): New variable.
|
||||
(usbtest_mod_LDFLAGS): New variable.
|
||||
(ohci_mod_SOURCES): New variable.
|
||||
(ohci_mod_CFLAGS): New variable.
|
||||
(ohci_mod_LDFLAGS): New variable.
|
||||
(usbms_mod_SOURCES): New variable.
|
||||
(usbms_mod_CFLAGS): New variable.
|
||||
(usbms_mod_LDFLAGS): New variable.
|
||||
(usb_keyboard_mod_SOURCES): New variable.
|
||||
(usb_keyboard_mod_CFLAGS): New variable.
|
||||
(usb_keyboard_mod_LDFLAGS): New variable.
|
||||
* include/grub/smbus.h: New file.
|
||||
* include/grub/cs5536.h: New file.
|
||||
|
||||
2010-06-02 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* util/grub.d/00_header.in: Add safety check to make sure that
|
||||
${locale_dir} exists before trying to probe it.
|
||||
|
||||
2010-06-02 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* docs/grub.texi (SCO UnixWare): Remove, at Vladimir's request and
|
||||
per the GNU Coding Standards; this is now too obscure to be worth
|
||||
documenting.
|
||||
(QNX): Likewise.
|
||||
(chainloader): Remove cross-reference to `SCO UnixWare'.
|
||||
|
||||
2010-06-02 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* docs/grub.texi (Chain-loading): New section.
|
||||
(DOS/Windows): New section, borrowed from GRUB Legacy with details
|
||||
adjusted for GRUB 2.
|
||||
(SCO UnixWare): Likewise.
|
||||
(QNX): Likewise.
|
||||
(chainloader): Add reference to `Block list syntax'.
|
||||
(drivemap): New section.
|
||||
(parttool): New section.
|
||||
|
||||
2010-06-02 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* docs/grub.texi (GNU GRUB manual): Remove reference to `Invoking
|
||||
the grub shell'.
|
||||
(Installation): Add reference to `Making a GRUB bootable CD-ROM'.
|
||||
(Installing GRUB using grub-install): Remove reference to the grub
|
||||
shell; mention `grub-mkimage' and `grub-setup' instead.
|
||||
(Invoking grub-install): Likewise.
|
||||
(Interface): Add reference to `Menu entry editor'.
|
||||
(serial): Remove `--device' option.
|
||||
|
||||
2010-06-02 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* docs/grub.texi (Configuration): New section, documenting
|
||||
configuration file generation using grub-mkconfig. I've left a slot
|
||||
for documenting the full shell scripting format but have not yet
|
||||
started on writing that up.
|
||||
(Invoking grub-mkconfig): New section.
|
||||
|
||||
2010-06-02 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* docs/grub.texi (direntry): Remove grub-terminfo reference.
|
||||
(GNU GRUB manual): Likewise.
|
||||
(General commands): Update description of `terminfo' for GRUB 2.
|
||||
|
||||
2010-06-02 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* commands/gptsync.c (grub_cmd_gptsync): Fix typos.
|
||||
(GRUB_MOD_INIT): Fix capitalisation.
|
||||
* docs/grub.texi (Command-line and menu entry commands): Document
|
||||
gettext and gptsync commands.
|
||||
|
||||
2010-06-02 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* conf/any-emu.rmk (kernel_img_SOURCES) [!x86]: Include
|
||||
kern/$(target_cpu)/cache.S even if TARGET_NO_MODULES = yes.
|
||||
|
||||
2010-06-01 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
Add btrfs probing support, currently only in the single-device case.
|
||||
|
||||
* kern/emu/getroot.c (find_root_device_from_mountinfo): New
|
||||
function.
|
||||
(grub_guess_root_device): Call find_root_device_from_mountinfo
|
||||
before looking in /dev.
|
||||
|
||||
2010-05-31 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* disk/i386/pc/biosdisk.c (grub_biosdisk_open): Use
|
||||
GRUB_DISK_SIZE_UNKNOWN.
|
||||
* disk/ieee1275/ofdisk.c (grub_ofdisk_open): Likewise.
|
||||
|
||||
2010-05-31 Jiro SEKIBA <jir@unicus.jp>
|
||||
|
||||
* include/grub/disk.h (GRUB_DISK_SIZE_UNKNOWN): New macro.
|
||||
* fs/nilfs.c: Support 2nd super block in case 1st one is accidently
|
||||
corrupted or not synced properly.
|
||||
|
||||
2010-05-31 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* normal/main.c (grub_normal_add_menu_entry): Avoid going out of args.
|
||||
Reported by: Seth Goldberg.
|
||||
|
||||
2010-05-31 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* loader/multiboot_mbi2.c (grub_multiboot_make_mbi): Fix incorrect
|
||||
addition of dest.
|
||||
Reported by: Seth Goldberg.
|
||||
|
||||
2010-05-31 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* commands/setpci.c (grub_setpci_iter): Fix an incorrect function check.
|
||||
Reported by: Seth Goldberg.
|
||||
|
||||
2010-05-31 Vladimir Serbinenko <phcoder@gmail.com>
|
||||
|
||||
* loader/multiboot_elfxx.c (grub_multiboot_load_elfXX) [__mips]: Check
|
||||
64-bit address as signed on MIPS.
|
||||
|
||||
2010-05-28 Colin Watson <cjwatson@ubuntu.com>
|
||||
|
||||
* configure.ac: AC_PROG_LEX sets LEX to ":" if lex is missing, not
|
||||
|
|
15
INSTALL
15
INSTALL
|
@ -19,6 +19,21 @@ configuring the GRUB.
|
|||
* Flex 2.5.35 or later
|
||||
* Other standard GNU/Unix tools
|
||||
|
||||
On GNU/Linux, you also need:
|
||||
|
||||
* libdevmapper (recommended)
|
||||
|
||||
To build grub-emu, you need:
|
||||
|
||||
* ncurses
|
||||
* libusb (recommended)
|
||||
* SDL (recommended)
|
||||
|
||||
To build GRUB's graphical terminal (gfxterm), you need:
|
||||
|
||||
* FreeType 2 or later
|
||||
* GNU Unifont
|
||||
|
||||
If you use a development snapshot or want to hack on GRUB you may
|
||||
need the following.
|
||||
|
||||
|
|
|
@ -323,26 +323,26 @@ install-local: all
|
|||
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
||||
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
||||
$(INSTALL_PROGRAM) $$dir$$file $(DESTDIR)$(bindir)/$$dest; \
|
||||
$(HELP2MAN) --section=1 -o $(DESTDIR)$(mandir)/man1/$$dest.1 $(builddir)/$$file; \
|
||||
$(HELP2MAN) --section=1 -i $(srcdir)/docs/man/$$file.h2m -o $(DESTDIR)$(mandir)/man1/$$dest.1 $(builddir)/$$file; \
|
||||
done
|
||||
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(mandir)/man8
|
||||
@list='$(sbin_UTILITIES)'; for file in $$list; do \
|
||||
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
||||
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
||||
$(INSTALL_PROGRAM) $$dir$$file $(DESTDIR)$(sbindir)/$$dest; \
|
||||
$(HELP2MAN) --section=8 -o $(DESTDIR)$(mandir)/man8/$$dest.8 $(builddir)/$$file; \
|
||||
$(HELP2MAN) --section=8 -i $(srcdir)/docs/man/$$file.h2m -o $(DESTDIR)$(mandir)/man8/$$dest.8 $(builddir)/$$file; \
|
||||
done
|
||||
@list='$(bin_SCRIPTS)'; for file in $$list; do \
|
||||
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
||||
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
||||
$(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(bindir)/$$dest; \
|
||||
$(HELP2MAN) --section=1 -o $(DESTDIR)$(mandir)/man1/$$dest.1 $(builddir)/$$file; \
|
||||
$(HELP2MAN) --section=1 -i $(srcdir)/docs/man/$$file.h2m -o $(DESTDIR)$(mandir)/man1/$$dest.1 $(builddir)/$$file; \
|
||||
done
|
||||
@list='$(sbin_SCRIPTS)'; for file in $$list; do \
|
||||
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
||||
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
||||
$(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(sbindir)/$$dest; \
|
||||
$(HELP2MAN) --section=8 -o $(DESTDIR)$(mandir)/man8/$$dest.8 $(builddir)/$$file; \
|
||||
$(HELP2MAN) --section=8 -i $(srcdir)/docs/man/$$file.h2m -o $(DESTDIR)$(mandir)/man8/$$dest.8 $(builddir)/$$file; \
|
||||
done
|
||||
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/grub.d
|
||||
@list='$(grub-mkconfig_SCRIPTS)'; for file in $$list; do \
|
||||
|
|
|
@ -36,9 +36,6 @@ VARIABLE(grub_core_entry_addr)
|
|||
.long 0
|
||||
1:
|
||||
|
||||
/* Process VGA rom. */
|
||||
call $0xc000, $0x3
|
||||
|
||||
/* Set up %ds, %ss, and %es. */
|
||||
xorw %ax, %ax
|
||||
movw %ax, %ds
|
||||
|
|
|
@ -21,7 +21,8 @@
|
|||
#include <grub/pci.h>
|
||||
#include <grub/mm.h>
|
||||
|
||||
#if GRUB_TARGET_SIZEOF_VOID_P == 4
|
||||
/* FIXME: correctly support 64-bit architectures. */
|
||||
/* #if GRUB_TARGET_SIZEOF_VOID_P == 4 */
|
||||
struct grub_pci_dma_chunk *
|
||||
grub_memalign_dma32 (grub_size_t align, grub_size_t size)
|
||||
{
|
||||
|
@ -33,7 +34,7 @@ grub_dma_free (struct grub_pci_dma_chunk *ch)
|
|||
{
|
||||
grub_free (ch);
|
||||
}
|
||||
#endif
|
||||
/* #endif */
|
||||
|
||||
#ifdef GRUB_MACHINE_MIPS_YEELOONG
|
||||
volatile void *
|
||||
|
@ -58,7 +59,7 @@ grub_dma_get_virt (struct grub_pci_dma_chunk *ch)
|
|||
grub_uint32_t
|
||||
grub_dma_get_phys (struct grub_pci_dma_chunk *ch)
|
||||
{
|
||||
return (grub_uint32_t) ch;
|
||||
return (grub_uint32_t) (grub_addr_t) ch;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
|
188
bus/usb/ohci.c
188
bus/usb/ohci.c
|
@ -116,6 +116,11 @@ typedef enum
|
|||
#define GRUB_OHCI_PERIODIC_START 0x257f
|
||||
#define GRUB_OHCI_FRAME_INTERVAL 0x2edf
|
||||
|
||||
#define GRUB_OHCI_SET_PORT_ENABLE (1 << 1)
|
||||
#define GRUB_OHCI_CLEAR_PORT_ENABLE (1 << 0)
|
||||
#define GRUB_OHCI_SET_PORT_RESET (1 << 4)
|
||||
#define GRUB_OHCI_SET_PORT_RESET_STATUS_CHANGE (1 << 20)
|
||||
|
||||
static grub_uint32_t
|
||||
grub_ohci_readreg32 (struct grub_ohci *o, grub_ohci_reg_t reg)
|
||||
{
|
||||
|
@ -280,7 +285,7 @@ grub_ohci_pci_iter (grub_pci_device_t dev,
|
|||
|
||||
/* Misc. pre-sets. */
|
||||
o->hcca->donehead = 0;
|
||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_INTSTATUS, (1 << 1)); /* Clears WDH */
|
||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_INTSTATUS, 0x7f); /* Clears everything */
|
||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CONTROLHEAD, 0);
|
||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CONTROLCURR, 0);
|
||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_BULKHEAD, 0);
|
||||
|
@ -333,10 +338,8 @@ grub_ohci_pci_iter (grub_pci_device_t dev,
|
|||
return 0;
|
||||
|
||||
fail:
|
||||
#ifndef GRUB_MACHINE_MIPS_YEELOONG
|
||||
if (o)
|
||||
grub_free ((void *) o->hcca);
|
||||
#endif
|
||||
grub_dma_free (o->hcca_chunk);
|
||||
grub_free (o);
|
||||
|
||||
return 0;
|
||||
|
@ -395,8 +398,10 @@ grub_ohci_transaction (grub_ohci_td_t td,
|
|||
break;
|
||||
}
|
||||
|
||||
#if 0 /* Always generate interrupt */
|
||||
/* Generate no interrupts. */
|
||||
token |= 7 << 21;
|
||||
#endif
|
||||
|
||||
/* Set the token. */
|
||||
token |= toggle << 24;
|
||||
|
@ -443,9 +448,12 @@ grub_ohci_transfer (grub_usb_controller_t dev,
|
|||
grub_uint32_t status;
|
||||
grub_uint32_t control;
|
||||
grub_usb_err_t err;
|
||||
int i, j;
|
||||
int i;
|
||||
grub_uint64_t maxtime;
|
||||
int err_timeout = 0;
|
||||
int err_unrec = 0;
|
||||
grub_uint32_t intstatus;
|
||||
grub_uint32_t tderr_addr = 0;
|
||||
|
||||
/* Allocate an Endpoint Descriptor. */
|
||||
ed_chunk = grub_memalign_dma32 (256, sizeof (*ed));
|
||||
|
@ -478,11 +486,13 @@ grub_ohci_transfer (grub_usb_controller_t dev,
|
|||
+ (i + 1) * sizeof (td_list[0]));
|
||||
}
|
||||
|
||||
#if 0 /* Better will be enable interrupt on all TDs. */
|
||||
/* The last-1 TD token we should change to enable interrupt when TD finishes.
|
||||
* As OHCI interrupts are disabled, it does only setting of WDH bit in
|
||||
* HcInterruptStatus register - and that is what we want to safely detect
|
||||
* normal end of all transactions. */
|
||||
td_list[transfer->transcnt - 1].token &= ~(7 << 21);
|
||||
#endif
|
||||
|
||||
td_list[transfer->transcnt].token = 0;
|
||||
td_list[transfer->transcnt].buffer = 0;
|
||||
|
@ -550,9 +560,14 @@ grub_ohci_transfer (grub_usb_controller_t dev,
|
|||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_BULKHEAD, ed_addr);
|
||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_BULKCURR, 0);
|
||||
|
||||
#define GRUB_OHCI_REG_CONTROL_BULK_ENABLE (1 << 5)
|
||||
#define GRUB_OHCI_REG_CONTROL_CONTROL_ENABLE (1 << 4)
|
||||
|
||||
/* Enable the Bulk list. */
|
||||
control = grub_ohci_readreg32 (o, GRUB_OHCI_REG_CONTROL);
|
||||
control |= 1 << 5;
|
||||
control |= GRUB_OHCI_REG_CONTROL_BULK_ENABLE;
|
||||
control &= ~GRUB_OHCI_REG_CONTROL_CONTROL_ENABLE;
|
||||
|
||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CONTROL, control);
|
||||
|
||||
/* Set BulkListFilled. */
|
||||
|
@ -565,12 +580,15 @@ grub_ohci_transfer (grub_usb_controller_t dev,
|
|||
|
||||
case GRUB_USB_TRANSACTION_TYPE_CONTROL:
|
||||
{
|
||||
grub_dprintf ("ohci", "add to control list\n");
|
||||
|
||||
/* Set ControlList Head and Current */
|
||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CONTROLHEAD, ed_addr);
|
||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CONTROLCURR, 0);
|
||||
|
||||
/* Enable the Control list. */
|
||||
control |= 1 << 4;
|
||||
control |= GRUB_OHCI_REG_CONTROL_CONTROL_ENABLE;
|
||||
control &= ~GRUB_OHCI_REG_CONTROL_BULK_ENABLE;
|
||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CONTROL, control);
|
||||
|
||||
/* Set ControlListFilled. */
|
||||
|
@ -581,9 +599,11 @@ grub_ohci_transfer (grub_usb_controller_t dev,
|
|||
}
|
||||
|
||||
grub_dprintf ("ohci", "wait for completion\n");
|
||||
grub_dprintf ("ohci", "control=0x%02x status=0x%02x\n",
|
||||
grub_dprintf ("ohci", "begin: control=0x%02x status=0x%02x\n",
|
||||
grub_ohci_readreg32 (o, GRUB_OHCI_REG_CONTROL),
|
||||
grub_ohci_readreg32 (o, GRUB_OHCI_REG_CMDSTATUS));
|
||||
grub_dprintf ("ohci","intstatus=0x%02x\n",
|
||||
grub_ohci_readreg32 (o, GRUB_OHCI_REG_INTSTATUS));
|
||||
|
||||
/* Safety measure to avoid a hang. */
|
||||
maxtime = grub_get_time_ms () + 1000;
|
||||
|
@ -591,30 +611,34 @@ grub_ohci_transfer (grub_usb_controller_t dev,
|
|||
/* Wait until the transfer is completed or STALLs. */
|
||||
do
|
||||
{
|
||||
grub_cpu_idle ();
|
||||
/* Check transfer status */
|
||||
intstatus = grub_ohci_readreg32 (o, GRUB_OHCI_REG_INTSTATUS);
|
||||
if ((intstatus & 0x2) != 0)
|
||||
{
|
||||
grub_dprintf ("ohci", "Current HccaDoneHead=0x%08x\n",
|
||||
o->hcca->donehead);
|
||||
/* Remember last successful TD */
|
||||
tderr_addr = grub_le_to_cpu32 (o->hcca->donehead) & ~0xf;
|
||||
/* Reset DoneHead */
|
||||
o->hcca->donehead = 0;
|
||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_INTSTATUS, (1 << 1));
|
||||
/* if TD is last, finish */
|
||||
if (tderr_addr == td_list_addr
|
||||
+ sizeof (td_list[0]) * (transfer->transcnt - 1))
|
||||
break;
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((intstatus & 0x10) != 0)
|
||||
{ /* Unrecoverable error - only reset can help...! */
|
||||
err_unrec = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
/* Detected a HALT. */
|
||||
if (grub_le_to_cpu32 (ed->td_head) & 1)
|
||||
break;
|
||||
|
||||
if ((grub_ohci_readreg32 (o, GRUB_OHCI_REG_INTSTATUS) & 0x2) != 0)
|
||||
{
|
||||
if ((grub_le_to_cpu32 (o->hcca->donehead) & ~0xf)
|
||||
== td_list_addr + (transfer->transcnt - 1) * sizeof (td_list[0]))
|
||||
break;
|
||||
|
||||
/* Done Head can be updated on some another place if ED is halted. */
|
||||
if (grub_le_to_cpu32 (ed->td_head) & 1)
|
||||
break;
|
||||
|
||||
/* If there is not HALT in ED, it is not correct, so debug it, reset
|
||||
* donehead and WDH and continue waiting. */
|
||||
grub_dprintf ("ohci", "Incorrect HccaDoneHead=0x%08x\n",
|
||||
o->hcca->donehead);
|
||||
o->hcca->donehead = 0;
|
||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_INTSTATUS, (1 << 1));
|
||||
continue;
|
||||
}
|
||||
/* Timeout ? */
|
||||
if (grub_get_time_ms () > maxtime)
|
||||
{
|
||||
|
@ -627,32 +651,83 @@ grub_ohci_transfer (grub_usb_controller_t dev,
|
|||
|
||||
if ((ed->td_head & ~0xf) == (ed->td_tail & ~0xf))
|
||||
break;
|
||||
|
||||
grub_cpu_idle ();
|
||||
}
|
||||
while (1);
|
||||
|
||||
grub_dprintf ("ohci", "end: control=0x%02x status=0x%02x\n",
|
||||
grub_ohci_readreg32 (o, GRUB_OHCI_REG_CONTROL),
|
||||
grub_ohci_readreg32 (o, GRUB_OHCI_REG_CMDSTATUS));
|
||||
grub_dprintf ("ohci", "intstatus=0x%02x\n",
|
||||
grub_ohci_readreg32 (o, GRUB_OHCI_REG_INTSTATUS));
|
||||
|
||||
if (!tderr_addr)
|
||||
{
|
||||
/* It means that something wrong happened,
|
||||
* it could be:
|
||||
* - timeout and no TD processed
|
||||
* - some or unrecoverable error and no TD processed
|
||||
* - something unexpected... :-( */
|
||||
/* Try look into DONEHEAD reg., but there should be also zero */
|
||||
grub_dprintf("ohci", "HCCA DoneHead is zero, something is bad!\n");
|
||||
tderr_addr = grub_ohci_readreg32 (o, GRUB_OHCI_REG_DONEHEAD) & ~0xf;
|
||||
}
|
||||
|
||||
/* Remember last processed transaction (TD) - it is necessary for
|
||||
* proper setting of toggle bit in next transaction. */
|
||||
transfer->last_trans = ((tderr_addr - td_list_addr) / sizeof (*td_list));
|
||||
grub_dprintf("ohci", "tderr_addr=0x%x, td_list_addr=0x%x,\n",
|
||||
tderr_addr, td_list_addr);
|
||||
|
||||
if ((ed->td_head & ~0xf) == (ed->td_tail & ~0xf))
|
||||
transfer->last_trans = transfer->transcnt - 1;
|
||||
|
||||
/* Check correct value in last_trans */
|
||||
/* It could happen if timeout happens and no TD was retired */
|
||||
if (transfer->last_trans >= transfer->transcnt || !tderr_addr)
|
||||
{
|
||||
grub_dprintf("ohci", "tderr==0 or out of TDs range!\n");
|
||||
grub_dprintf("ohci", "last_trans=%d, transcnt=%d\n",
|
||||
transfer->last_trans, transfer->transcnt);
|
||||
|
||||
/* We should set something valid... */
|
||||
transfer->last_trans = -1; /* Probably no TD done */
|
||||
tderr_addr = td_list_addr;
|
||||
}
|
||||
|
||||
/* In case of timeout do not detect error from TD */
|
||||
if (err_timeout)
|
||||
{
|
||||
err = GRUB_ERR_TIMEOUT;
|
||||
grub_dprintf("ohci", "Timeout, target=%08x, head=%08x\n\t\ttail=%08x, next=%08x\n",
|
||||
grub_dprintf("ohci", "Timeout, target=%08x, head=%08x\n",
|
||||
grub_le_to_cpu32(ed->target),
|
||||
grub_le_to_cpu32(ed->td_head),
|
||||
grub_le_to_cpu32(ed->td_head));
|
||||
grub_dprintf("ohci", "tail=%08x, next=%08x\n",
|
||||
grub_le_to_cpu32(ed->td_tail),
|
||||
grub_le_to_cpu32(ed->next_ed));
|
||||
}
|
||||
/* In case of unrecoverable error do not detect error from TD */
|
||||
else if (err_unrec)
|
||||
{
|
||||
err = GRUB_USB_ERR_UNRECOVERABLE;
|
||||
grub_dprintf("ohci",
|
||||
"Unrecoverable error, target=%08x, head=%08x\n",
|
||||
grub_le_to_cpu32(ed->target),
|
||||
grub_le_to_cpu32(ed->td_head));
|
||||
grub_dprintf("ohci", "tail=%08x, next=%08x\n",
|
||||
grub_le_to_cpu32(ed->td_tail),
|
||||
grub_le_to_cpu32(ed->next_ed));
|
||||
}
|
||||
else if (grub_le_to_cpu32 (ed->td_head) & 1)
|
||||
{
|
||||
grub_uint32_t td_err_addr;
|
||||
grub_uint8_t errcode;
|
||||
grub_ohci_td_t tderr = NULL;
|
||||
|
||||
td_err_addr = (grub_ohci_readreg32 (o, GRUB_OHCI_REG_DONEHEAD) & ~0xf);
|
||||
if (td_err_addr == 0)
|
||||
/* If DONEHEAD==0 it means that correct address is in HCCA.
|
||||
* It should be always now! */
|
||||
td_err_addr = (grub_le_to_cpu32 (o->hcca->donehead) & ~0xf);
|
||||
transfer->last_trans--;
|
||||
|
||||
tderr = (grub_ohci_td_t) ((char *) td_list
|
||||
+ (td_err_addr - td_list_addr));
|
||||
+ (tderr_addr - td_list_addr));
|
||||
|
||||
errcode = grub_le_to_cpu32 (tderr->token) >> 28;
|
||||
grub_dprintf ("ohci", "OHCI errcode=0x%02x\n", errcode);
|
||||
|
@ -701,17 +776,17 @@ grub_ohci_transfer (grub_usb_controller_t dev,
|
|||
case 8:
|
||||
/* XXX: Data overrun error. */
|
||||
err = GRUB_USB_ERR_DATA;
|
||||
j = ((grub_uint32_t)tderr - (grub_uint32_t)td_list) / sizeof (*td_list);
|
||||
grub_dprintf ("ohci", "Overrun, failed TD address: %p, index: %d\n", tderr, j);
|
||||
grub_dprintf ("ohci", "Overrun, failed TD address: %p, index: %d\n",
|
||||
tderr, transfer->last_trans);
|
||||
break;
|
||||
|
||||
case 9:
|
||||
/* XXX: Data underrun error. */
|
||||
err = GRUB_USB_ERR_DATA;
|
||||
grub_dprintf ("ohci", "Underrun, failed TD address: %p, index: %d\n",
|
||||
tderr, transfer->last_trans);
|
||||
grub_dprintf ("ohci", "Underrun, number of not transferred bytes: %d\n",
|
||||
1 + grub_le_to_cpu32 (tderr->buffer_end) - grub_le_to_cpu32 (tderr->buffer));
|
||||
j = ((grub_uint32_t)tderr - (grub_uint32_t)td_list) / sizeof (*td_list);
|
||||
grub_dprintf ("ohci", "Underrun, failed TD address: %p, index: %d\n", tderr, j);
|
||||
break;
|
||||
|
||||
case 10:
|
||||
|
@ -763,7 +838,8 @@ grub_ohci_transfer (grub_usb_controller_t dev,
|
|||
/* SF bit reset. (SF bit indicates Start Of Frame (SOF) packet) */
|
||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_INTSTATUS, (1<<2));
|
||||
/* Wait for new SOF */
|
||||
while ((grub_ohci_readreg32 (o, GRUB_OHCI_REG_INTSTATUS) & 0x4) == 0);
|
||||
while (((grub_ohci_readreg32 (o, GRUB_OHCI_REG_INTSTATUS) & 0x4) == 0)
|
||||
&& !err_unrec);
|
||||
/* Now it should be safe to change CONTROL and BULK lists. */
|
||||
|
||||
/* Important cleaning. */
|
||||
|
@ -774,6 +850,28 @@ grub_ohci_transfer (grub_usb_controller_t dev,
|
|||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_BULKHEAD, 0);
|
||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_BULKCURR, 0);
|
||||
|
||||
if (err_unrec)
|
||||
{
|
||||
/* Do OHCI reset in case of unrecoverable error - maybe we will need
|
||||
* do more - re-enumerate bus etc. (?) */
|
||||
|
||||
/* Suspend the OHCI by issuing a reset. */
|
||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CMDSTATUS, 1); /* XXX: Magic. */
|
||||
grub_millisleep (1);
|
||||
grub_dprintf ("ohci", "Unrecoverable error - OHCI reset\n");
|
||||
|
||||
/* Misc. resets. */
|
||||
o->hcca->donehead = 0;
|
||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_INTSTATUS, 0x7f); /* Clears everything */
|
||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CONTROLHEAD, 0);
|
||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CONTROLCURR, 0);
|
||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_BULKHEAD, 0);
|
||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_BULKCURR, 0);
|
||||
|
||||
/* Enable the OHCI. */
|
||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CONTROL, (2 << 6));
|
||||
}
|
||||
|
||||
grub_dprintf ("ohci", "OHCI finished, freeing, err=0x%02x\n", err);
|
||||
|
||||
grub_dma_free (td_list_chunk);
|
||||
|
@ -782,11 +880,6 @@ grub_ohci_transfer (grub_usb_controller_t dev,
|
|||
return err;
|
||||
}
|
||||
|
||||
#define GRUB_OHCI_SET_PORT_ENABLE (1 << 1)
|
||||
#define GRUB_OHCI_CLEAR_PORT_ENABLE (1 << 0)
|
||||
#define GRUB_OHCI_SET_PORT_RESET (1 << 4)
|
||||
#define GRUB_OHCI_SET_PORT_RESET_STATUS_CHANGE (1 << 20)
|
||||
|
||||
static grub_err_t
|
||||
grub_ohci_portstatus (grub_usb_controller_t dev,
|
||||
unsigned int port, unsigned int enable)
|
||||
|
@ -869,7 +962,10 @@ grub_ohci_fini_hw (int noreturn __attribute__ ((unused)))
|
|||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_BULKHEAD, 0);
|
||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_BULKCURR, 0);
|
||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_DONEHEAD, 0);
|
||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CONTROL, 0);
|
||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CMDSTATUS, 1);
|
||||
}
|
||||
grub_millisleep (10);
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
|
|
@ -332,13 +332,20 @@ grub_free_td (struct grub_uhci *u, grub_uhci_td_t td)
|
|||
}
|
||||
|
||||
static void
|
||||
grub_free_queue (struct grub_uhci *u, grub_uhci_td_t td)
|
||||
grub_free_queue (struct grub_uhci *u, grub_uhci_td_t td,
|
||||
grub_usb_transfer_t transfer)
|
||||
{
|
||||
/* Free the TDs in this queue. */
|
||||
while (td)
|
||||
int i; /* Index of TD in transfer */
|
||||
|
||||
/* Free the TDs in this queue and set last_trans. */
|
||||
for (i=0; td; i++)
|
||||
{
|
||||
grub_uhci_td_t tdprev;
|
||||
|
||||
/* Check state of TD and possibly set last_trans */
|
||||
if (transfer && (td->linkptr & 1))
|
||||
transfer->last_trans = i;
|
||||
|
||||
/* Unlink the queue. */
|
||||
tdprev = td;
|
||||
td = (grub_uhci_td_t) td->linkptr2;
|
||||
|
@ -461,7 +468,7 @@ grub_uhci_transfer (grub_usb_controller_t dev,
|
|||
td_prev->linkptr = 1;
|
||||
|
||||
if (td_first)
|
||||
grub_free_queue (u, td_first);
|
||||
grub_free_queue (u, td_first, NULL);
|
||||
|
||||
return GRUB_USB_ERR_INTERNAL;
|
||||
}
|
||||
|
@ -560,7 +567,7 @@ grub_uhci_transfer (grub_usb_controller_t dev,
|
|||
/* Place the QH back in the free list and deallocate the associated
|
||||
TDs. */
|
||||
qh->elinkptr = 1;
|
||||
grub_free_queue (u, td_first);
|
||||
grub_free_queue (u, td_first, transfer);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
@ -609,7 +616,7 @@ grub_uhci_portstatus (grub_usb_controller_t dev,
|
|||
grub_uhci_writereg16 (u, reg, enable << 9);
|
||||
|
||||
/* Wait for the reset to complete. XXX: How long exactly? */
|
||||
grub_millisleep (10);
|
||||
grub_millisleep (50); /* For root hub should be nominaly 50ms */
|
||||
status = grub_uhci_readreg16 (u, reg);
|
||||
grub_uhci_writereg16 (u, reg, status & ~(1 << 9));
|
||||
grub_dprintf ("uhci", "reset completed\n");
|
||||
|
|
|
@ -105,10 +105,7 @@ grub_usb_clear_halt (grub_usb_device_t dev, int endpoint)
|
|||
grub_usb_err_t
|
||||
grub_usb_set_configuration (grub_usb_device_t dev, int configuration)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
dev->toggle[i] = 0;
|
||||
grub_memset (dev->toggle, 0, sizeof (dev->toggle));
|
||||
|
||||
return grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_OUT
|
||||
| GRUB_USB_REQTYPE_STANDARD
|
||||
|
|
|
@ -76,7 +76,7 @@ grub_usb_control_msg (grub_usb_device_t dev,
|
|||
setupdata_addr = grub_dma_get_phys (setupdata_chunk);
|
||||
|
||||
/* Determine the maximum packet size. */
|
||||
if (dev->initialized && dev->descdev.maxsize0)
|
||||
if (dev->descdev.maxsize0)
|
||||
max = dev->descdev.maxsize0;
|
||||
else
|
||||
max = 64;
|
||||
|
@ -213,6 +213,7 @@ grub_usb_bulk_readwrite (grub_usb_device_t dev,
|
|||
transfer->type = GRUB_USB_TRANSACTION_TYPE_BULK;
|
||||
transfer->max = max;
|
||||
transfer->dev = dev;
|
||||
transfer->last_trans = -1; /* Reset index of last processed transaction (TD) */
|
||||
|
||||
/* Allocate an array of transfer data structures. */
|
||||
transfer->transactions = grub_malloc (transfer->transcnt
|
||||
|
@ -240,6 +241,13 @@ grub_usb_bulk_readwrite (grub_usb_device_t dev,
|
|||
}
|
||||
|
||||
err = dev->controller.dev->transfer (&dev->controller, transfer);
|
||||
/* We must remember proper toggle value even if some transactions
|
||||
* were not processed - correct value should be inversion of last
|
||||
* processed transaction (TD). */
|
||||
if (transfer->last_trans >= 0)
|
||||
toggle = transfer->transactions[transfer->last_trans].toggle ? 0 : 1;
|
||||
else
|
||||
toggle = dev->toggle[endpoint]; /* Nothing done, take original */
|
||||
grub_dprintf ("usb", "toggle=%d\n", toggle);
|
||||
dev->toggle[endpoint] = toggle;
|
||||
|
||||
|
|
|
@ -23,19 +23,28 @@
|
|||
#include <grub/term.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/gzio.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_cat (grub_command_t cmd __attribute__ ((unused)),
|
||||
int argc, char **args)
|
||||
static const struct grub_arg_option options[] =
|
||||
{
|
||||
{"dos", -1, 0, N_("Accept DOS-style CR/NL line endings."), 0, 0},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_cat (grub_extcmd_t cmd, int argc, char **args)
|
||||
{
|
||||
struct grub_arg_list *state = cmd->state;
|
||||
int dos = 0;
|
||||
grub_file_t file;
|
||||
char buf[GRUB_DISK_SECTOR_SIZE];
|
||||
grub_ssize_t size;
|
||||
int key = 0;
|
||||
|
||||
if (state[0].set)
|
||||
dos = 1;
|
||||
|
||||
if (argc != 1)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
|
||||
|
||||
|
@ -54,6 +63,11 @@ grub_cmd_cat (grub_command_t cmd __attribute__ ((unused)),
|
|||
|
||||
if ((grub_isprint (c) || grub_isspace (c)) && c != '\r')
|
||||
grub_putchar (c);
|
||||
else if (dos && c == '\r' && buf[i + 1] == '\n')
|
||||
{
|
||||
grub_putchar ('\n');
|
||||
i++;
|
||||
}
|
||||
else
|
||||
{
|
||||
grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT);
|
||||
|
@ -74,15 +88,16 @@ grub_cmd_cat (grub_command_t cmd __attribute__ ((unused)),
|
|||
return 0;
|
||||
}
|
||||
|
||||
static grub_command_t cmd;
|
||||
static grub_extcmd_t cmd;
|
||||
|
||||
GRUB_MOD_INIT(cat)
|
||||
{
|
||||
cmd = grub_register_command_p1 ("cat", grub_cmd_cat,
|
||||
N_("FILE"), N_("Show the contents of a file."));
|
||||
cmd = grub_register_extcmd ("cat", grub_cmd_cat, GRUB_COMMAND_FLAG_BOTH,
|
||||
N_("FILE"), N_("Show the contents of a file."),
|
||||
options);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(cat)
|
||||
{
|
||||
grub_unregister_command (cmd);
|
||||
grub_unregister_extcmd (cmd);
|
||||
}
|
||||
|
|
|
@ -138,8 +138,8 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)),
|
|||
{
|
||||
grub_device_close (dev);
|
||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
"only partitions resding in the first 2TB "
|
||||
"can be presen in hybrid MBR");
|
||||
"only partitions residing in the first 2TB "
|
||||
"can be present in hybrid MBR");
|
||||
}
|
||||
|
||||
|
||||
|
@ -243,8 +243,8 @@ GRUB_MOD_INIT(gptsync)
|
|||
cmd = grub_register_command ("gptsync", grub_cmd_gptsync,
|
||||
N_("DEVICE [PARTITION[+/-[TYPE]]] ..."),
|
||||
N_("Fill hybrid MBR of GPT drive DEVICE. "
|
||||
"specified partitions will be a part "
|
||||
"of hybrid mbr. Up to 3 partitions are "
|
||||
"Specified partitions will be a part "
|
||||
"of hybrid MBR. Up to 3 partitions are "
|
||||
"allowed. TYPE is an MBR type. "
|
||||
"+ means that partition is active. "
|
||||
"Only one partition can be active."));
|
||||
|
|
|
@ -1,101 +0,0 @@
|
|||
/* handler.c - commands to list or select handlers */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2009 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/dl.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/term.h>
|
||||
#include <grub/handler.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_handler (struct grub_command *cmd __attribute__ ((unused)),
|
||||
int argc, char **args)
|
||||
{
|
||||
void *curr_item = 0;
|
||||
grub_handler_class_t head;
|
||||
|
||||
auto int list_item (grub_named_list_t item);
|
||||
int list_item (grub_named_list_t item)
|
||||
{
|
||||
if (item == curr_item)
|
||||
grub_putchar ('*');
|
||||
|
||||
grub_printf ("%s\n", item->name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
head = grub_handler_class_list;
|
||||
if (argc == 0)
|
||||
{
|
||||
grub_list_iterate (GRUB_AS_LIST (head), (grub_list_hook_t) list_item);
|
||||
}
|
||||
else
|
||||
{
|
||||
char *class_name;
|
||||
grub_handler_class_t class;
|
||||
|
||||
class_name = args[0];
|
||||
argc--;
|
||||
args++;
|
||||
|
||||
class = grub_named_list_find (GRUB_AS_NAMED_LIST (head), class_name);
|
||||
if (! class)
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "class not found");
|
||||
|
||||
if (argc == 0)
|
||||
{
|
||||
curr_item = class->cur_handler;
|
||||
grub_list_iterate (GRUB_AS_LIST (class->handler_list),
|
||||
(grub_list_hook_t) list_item);
|
||||
}
|
||||
else
|
||||
{
|
||||
grub_handler_t handler;
|
||||
|
||||
handler =
|
||||
grub_named_list_find (GRUB_AS_NAMED_LIST (class->handler_list),
|
||||
args[0]);
|
||||
|
||||
if (! handler)
|
||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "handler not found");
|
||||
|
||||
grub_handler_set_current (class, handler);
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_command_t cmd_handler;
|
||||
|
||||
GRUB_MOD_INIT(handler)
|
||||
{
|
||||
cmd_handler =
|
||||
grub_register_command ("handler", grub_cmd_handler,
|
||||
N_("[class [handler]]"),
|
||||
N_("List or select a handler."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(handler)
|
||||
{
|
||||
grub_unregister_command (cmd_handler);
|
||||
}
|
|
@ -33,10 +33,10 @@ grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
|
|||
int cnt = 0;
|
||||
char *currarg;
|
||||
|
||||
auto int print_command_info (grub_command_t cmd);
|
||||
auto int print_command_help (grub_command_t cmd);
|
||||
|
||||
int print_command_info (grub_command_t cmd)
|
||||
if (argc == 0)
|
||||
{
|
||||
grub_command_t cmd;
|
||||
FOR_COMMANDS(cmd)
|
||||
{
|
||||
if ((cmd->prio & GRUB_PRIO_LIST_FLAG_ACTIVE) &&
|
||||
(cmd->flags & GRUB_COMMAND_FLAG_CMDLINE))
|
||||
|
@ -49,7 +49,7 @@ grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
|
|||
|
||||
command_help = grub_xasprintf ("%s %s", cmd->name, summary_translated);
|
||||
if (!command_help)
|
||||
return 1;
|
||||
break;
|
||||
|
||||
grub_utf8_to_ucs4_alloc (command_help, &unicode_command_help,
|
||||
&unicode_last_position);
|
||||
|
@ -85,10 +85,19 @@ grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
|
|||
grub_free (command_help);
|
||||
grub_free (unicode_command_help);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (!(cnt % 2))
|
||||
grub_printf ("\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
int i;
|
||||
grub_command_t cmd;
|
||||
|
||||
int print_command_help (grub_command_t cmd)
|
||||
for (i = 0; i < argc; i++)
|
||||
{
|
||||
currarg = args[i];
|
||||
FOR_COMMANDS(cmd)
|
||||
{
|
||||
if (cmd->prio & GRUB_PRIO_LIST_FLAG_ACTIVE)
|
||||
{
|
||||
|
@ -100,27 +109,11 @@ grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
|
|||
if (cmd->flags & GRUB_COMMAND_FLAG_EXTCMD)
|
||||
grub_arg_show_help ((grub_extcmd_t) cmd->data);
|
||||
else
|
||||
grub_printf ("%s %s %s\n%s\n", _("Usage:"), cmd->name, _(cmd->summary),
|
||||
grub_printf ("%s %s %s\n%s\b", _("Usage:"), cmd->name, _(cmd->summary),
|
||||
_(cmd->description));
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (argc == 0)
|
||||
{
|
||||
grub_command_iterate (print_command_info);
|
||||
if (!(cnt % 2))
|
||||
grub_printf ("\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < argc; i++)
|
||||
{
|
||||
currarg = args[i];
|
||||
grub_command_iterate (print_command_help);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -301,9 +301,10 @@ grub_mini_cmd_lsmod (struct grub_command *cmd __attribute__ ((unused)),
|
|||
int argc __attribute__ ((unused)),
|
||||
char *argv[] __attribute__ ((unused)))
|
||||
{
|
||||
auto int print_module (grub_dl_t mod);
|
||||
grub_dl_t mod;
|
||||
|
||||
int print_module (grub_dl_t mod)
|
||||
grub_printf ("Name\tRef Count\tDependencies\n");
|
||||
FOR_DL_MODULES (mod)
|
||||
{
|
||||
grub_dl_dep_t dep;
|
||||
|
||||
|
@ -316,13 +317,8 @@ grub_mini_cmd_lsmod (struct grub_command *cmd __attribute__ ((unused)),
|
|||
grub_printf ("%s", dep->mod->name);
|
||||
}
|
||||
grub_putchar ('\n');
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
grub_printf ("Name\tRef Count\tDependencies\n");
|
||||
grub_dl_iterate (print_module);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -96,7 +96,7 @@ grub_setpci_iter (grub_pci_device_t dev, grub_pci_id_t pciid)
|
|||
if (check_device && grub_pci_get_device (dev) != device)
|
||||
return 0;
|
||||
|
||||
if (check_function && grub_pci_get_function (dev) != device)
|
||||
if (check_function && grub_pci_get_function (dev) != function)
|
||||
return 0;
|
||||
|
||||
addr = grub_pci_make_address (dev, regaddr);
|
||||
|
|
|
@ -148,8 +148,6 @@ usb_iterate (grub_usb_device_t dev)
|
|||
|
||||
grub_printf ("%s speed device\n", usb_devspeed[dev->speed]);
|
||||
|
||||
return 0;
|
||||
|
||||
for (i = 0; i < descdev->configcnt; i++)
|
||||
{
|
||||
struct grub_usb_desc_config *config;
|
||||
|
|
|
@ -38,15 +38,8 @@ grub_cmd_videotest (grub_command_t cmd __attribute__ ((unused)),
|
|||
unsigned int width;
|
||||
unsigned int height;
|
||||
int i;
|
||||
grub_font_t sansbig;
|
||||
grub_font_t sans;
|
||||
grub_font_t sanssmall;
|
||||
grub_font_t fixed;
|
||||
struct grub_font_glyph *glyph;
|
||||
struct grub_video_render_target *text_layer;
|
||||
grub_video_color_t palette[16];
|
||||
const char *str;
|
||||
int texty;
|
||||
|
||||
err = grub_video_set_mode ("auto", GRUB_VIDEO_MODE_TYPE_PURE_TEXT, 0);
|
||||
if (err)
|
||||
|
@ -54,21 +47,22 @@ grub_cmd_videotest (grub_command_t cmd __attribute__ ((unused)),
|
|||
|
||||
grub_video_get_viewport (&x, &y, &width, &height);
|
||||
|
||||
{
|
||||
const char *str;
|
||||
int texty;
|
||||
grub_font_t sansbig;
|
||||
grub_font_t sans;
|
||||
grub_font_t sanssmall;
|
||||
grub_font_t fixed;
|
||||
struct grub_font_glyph *glyph;
|
||||
|
||||
grub_video_create_render_target (&text_layer, width, height,
|
||||
GRUB_VIDEO_MODE_TYPE_RGB
|
||||
| GRUB_VIDEO_MODE_TYPE_ALPHA);
|
||||
|
||||
grub_video_set_active_render_target (GRUB_VIDEO_RENDER_TARGET_DISPLAY);
|
||||
|
||||
color = grub_video_map_rgb (0, 0, 0);
|
||||
grub_video_fill_rect (color, 0, 0, width, height);
|
||||
|
||||
color = grub_video_map_rgb (255, 0, 0);
|
||||
grub_video_fill_rect (color, 0, 0, 100, 100);
|
||||
grub_video_set_active_render_target (text_layer);
|
||||
|
||||
color = grub_video_map_rgb (0, 255, 255);
|
||||
grub_video_fill_rect (color, 100, 100, 100, 100);
|
||||
|
||||
sansbig = grub_font_get ("Unknown Regular 16");
|
||||
sans = grub_font_get ("Unknown Regular 16");
|
||||
sanssmall = grub_font_get ("Unknown Regular 16");
|
||||
|
@ -79,13 +73,6 @@ grub_cmd_videotest (grub_command_t cmd __attribute__ ((unused)),
|
|||
glyph = grub_font_get_glyph (fixed, '*');
|
||||
grub_font_draw_glyph (glyph, color, 200 ,0);
|
||||
|
||||
grub_video_set_viewport (x + 150, y + 150,
|
||||
width - 150 * 2, height - 150 * 2);
|
||||
color = grub_video_map_rgb (77, 33, 77);
|
||||
grub_video_fill_rect (color, 0, 0, width, height);
|
||||
|
||||
grub_video_set_active_render_target (text_layer);
|
||||
|
||||
color = grub_video_map_rgb (255, 255, 255);
|
||||
|
||||
texty = 32;
|
||||
|
@ -147,9 +134,28 @@ grub_cmd_videotest (grub_command_t cmd __attribute__ ((unused)),
|
|||
palette[i] = color;
|
||||
grub_font_draw_glyph (glyph, color, 16 + i * 16, 220);
|
||||
}
|
||||
}
|
||||
|
||||
grub_video_set_active_render_target (GRUB_VIDEO_RENDER_TARGET_DISPLAY);
|
||||
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
color = grub_video_map_rgb (0, 0, 0);
|
||||
grub_video_fill_rect (color, 0, 0, width, height);
|
||||
|
||||
color = grub_video_map_rgb (255, 0, 0);
|
||||
grub_video_fill_rect (color, 0, 0, 100, 100);
|
||||
|
||||
color = grub_video_map_rgb (0, 255, 255);
|
||||
grub_video_fill_rect (color, 100, 100, 100, 100);
|
||||
|
||||
grub_video_set_viewport (x + 150, y + 150,
|
||||
width - 150 * 2, height - 150 * 2);
|
||||
color = grub_video_map_rgb (77, 33, 77);
|
||||
grub_video_fill_rect (color, 0, 0, width, height);
|
||||
grub_video_swap_buffers ();
|
||||
}
|
||||
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
color = grub_video_map_rgb (i, 33, 77);
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
kernel_img_RELOCATABLE = yes
|
||||
pkglib_PROGRAMS = kernel.img
|
||||
kernel_img_SOURCES = kern/device.c kern/disk.c kern/dl.c kern/env.c \
|
||||
kern/err.c kern/list.c kern/handler.c kern/command.c \
|
||||
kern/err.c kern/list.c kern/command.c \
|
||||
kern/corecmd.c kern/file.c kern/fs.c kern/main.c kern/misc.c \
|
||||
kern/parser.c kern/partition.c kern/term.c \
|
||||
kern/rescue_reader.c kern/rescue_parser.c \
|
||||
|
@ -20,14 +20,14 @@ TARGET_NO_STRIP = yes
|
|||
|
||||
ifneq ($(TARGET_NO_MODULES), yes)
|
||||
kernel_img_SOURCES += symlist.c kern/$(target_cpu)/dl.c
|
||||
else
|
||||
kernel_img_SOURCES += grub_emu_init.c
|
||||
endif
|
||||
ifneq ($(target_cpu), i386)
|
||||
ifneq ($(target_cpu), x86_64)
|
||||
kernel_img_SOURCES += kern/$(target_cpu)/cache.S
|
||||
endif
|
||||
endif
|
||||
else
|
||||
kernel_img_SOURCES += grub_emu_init.c
|
||||
endif
|
||||
|
||||
# For halt.mod.
|
||||
pkglib_MODULES += halt.mod
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# -*- makefile -*-
|
||||
|
||||
# Used by various components. These rules need to precede them.
|
||||
script/lexer.c_DEPENDENCIES = grub_script.tab.h
|
||||
script/lexer.c_DEPENDENCIES = grub_script.tab.h grub_script.yy.h
|
||||
|
||||
sbin_UTILITIES += grub-mkdevicemap
|
||||
grub_mkdevicemap_SOURCES = gnulib/progname.c util/grub-mkdevicemap.c \
|
||||
|
@ -27,7 +27,7 @@ util/grub-probe.c_DEPENDENCIES = grub_probe_init.h
|
|||
grub_probe_SOURCES = gnulib/progname.c util/grub-probe.c \
|
||||
kern/emu/hostdisk.c util/misc.c kern/emu/misc.c kern/emu/getroot.c kern/emu/mm.c \
|
||||
kern/device.c kern/disk.c kern/err.c kern/misc.c \
|
||||
kern/parser.c kern/partition.c kern/file.c kern/list.c \
|
||||
kern/partition.c kern/file.c kern/list.c \
|
||||
\
|
||||
fs/affs.c fs/cpio.c fs/fat.c fs/ext2.c fs/hfs.c \
|
||||
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
||||
|
@ -88,21 +88,21 @@ DISTCLEANFILES += grub_script.yy.c grub_script.yy.h
|
|||
|
||||
# For grub-script-check.
|
||||
bin_UTILITIES += grub-script-check
|
||||
util/grub-script-check.c_DEPENDENCIES = grub_script_check_init.h
|
||||
grub_script_check_SOURCES = gnulib/progname.c gnulib/getdelim.c gnulib/getline.c \
|
||||
util/grub-script-check.c util/misc.c kern/emu/misc.c kern/emu/mm.c \
|
||||
script/main.c script/script.c script/function.c script/lexer.c \
|
||||
kern/handler.c kern/err.c kern/parser.c kern/list.c \
|
||||
kern/misc.c kern/env.c grub_script_check_init.c grub_script.tab.c \
|
||||
kern/err.c kern/list.c \
|
||||
kern/misc.c kern/env.c grub_script.tab.c \
|
||||
grub_script.yy.c
|
||||
grub_script_check_CFLAGS = $(GNULIB_UTIL_CFLAGS)
|
||||
grub_script_check_DEPENDENCIES = grub_script.tab.h
|
||||
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
||||
DEFSYMFILES += kernel_syms.lst
|
||||
|
||||
kernel_img_HEADERS += boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
||||
env.h err.h file.h fs.h kernel.h loader.h misc.h mm.h net.h parser.h \
|
||||
partition.h msdos_partition.h reader.h symbol.h term.h time.h types.h \
|
||||
list.h handler.h command.h i18n.h env_private.h libgcc.h
|
||||
list.h command.h i18n.h env_private.h libgcc.h
|
||||
|
||||
ifneq ($(platform), emu)
|
||||
kernel_img_HEADERS += machine/memory.h machine/loader.h
|
||||
|
@ -119,19 +119,6 @@ grub_script.tab.c grub_script.tab.h: script/parser.y
|
|||
$(YACC) -d -p grub_script_yy -b grub_script $(srcdir)/script/parser.y
|
||||
DISTCLEANFILES += grub_script.tab.c grub_script.tab.h
|
||||
|
||||
# For grub-script-check.
|
||||
grub_script_check_init.lst: geninit.sh $(filter-out grub_script_check_init.c,$(grub_script_check_SOURCES))
|
||||
rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@
|
||||
DISTCLEANFILES += grub_script_check_init.lst
|
||||
|
||||
grub_script_check_init.h: grub_script_check_init.lst $(filter-out grub_script_check_init.c,$(grub_script_check_SOURCES)) geninitheader.sh
|
||||
rm -f $@; sh $(srcdir)/geninitheader.sh $< > $@
|
||||
DISTCLEANFILES += grub_script_check_init.h
|
||||
|
||||
grub_script_check_init.c: grub_script_check_init.lst $(filter-out grub_script_check_init.c,$(grub_script_check_SOURCES)) geninit.sh
|
||||
rm -f $@; sh $(srcdir)/geninit.sh $< $(filter %.c,$^) > $@
|
||||
DISTCLEANFILES += grub_script_check_init.c
|
||||
|
||||
# For grub-probe.
|
||||
grub_probe_init.lst: geninit.sh $(filter-out grub_probe_init.c,$(grub_probe_SOURCES))
|
||||
rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@
|
||||
|
@ -215,10 +202,13 @@ CLEANFILES += grub-gettext_lib
|
|||
%: util/grub.d/%.in config.status
|
||||
./config.status --file=$@:$<
|
||||
chmod +x $@
|
||||
grub-mkconfig_SCRIPTS = 00_header 30_os-prober 40_custom
|
||||
grub-mkconfig_SCRIPTS = 00_header 30_os-prober 40_custom 41_custom
|
||||
ifneq (, $(host_kernel))
|
||||
grub-mkconfig_SCRIPTS += 10_$(host_kernel)
|
||||
endif
|
||||
ifeq (linux, $(host_kernel))
|
||||
grub-mkconfig_SCRIPTS += 20_linux_xen
|
||||
endif
|
||||
|
||||
CLEANFILES += $(grub-mkconfig_SCRIPTS)
|
||||
|
||||
|
@ -448,12 +438,12 @@ scsi_mod_CFLAGS = $(COMMON_CFLAGS)
|
|||
scsi_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# Commands.
|
||||
pkglib_MODULES += minicmd.mod extcmd.mod hello.mod handler.mod \
|
||||
pkglib_MODULES += minicmd.mod extcmd.mod hello.mod \
|
||||
ls.mod cmp.mod cat.mod help.mod search.mod loopback.mod \
|
||||
configfile.mod echo.mod \
|
||||
terminfo.mod test.mod blocklist.mod hexdump.mod \
|
||||
read.mod sleep.mod loadenv.mod crc.mod parttool.mod \
|
||||
msdospart.mod memrw.mod normal.mod sh.mod \
|
||||
msdospart.mod memrw.mod normal.mod \
|
||||
gptsync.mod true.mod probe.mod password.mod \
|
||||
keystatus.mod
|
||||
|
||||
|
@ -514,11 +504,6 @@ msdospart_mod_SOURCES = parttool/msdospart.c
|
|||
msdospart_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
msdospart_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For handler.mod.
|
||||
handler_mod_SOURCES = commands/handler.c
|
||||
handler_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
handler_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For ls.mod.
|
||||
ls_mod_SOURCES = commands/ls.c
|
||||
ls_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
@ -638,18 +623,14 @@ keystatus_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|||
|
||||
# For normal.mod.
|
||||
normal_mod_SOURCES = normal/main.c normal/cmdline.c normal/dyncmd.c \
|
||||
normal/auth.c normal/autofs.c normal/handler.c \
|
||||
normal/auth.c normal/autofs.c \
|
||||
normal/color.c normal/completion.c normal/datetime.c normal/menu.c \
|
||||
normal/menu_entry.c normal/menu_text.c \
|
||||
normal/misc.c normal/crypto.c normal/term.c normal/context.c
|
||||
normal_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
normal_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# For sh.mod.
|
||||
sh_mod_SOURCES = script/main.c script/script.c script/execute.c \
|
||||
normal/misc.c normal/crypto.c normal/term.c normal/context.c \
|
||||
script/main.c script/script.c script/execute.c \
|
||||
script/function.c script/lexer.c grub_script.tab.c grub_script.yy.c
|
||||
sh_mod_CFLAGS = $(COMMON_CFLAGS) $(POSIX_CFLAGS) -Wno-error
|
||||
sh_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
normal_mod_CFLAGS = $(COMMON_CFLAGS) $(POSIX_CFLAGS) -Wno-error
|
||||
normal_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
ifneq (, $(FONT_SOURCE))
|
||||
font/font.c_DEPENDENCIES = ascii.h
|
||||
|
|
|
@ -14,7 +14,7 @@ kernel_img_SOURCES = kern/i386/coreboot/startup.S \
|
|||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||
kern/misc.c kern/mm.c kern/term.c \
|
||||
kern/rescue_parser.c kern/rescue_reader.c \
|
||||
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
||||
kern/time.c kern/list.c kern/command.c kern/corecmd.c \
|
||||
kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
|
||||
kern/i386/tsc.c kern/i386/pit.c \
|
||||
kern/generic/rtc_get_time_ms.c \
|
||||
|
|
|
@ -18,7 +18,7 @@ kernel_img_SOURCES = kern/i386/ieee1275/startup.S \
|
|||
kern/rescue_parser.c kern/rescue_reader.c \
|
||||
kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
|
||||
kern/env.c \
|
||||
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
||||
kern/time.c kern/list.c kern/command.c kern/corecmd.c \
|
||||
kern/generic/millisleep.c \
|
||||
kern/ieee1275/ieee1275.c \
|
||||
term/ieee1275/ofconsole.c \
|
||||
|
|
|
@ -43,7 +43,7 @@ kernel_img_SOURCES = kern/i386/pc/startup.S \
|
|||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||
kern/misc.c kern/mm.c kern/term.c \
|
||||
kern/rescue_parser.c kern/rescue_reader.c \
|
||||
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
||||
kern/time.c kern/list.c kern/command.c kern/corecmd.c \
|
||||
kern/$(target_cpu)/dl.c kern/i386/pc/init.c kern/i386/pc/mmap.c \
|
||||
kern/parser.c kern/partition.c \
|
||||
kern/i386/tsc.c kern/i386/pit.c \
|
||||
|
@ -66,7 +66,7 @@ util/i386/pc/grub-setup.c_DEPENDENCIES = grub_setup_init.h
|
|||
grub_setup_SOURCES = gnulib/progname.c util/i386/pc/grub-setup.c \
|
||||
util/misc.c kern/emu/misc.c kern/emu/getroot.c \
|
||||
kern/emu/hostdisk.c kern/device.c kern/disk.c kern/err.c \
|
||||
kern/misc.c kern/parser.c kern/partition.c kern/file.c \
|
||||
kern/misc.c kern/partition.c kern/file.c \
|
||||
kern/emu/mm.c kern/fs.c kern/env.c kern/list.c fs/fshelp.c \
|
||||
\
|
||||
fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \
|
||||
|
@ -147,7 +147,7 @@ linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
|||
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
pkglib_MODULES += xnu.mod
|
||||
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/pc/xnu.c \
|
||||
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c \
|
||||
loader/macho32.c loader/macho64.c loader/macho.c loader/xnu.c
|
||||
xnu_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
|
|
@ -13,24 +13,28 @@ boot_img_ASFLAGS = $(COMMON_ASFLAGS) -DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_M
|
|||
boot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_BOOT_MACHINE_LINK_ADDR)
|
||||
boot_img_FORMAT = binary
|
||||
|
||||
kern/i386/qemu/init.c_DEPENDENCIES = ascii.h
|
||||
|
||||
pkglib_PROGRAMS += kernel.img
|
||||
kernel_img_SOURCES = kern/i386/qemu/startup.S \
|
||||
kern/i386/misc.S \
|
||||
kern/i386/coreboot/init.c \
|
||||
kern/i386/qemu/init.c \
|
||||
kern/i386/qemu/mmap.c \
|
||||
kern/i386/halt.c \
|
||||
kern/main.c kern/device.c \
|
||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||
kern/misc.c kern/mm.c kern/term.c \
|
||||
kern/rescue_parser.c kern/rescue_reader.c \
|
||||
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
||||
kern/time.c kern/list.c kern/command.c kern/corecmd.c \
|
||||
kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
|
||||
kern/i386/tsc.c kern/i386/pit.c \
|
||||
kern/generic/rtc_get_time_ms.c \
|
||||
kern/generic/millisleep.c \
|
||||
kern/env.c \
|
||||
term/i386/pc/vga_text.c term/i386/vga_common.c \
|
||||
term/i386/pc/vga_text.c term/i386/vga_common.c bus/pci.c \
|
||||
symlist.c
|
||||
kernel_img_HEADERS += pci.h
|
||||
kernel_img_CFLAGS = $(COMMON_CFLAGS) -DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)
|
||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS) -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
|
||||
kernel_img_LDFLAGS += $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR)
|
||||
|
|
|
@ -15,6 +15,16 @@ vga_text_mod_SOURCES = term/i386/pc/vga_text.c term/i386/vga_common.c
|
|||
vga_text_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
vga_text_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
pkglib_MODULES += video_cirrus.mod
|
||||
video_cirrus_mod_SOURCES = video/cirrus.c
|
||||
video_cirrus_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
video_cirrus_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
pkglib_MODULES += video_bochs.mod
|
||||
video_bochs_mod_SOURCES = video/bochs.c
|
||||
video_bochs_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
video_bochs_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
pkglib_MODULES += relocator.mod
|
||||
relocator_mod_SOURCES = lib/i386/relocator.c lib/i386/relocator_asm.S lib/i386/relocator_backward.S
|
||||
relocator_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
|
@ -50,11 +60,14 @@ serial_mod_SOURCES = term/serial.c
|
|||
serial_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
# On qemu it's compiled in
|
||||
ifneq ($(platform), qemu)
|
||||
# For pci.mod
|
||||
pkglib_MODULES += pci.mod
|
||||
pci_mod_SOURCES = bus/pci.c
|
||||
pci_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
endif
|
||||
|
||||
# For cs5536.mod
|
||||
pkglib_MODULES += cs5536.mod
|
||||
|
|
|
@ -12,7 +12,7 @@ kernel_img_SOURCES = kern/$(target_cpu)/startup.S \
|
|||
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
|
||||
kern/misc.c kern/mm.c kern/term.c \
|
||||
kern/rescue_parser.c kern/rescue_reader.c \
|
||||
kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
||||
kern/list.c kern/command.c kern/corecmd.c \
|
||||
kern/parser.c kern/partition.c kern/env.c kern/$(target_cpu)/dl.c \
|
||||
kern/generic/millisleep.c kern/generic/rtc_get_time_ms.c kern/time.c \
|
||||
symlist.c kern/$(target_cpu)/cache.S
|
||||
|
|
|
@ -16,7 +16,7 @@ kernel_img_SOURCES = kern/$(target_cpu)/startup.S \
|
|||
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
|
||||
kern/misc.c kern/mm.c kern/term.c \
|
||||
kern/rescue_parser.c kern/rescue_reader.c \
|
||||
kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
||||
kern/list.c kern/command.c kern/corecmd.c \
|
||||
kern/parser.c kern/partition.c kern/env.c kern/$(target_cpu)/dl.c \
|
||||
kern/generic/millisleep.c kern/generic/rtc_get_time_ms.c kern/time.c \
|
||||
kern/$(target_cpu)/cache.S \
|
||||
|
|
|
@ -13,7 +13,7 @@ kernel_img_SOURCES = kern/powerpc/ieee1275/startup.S kern/ieee1275/cmain.c \
|
|||
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
|
||||
kern/misc.c kern/mm.c kern/term.c \
|
||||
kern/rescue_parser.c kern/rescue_reader.c \
|
||||
kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
||||
kern/list.c kern/command.c kern/corecmd.c \
|
||||
kern/ieee1275/init.c \
|
||||
kern/ieee1275/mmap.c \
|
||||
term/ieee1275/ofconsole.c \
|
||||
|
|
|
@ -26,7 +26,7 @@ kernel_img_SOURCES = kern/sparc64/ieee1275/crt0.S kern/ieee1275/cmain.c \
|
|||
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
|
||||
kern/misc.c kern/mm.c kern/term.c \
|
||||
kern/rescue_parser.c kern/rescue_reader.c \
|
||||
kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
||||
kern/list.c kern/command.c kern/corecmd.c \
|
||||
kern/sparc64/ieee1275/ieee1275.c \
|
||||
kern/sparc64/ieee1275/init.c \
|
||||
kern/ieee1275/mmap.c \
|
||||
|
@ -48,7 +48,7 @@ util/sparc64/ieee1275/grub-setup.c_DEPENDENCIES = grub_setup_init.h
|
|||
grub_setup_SOURCES = util/sparc64/ieee1275/grub-setup.c \
|
||||
util/ieee1275/ofpath.c util/misc.c kern/emu/hostdisk.c \
|
||||
kern/emu/misc.c kern/emu/getroot.c kern/emu/mm.c kern/device.c \
|
||||
kern/disk.c kern/err.c kern/misc.c kern/parser.c \
|
||||
kern/disk.c kern/err.c kern/misc.c \
|
||||
kern/partition.c kern/file.c kern/fs.c kern/env.c kern/list.c \
|
||||
fs/fshelp.c \
|
||||
\
|
||||
|
|
|
@ -25,7 +25,7 @@ kernel_img_SOURCES = kern/$(target_cpu)/efi/startup.S kern/main.c kern/device.c
|
|||
kern/$(target_cpu)/dl.c kern/i386/efi/init.c kern/parser.c kern/partition.c \
|
||||
kern/env.c symlist.c kern/efi/efi.c kern/efi/init.c kern/efi/mm.c \
|
||||
term/efi/console.c disk/efi/efidisk.c \
|
||||
kern/time.c kern/list.c kern/handler.c kern/command.c kern/corecmd.c \
|
||||
kern/time.c kern/list.c kern/command.c kern/corecmd.c \
|
||||
kern/i386/tsc.c kern/i386/pit.c \
|
||||
kern/generic/rtc_get_time_ms.c \
|
||||
kern/generic/millisleep.c
|
||||
|
@ -102,7 +102,7 @@ efi_gop_mod_CFLAGS = $(COMMON_CFLAGS)
|
|||
efi_gop_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
||||
pkglib_MODULES += xnu.mod
|
||||
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c loader/i386/efi/xnu.c \
|
||||
xnu_mod_SOURCES = loader/xnu_resume.c loader/i386/xnu.c \
|
||||
loader/macho32.c loader/macho64.c loader/macho.c loader/xnu.c
|
||||
xnu_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||
xnu_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||
|
|
18
configure.ac
18
configure.ac
|
@ -179,13 +179,23 @@ if test "x$YACC" = x; then
|
|||
AC_MSG_ERROR([bison is not found])
|
||||
fi
|
||||
|
||||
for file in /usr/src/unifont.bdf /usr/share/fonts/X11/misc/unifont.pcf.gz /usr/share/fonts/unifont/unifont.pcf.gz; do
|
||||
if test -e $file ; then
|
||||
AC_SUBST([FONT_SOURCE], [$file])
|
||||
break
|
||||
FONT_SOURCE=
|
||||
|
||||
for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
|
||||
for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/unifont; do
|
||||
if test -f "$dir/unifont.$ext"; then
|
||||
FONT_SOURCE="$dir/unifont.$ext"
|
||||
break 2
|
||||
fi
|
||||
done
|
||||
done
|
||||
|
||||
if test "x$FONT_SOURCE" == x && ( test "x$platform" = xqemu || test "x$platform" = xyeeloong ); then
|
||||
AC_MSG_ERROR([qemu and yeeloong ports need unifont])
|
||||
fi
|
||||
|
||||
AC_SUBST([FONT_SOURCE])
|
||||
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_AWK
|
||||
AC_PROG_LEX
|
||||
|
|
|
@ -120,7 +120,8 @@ grub_biosdisk_open (const char *name, grub_disk_t disk)
|
|||
{
|
||||
data->flags = GRUB_BIOSDISK_FLAG_LBA | GRUB_BIOSDISK_FLAG_CDROM;
|
||||
data->sectors = 32;
|
||||
total_sectors = GRUB_ULONG_MAX; /* TODO: get the correct size. */
|
||||
/* TODO: get the correct size. */
|
||||
total_sectors = GRUB_DISK_SIZE_UNKNOWN;
|
||||
}
|
||||
else if (drive & 0x80)
|
||||
{
|
||||
|
|
|
@ -204,7 +204,7 @@ grub_ofdisk_open (const char *name, grub_disk_t disk)
|
|||
/* XXX: There is no property to read the number of blocks. There
|
||||
should be a property `#blocks', but it is not there. Perhaps it
|
||||
is possible to use seek for this. */
|
||||
disk->total_sectors = 0xFFFFFFFFUL;
|
||||
disk->total_sectors = GRUB_DISK_SIZE_UNKNOWN;
|
||||
|
||||
disk->id = (unsigned long) op;
|
||||
|
||||
|
|
35
disk/scsi.c
35
disk/scsi.c
|
@ -421,7 +421,7 @@ grub_scsi_open (const char *name, grub_disk_t disk)
|
|||
|
||||
/* According to USB MS tests specification, issue Test Unit Ready
|
||||
* until OK */
|
||||
maxtime = grub_get_time_ms () + 1000;
|
||||
maxtime = grub_get_time_ms () + 5000; /* It is safer value */
|
||||
do
|
||||
{
|
||||
/* Timeout is necessary - for example in case when we have
|
||||
|
@ -460,7 +460,7 @@ grub_scsi_open (const char *name, grub_disk_t disk)
|
|||
grub_dprintf ("scsi", "blocks=%u, blocksize=%u\n",
|
||||
scsi->size, scsi->blocksize);
|
||||
grub_dprintf ("scsi", "Disk total 512 sectors = %llu\n",
|
||||
disk->total_sectors);
|
||||
(unsigned long long) disk->total_sectors);
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
@ -519,6 +519,37 @@ grub_scsi_read (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
|
||||
/* XXX: Never reached. */
|
||||
return GRUB_ERR_NONE;
|
||||
|
||||
#if 0 /* Workaround - it works - but very slowly, from some reason
|
||||
* unknown to me (specially on OHCI). Do not use it. */
|
||||
/* Split transfer requests to device sector size because */
|
||||
/* some devices are not able to transfer more than 512-1024 bytes */
|
||||
grub_err_t err = GRUB_ERR_NONE;
|
||||
|
||||
for ( ; size; size--)
|
||||
{
|
||||
/* Depending on the type, select a read function. */
|
||||
switch (scsi->devtype)
|
||||
{
|
||||
case grub_scsi_devtype_direct:
|
||||
err = grub_scsi_read10 (disk, sector, 1, buf);
|
||||
break;
|
||||
|
||||
case grub_scsi_devtype_cdrom:
|
||||
err = grub_scsi_read12 (disk, sector, 1, buf);
|
||||
break;
|
||||
|
||||
default: /* This should not happen */
|
||||
return GRUB_ERR_READ_ERROR;
|
||||
}
|
||||
if (err)
|
||||
return err;
|
||||
sector++;
|
||||
buf += scsi->blocksize;
|
||||
}
|
||||
|
||||
return err;
|
||||
#endif
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
|
|
40
disk/usbms.c
40
disk/usbms.c
|
@ -253,6 +253,7 @@ grub_usbms_transfer (struct grub_scsi *scsi, grub_size_t cmdsize, char *cmd,
|
|||
struct grub_usbms_csw status;
|
||||
static grub_uint32_t tag = 0;
|
||||
grub_usb_err_t err = GRUB_USB_ERR_NONE;
|
||||
grub_usb_err_t errCSW = GRUB_USB_ERR_NONE;
|
||||
int retrycnt = 3 + 1;
|
||||
grub_size_t i;
|
||||
|
||||
|
@ -290,9 +291,8 @@ grub_usbms_transfer (struct grub_scsi *scsi, grub_size_t cmdsize, char *cmd,
|
|||
{
|
||||
if (err == GRUB_USB_ERR_STALL)
|
||||
{
|
||||
grub_usb_clear_halt (dev->dev, dev->in->endp_addr);
|
||||
grub_usb_clear_halt (dev->dev, dev->out->endp_addr);
|
||||
goto retry;
|
||||
goto CheckCSW;
|
||||
}
|
||||
return grub_error (GRUB_ERR_IO, "USB Mass Storage request failed");
|
||||
}
|
||||
|
@ -302,7 +302,12 @@ grub_usbms_transfer (struct grub_scsi *scsi, grub_size_t cmdsize, char *cmd,
|
|||
{
|
||||
err = grub_usb_bulk_read (dev->dev, dev->in->endp_addr, size, buf);
|
||||
grub_dprintf ("usb", "read: %d %d\n", err, GRUB_USB_ERR_STALL);
|
||||
if (err) goto CheckCSW;
|
||||
if (err)
|
||||
{
|
||||
if (err == GRUB_USB_ERR_STALL)
|
||||
grub_usb_clear_halt (dev->dev, dev->in->endp_addr);
|
||||
goto CheckCSW;
|
||||
}
|
||||
/* Debug print of received data. */
|
||||
grub_dprintf ("usb", "buf:\n");
|
||||
if (size <= 64)
|
||||
|
@ -316,6 +321,12 @@ grub_usbms_transfer (struct grub_scsi *scsi, grub_size_t cmdsize, char *cmd,
|
|||
err = grub_usb_bulk_write (dev->dev, dev->out->endp_addr, size, buf);
|
||||
grub_dprintf ("usb", "write: %d %d\n", err, GRUB_USB_ERR_STALL);
|
||||
grub_dprintf ("usb", "buf:\n");
|
||||
if (err)
|
||||
{
|
||||
if (err == GRUB_USB_ERR_STALL)
|
||||
grub_usb_clear_halt (dev->dev, dev->out->endp_addr);
|
||||
goto CheckCSW;
|
||||
}
|
||||
/* Debug print of sent data. */
|
||||
if (size <= 256)
|
||||
for (i=0; i<size; i++)
|
||||
|
@ -326,15 +337,16 @@ grub_usbms_transfer (struct grub_scsi *scsi, grub_size_t cmdsize, char *cmd,
|
|||
|
||||
/* Read the status - (maybe) according to specification. */
|
||||
CheckCSW:
|
||||
err = grub_usb_bulk_read (dev->dev, dev->in->endp_addr,
|
||||
errCSW = grub_usb_bulk_read (dev->dev, dev->in->endp_addr,
|
||||
sizeof (status), (char *) &status);
|
||||
if (err)
|
||||
if (errCSW)
|
||||
{
|
||||
grub_usb_clear_halt (dev->dev, dev->in->endp_addr);
|
||||
err = grub_usb_bulk_read (dev->dev, dev->in->endp_addr,
|
||||
errCSW = grub_usb_bulk_read (dev->dev, dev->in->endp_addr,
|
||||
sizeof (status), (char *) &status);
|
||||
if (err)
|
||||
if (errCSW)
|
||||
{ /* Bulk-only reset device. */
|
||||
grub_dprintf ("usb", "Bulk-only reset device - errCSW\n");
|
||||
grub_usbms_reset (dev->dev, dev->interface);
|
||||
grub_usb_clear_halt (dev->dev, dev->in->endp_addr);
|
||||
grub_usb_clear_halt (dev->dev, dev->out->endp_addr);
|
||||
|
@ -347,9 +359,11 @@ CheckCSW:
|
|||
status.signature, status.tag, status.residue);
|
||||
grub_dprintf ("usb", "CSW: status=0x%02x\n", status.status);
|
||||
|
||||
/* If phase error, do bulk-only reset device. */
|
||||
if (status.status == 2)
|
||||
{
|
||||
/* If phase error or not valid signature, do bulk-only reset device. */
|
||||
if ((status.status == 2) ||
|
||||
(status.signature != grub_cpu_to_le32(0x53425355)))
|
||||
{ /* Bulk-only reset device. */
|
||||
grub_dprintf ("usb", "Bulk-only reset device - bad status\n");
|
||||
grub_usbms_reset (dev->dev, dev->interface);
|
||||
grub_usb_clear_halt (dev->dev, dev->in->endp_addr);
|
||||
grub_usb_clear_halt (dev->dev, dev->out->endp_addr);
|
||||
|
@ -357,9 +371,13 @@ CheckCSW:
|
|||
goto retry;
|
||||
}
|
||||
|
||||
if (status.status)
|
||||
/* If "command failed" status or data transfer failed -> error */
|
||||
if ((status.status || err) && !read_write)
|
||||
return grub_error (GRUB_ERR_READ_ERROR,
|
||||
"error communication with USB Mass Storage device");
|
||||
else if ((status.status || err) && read_write)
|
||||
return grub_error (GRUB_ERR_WRITE_ERROR,
|
||||
"error communication with USB Mass Storage device");
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
|
1212
docs/grub.texi
1212
docs/grub.texi
File diff suppressed because it is too large
Load diff
2
docs/man/grub-bin2h.h2m
Normal file
2
docs/man/grub-bin2h.h2m
Normal file
|
@ -0,0 +1,2 @@
|
|||
[NAME]
|
||||
grub-bin2h \- convert a binary file to a C header
|
2
docs/man/grub-editenv.h2m
Normal file
2
docs/man/grub-editenv.h2m
Normal file
|
@ -0,0 +1,2 @@
|
|||
[NAME]
|
||||
grub-editenv \- edit GRUB environment block
|
2
docs/man/grub-emu.h2m
Normal file
2
docs/man/grub-emu.h2m
Normal file
|
@ -0,0 +1,2 @@
|
|||
[NAME]
|
||||
grub-emu \- GRUB emulator
|
2
docs/man/grub-fstest.h2m
Normal file
2
docs/man/grub-fstest.h2m
Normal file
|
@ -0,0 +1,2 @@
|
|||
[NAME]
|
||||
grub-fstest \- debug tool for GRUB filesystem drivers
|
2
docs/man/grub-install.h2m
Normal file
2
docs/man/grub-install.h2m
Normal file
|
@ -0,0 +1,2 @@
|
|||
[NAME]
|
||||
grub-install \- install GRUB to a device
|
2
docs/man/grub-macho2img.h2m
Normal file
2
docs/man/grub-macho2img.h2m
Normal file
|
@ -0,0 +1,2 @@
|
|||
[NAME]
|
||||
grub-macho2img \- convert Mach-O to raw image
|
2
docs/man/grub-mkconfig.h2m
Normal file
2
docs/man/grub-mkconfig.h2m
Normal file
|
@ -0,0 +1,2 @@
|
|||
[NAME]
|
||||
grub-mkconfig \- generate a GRUB configuration file
|
2
docs/man/grub-mkdevicemap.h2m
Normal file
2
docs/man/grub-mkdevicemap.h2m
Normal file
|
@ -0,0 +1,2 @@
|
|||
[NAME]
|
||||
grub-mkdevicemap \- generate a GRUB device map file automatically
|
2
docs/man/grub-mkfont.h2m
Normal file
2
docs/man/grub-mkfont.h2m
Normal file
|
@ -0,0 +1,2 @@
|
|||
[NAME]
|
||||
grub-mkfont \- make GRUB font files
|
2
docs/man/grub-mkimage.h2m
Normal file
2
docs/man/grub-mkimage.h2m
Normal file
|
@ -0,0 +1,2 @@
|
|||
[NAME]
|
||||
grub-mkimage \- make a bootable image of GRUB
|
2
docs/man/grub-mkpasswd-pbkdf2.h2m
Normal file
2
docs/man/grub-mkpasswd-pbkdf2.h2m
Normal file
|
@ -0,0 +1,2 @@
|
|||
[NAME]
|
||||
grub-mkpasswd-pbkdf2 \- generate hashed password for GRUB
|
2
docs/man/grub-mkrelpath.h2m
Normal file
2
docs/man/grub-mkrelpath.h2m
Normal file
|
@ -0,0 +1,2 @@
|
|||
[NAME]
|
||||
grub-mkrelpath \- make a system path relative to its root
|
2
docs/man/grub-mkrescue.h2m
Normal file
2
docs/man/grub-mkrescue.h2m
Normal file
|
@ -0,0 +1,2 @@
|
|||
[NAME]
|
||||
grub-mkrescue \- make a GRUB rescue image
|
2
docs/man/grub-ofpathname.h2m
Normal file
2
docs/man/grub-ofpathname.h2m
Normal file
|
@ -0,0 +1,2 @@
|
|||
[NAME]
|
||||
grub-ofpathname \- find OpenBOOT path for a device
|
2
docs/man/grub-pe2elf.h2m
Normal file
2
docs/man/grub-pe2elf.h2m
Normal file
|
@ -0,0 +1,2 @@
|
|||
[NAME]
|
||||
grub-pe2elf \- convert PE image to ELF
|
2
docs/man/grub-probe.h2m
Normal file
2
docs/man/grub-probe.h2m
Normal file
|
@ -0,0 +1,2 @@
|
|||
[NAME]
|
||||
grub-probe \- probe device information for GRUB
|
2
docs/man/grub-reboot.h2m
Normal file
2
docs/man/grub-reboot.h2m
Normal file
|
@ -0,0 +1,2 @@
|
|||
[NAME]
|
||||
grub-reboot \- set the default boot entry for GRUB, for the next boot only
|
2
docs/man/grub-script-check.h2m
Normal file
2
docs/man/grub-script-check.h2m
Normal file
|
@ -0,0 +1,2 @@
|
|||
[NAME]
|
||||
grub-script-check \- check grub.cfg for syntax errors
|
2
docs/man/grub-set-default.h2m
Normal file
2
docs/man/grub-set-default.h2m
Normal file
|
@ -0,0 +1,2 @@
|
|||
[NAME]
|
||||
grub-set-default \- set the default boot entry for GRUB
|
2
docs/man/grub-setup.h2m
Normal file
2
docs/man/grub-setup.h2m
Normal file
|
@ -0,0 +1,2 @@
|
|||
[NAME]
|
||||
grub-setup \- set up a device to boot using GRUB
|
|
@ -114,7 +114,7 @@ grub_pxe_open (const char *name, grub_disk_t disk)
|
|||
return err;
|
||||
if (*ptr == ':')
|
||||
{
|
||||
err = parse_ip (ptr + 1, &(data->server_ip), 0);
|
||||
err = parse_ip (ptr + 1, &(data->gateway_ip), 0);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
|
|
67
fs/nilfs2.c
67
fs/nilfs2.c
|
@ -49,6 +49,13 @@
|
|||
#define NILFS_BTREE_LEVEL_NODE_MIN (NILFS_BTREE_LEVEL_DATA + 1)
|
||||
#define NILFS_BTREE_LEVEL_MAX 14
|
||||
|
||||
/* nilfs 1st super block posission from beginning of the partition
|
||||
in 512 block size */
|
||||
#define NILFS_1ST_SUPER_BLOCK 2
|
||||
/* nilfs 2nd super block posission from end of the partition
|
||||
in 512 block size */
|
||||
#define NILFS_2ND_SUPER_BLOCK 8
|
||||
|
||||
struct grub_nilfs2_inode
|
||||
{
|
||||
grub_uint64_t i_blocks;
|
||||
|
@ -703,6 +710,52 @@ grub_nilfs2_valid_sb (struct grub_nilfs2_super_block *sbp)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_nilfs2_load_sb (struct grub_nilfs2_data *data)
|
||||
{
|
||||
grub_disk_t disk = data->disk;
|
||||
struct grub_nilfs2_super_block sb2;
|
||||
grub_uint64_t partition_size;
|
||||
int valid[2];
|
||||
int swp = 0;
|
||||
|
||||
/* Read first super block. */
|
||||
grub_disk_read (disk, NILFS_1ST_SUPER_BLOCK, 0,
|
||||
sizeof (struct grub_nilfs2_super_block), &data->sblock);
|
||||
/* Make sure if 1st super block is valid. */
|
||||
valid[0] = grub_nilfs2_valid_sb (&data->sblock);
|
||||
|
||||
partition_size = grub_disk_get_size (disk);
|
||||
if (partition_size != GRUB_DISK_SIZE_UNKNOWN)
|
||||
{
|
||||
/* Read second super block. */
|
||||
grub_disk_read (disk, partition_size - NILFS_2ND_SUPER_BLOCK, 0,
|
||||
sizeof (struct grub_nilfs2_super_block), &sb2);
|
||||
/* Make sure if 2nd super block is valid. */
|
||||
valid[1] = grub_nilfs2_valid_sb (&sb2);
|
||||
}
|
||||
else
|
||||
/* 2nd super block may not exist, so it's invalid. */
|
||||
valid[1] = 0;
|
||||
|
||||
|
||||
|
||||
if (!valid[0] && !valid[1])
|
||||
return grub_error (GRUB_ERR_BAD_FS, "not a nilfs2 filesystem");
|
||||
|
||||
swp = valid[1] && (!valid[0] ||
|
||||
grub_le_to_cpu64 (data->sblock.s_last_cno) <
|
||||
grub_le_to_cpu64 (sb2.s_last_cno));
|
||||
|
||||
/* swap if first super block is invalid or older than second one. */
|
||||
if (swp)
|
||||
grub_memcpy (&data->sblock, &sb2,
|
||||
sizeof (struct grub_nilfs2_super_block));
|
||||
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
static struct grub_nilfs2_data *
|
||||
grub_nilfs2_mount (grub_disk_t disk)
|
||||
{
|
||||
|
@ -717,19 +770,13 @@ grub_nilfs2_mount (grub_disk_t disk)
|
|||
if (!data)
|
||||
return 0;
|
||||
|
||||
data->disk = disk;
|
||||
|
||||
/* Read the superblock. */
|
||||
grub_disk_read (disk, 1 * 2, 0, sizeof (struct grub_nilfs2_super_block),
|
||||
&data->sblock);
|
||||
grub_nilfs2_load_sb (data);
|
||||
if (grub_errno)
|
||||
goto fail;
|
||||
|
||||
/* Make sure this is an nilfs2 filesystem. */
|
||||
if (!grub_nilfs2_valid_sb (&data->sblock))
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FS, "not a nilfs2 filesystem");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
nilfs2_block_count = (1 << LOG2_NILFS2_BLOCK_SIZE (data));
|
||||
|
||||
/* Read the last segment summary. */
|
||||
|
@ -748,8 +795,6 @@ grub_nilfs2_mount (grub_disk_t disk)
|
|||
if (grub_errno)
|
||||
goto fail;
|
||||
|
||||
data->disk = disk;
|
||||
|
||||
grub_nilfs2_read_last_checkpoint (data, &last_checkpoint);
|
||||
|
||||
if (grub_errno)
|
||||
|
|
6
genmk.rb
6
genmk.rb
|
@ -228,7 +228,7 @@ VIDEOFILES += #{video}
|
|||
|
||||
#{fs}: #{src} $(#{src}_DEPENDENCIES) genfslist.sh
|
||||
set -e; \
|
||||
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
|
||||
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} -DGRUB_LST_GENERATOR $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
|
||||
| sh $(srcdir)/genfslist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
|
||||
|
||||
#{parttool}: #{src} $(#{src}_DEPENDENCIES) genparttoollist.sh
|
||||
|
@ -238,7 +238,7 @@ VIDEOFILES += #{video}
|
|||
|
||||
#{partmap}: #{src} $(#{src}_DEPENDENCIES) genpartmaplist.sh
|
||||
set -e; \
|
||||
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
|
||||
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} -DGRUB_LST_GENERATOR $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
|
||||
| sh $(srcdir)/genpartmaplist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
|
||||
|
||||
#{handler}: #{src} $(#{src}_DEPENDENCIES) genhandlerlist.sh
|
||||
|
@ -253,7 +253,7 @@ VIDEOFILES += #{video}
|
|||
|
||||
#{video}: #{src} $(#{src}_DEPENDENCIES) genvideolist.sh
|
||||
set -e; \
|
||||
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
|
||||
$(TARGET_CC) -I#{dir} -I$(srcdir)/#{dir} $(TARGET_CPPFLAGS) #{extra_flags} -DGRUB_LST_GENERATOR $(TARGET_#{flag}) $(#{prefix}_#{flag}) -E $< \
|
||||
| sh $(srcdir)/genvideolist.sh #{symbolic_name} > $@ || (rm -f $@; exit 1)
|
||||
|
||||
"
|
||||
|
|
|
@ -309,14 +309,10 @@ grub_gettext_init_ext (const char *lang)
|
|||
static void
|
||||
grub_gettext_delete_list (void)
|
||||
{
|
||||
struct grub_gettext_msg *item;
|
||||
|
||||
while ((item =
|
||||
grub_list_pop (GRUB_AS_LIST_P (&grub_gettext_msg_list))) != 0)
|
||||
while (grub_gettext_msg_list)
|
||||
{
|
||||
char *original = (char *) ((struct grub_gettext_msg *) item)->name;
|
||||
grub_free (original);
|
||||
|
||||
grub_free ((char *) grub_gettext_msg_list->name);
|
||||
grub_gettext_msg_list = grub_gettext_msg_list->next;
|
||||
/* Don't delete the translated message because could be in use. */
|
||||
}
|
||||
}
|
||||
|
|
|
@ -115,12 +115,7 @@ grub_command_execute (const char *name, int argc, char **argv)
|
|||
return (cmd) ? cmd->func (cmd, argc, argv) : GRUB_ERR_FILE_NOT_FOUND;
|
||||
}
|
||||
|
||||
static inline int
|
||||
grub_command_iterate (int (*func) (grub_command_t))
|
||||
{
|
||||
return grub_list_iterate (GRUB_AS_LIST (grub_command_list),
|
||||
(grub_list_hook_t) func);
|
||||
}
|
||||
#define FOR_COMMANDS(var) FOR_LIST_ELEMENTS((var), grub_command_list)
|
||||
|
||||
void grub_register_core_commands (void);
|
||||
|
||||
|
|
|
@ -138,6 +138,9 @@ typedef struct grub_disk_memberlist *grub_disk_memberlist_t;
|
|||
#define GRUB_DISK_CACHE_SIZE 8
|
||||
#define GRUB_DISK_CACHE_BITS 3
|
||||
|
||||
/* Return value of grub_disk_get_size() in case disk size is unknown. */
|
||||
#define GRUB_DISK_SIZE_UNKNOWN 0xffffffffffffffffULL
|
||||
|
||||
/* This is called from the memory manager. */
|
||||
void grub_disk_cache_invalidate_all (void);
|
||||
|
||||
|
|
|
@ -82,6 +82,7 @@ struct grub_dl
|
|||
Elf_Sym *symtab;
|
||||
void (*init) (struct grub_dl *mod);
|
||||
void (*fini) (void);
|
||||
struct grub_dl *next;
|
||||
};
|
||||
typedef struct grub_dl *grub_dl_t;
|
||||
|
||||
|
@ -98,7 +99,10 @@ void grub_dl_unload_all (void);
|
|||
#endif
|
||||
int EXPORT_FUNC(grub_dl_ref) (grub_dl_t mod);
|
||||
int EXPORT_FUNC(grub_dl_unref) (grub_dl_t mod);
|
||||
void EXPORT_FUNC(grub_dl_iterate) (int (*hook) (grub_dl_t mod));
|
||||
extern grub_dl_t EXPORT_VAR(grub_dl_head);
|
||||
|
||||
#define FOR_DL_MODULES(var) FOR_LIST_ELEMENTS ((var), (grub_dl_head))
|
||||
|
||||
grub_dl_t EXPORT_FUNC(grub_dl_get) (const char *name);
|
||||
grub_err_t grub_dl_register_symbol (const char *name, void *addr,
|
||||
grub_dl_t mod);
|
||||
|
|
|
@ -32,7 +32,7 @@ enum grub_efi_uga_blt_operation
|
|||
GRUB_EFI_UGA_VIDEO_TO_BLT,
|
||||
GRUB_EFI_UGA_BLT_TO_VIDEO,
|
||||
GRUB_EFI_UGA_VIDEO_TO_VIDEO,
|
||||
GRUB_EFI_UGA_GLT_MAX
|
||||
GRUB_EFI_UGA_BLT_MAX
|
||||
};
|
||||
|
||||
struct grub_efi_uga_pixel
|
||||
|
|
|
@ -48,4 +48,8 @@ int EXPORT_FUNC(asprintf) (char **buf, const char *fmt, ...);
|
|||
char * EXPORT_FUNC(xasprintf) (const char *fmt, ...);
|
||||
extern char * canonicalize_file_name (const char *path);
|
||||
|
||||
#ifdef HAVE_DEVICE_MAPPER
|
||||
int grub_device_mapper_supported (void);
|
||||
#endif
|
||||
|
||||
#endif /* GRUB_EMU_MISC_H */
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
|
||||
#include <grub/list.h>
|
||||
|
||||
/* Forward declaration is required, because of mutual reference. */
|
||||
struct grub_file;
|
||||
|
||||
|
@ -38,6 +40,9 @@ struct grub_dirhook_info
|
|||
/* Filesystem descriptor. */
|
||||
struct grub_fs
|
||||
{
|
||||
/* The next filesystem. */
|
||||
struct grub_fs *next;
|
||||
|
||||
/* My name. */
|
||||
const char *name;
|
||||
|
||||
|
@ -72,9 +77,6 @@ struct grub_fs
|
|||
/* Whether this filesystem reserves first sector for DOS-style boot. */
|
||||
int reserved_first_sector;
|
||||
#endif
|
||||
|
||||
/* The next filesystem. */
|
||||
struct grub_fs *next;
|
||||
};
|
||||
typedef struct grub_fs *grub_fs_t;
|
||||
|
||||
|
@ -87,10 +89,24 @@ extern struct grub_fs grub_fs_blocklist;
|
|||
the linked list GRUB_FS_LIST through the function grub_fs_register. */
|
||||
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)
|
||||
{
|
||||
grub_list_remove (GRUB_AS_LIST_P (&grub_fs_list), GRUB_AS_LIST (fs));
|
||||
}
|
||||
|
||||
#define FOR_FILESYSTEMS(var) FOR_LIST_ELEMENTS((var), (grub_fs_list))
|
||||
|
||||
void EXPORT_FUNC(grub_fs_register) (grub_fs_t fs);
|
||||
void EXPORT_FUNC(grub_fs_unregister) (grub_fs_t fs);
|
||||
void EXPORT_FUNC(grub_fs_iterate) (int (*hook) (const grub_fs_t fs));
|
||||
grub_fs_t EXPORT_FUNC(grub_fs_probe) (grub_device_t device);
|
||||
|
||||
#endif /* ! GRUB_FS_HEADER */
|
||||
|
|
|
@ -1,60 +0,0 @@
|
|||
/* handler.h - header for grub handler */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2009 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_HANDLER_HEADER
|
||||
#define GRUB_HANDLER_HEADER 1
|
||||
|
||||
#include <grub/list.h>
|
||||
#include <grub/err.h>
|
||||
|
||||
struct grub_handler
|
||||
{
|
||||
struct grub_handler *next;
|
||||
const char *name;
|
||||
grub_err_t (*init) (void);
|
||||
grub_err_t (*fini) (void);
|
||||
};
|
||||
typedef struct grub_handler *grub_handler_t;
|
||||
|
||||
struct grub_handler_class
|
||||
{
|
||||
struct grub_handler_class *next;
|
||||
const char *name;
|
||||
grub_handler_t handler_list;
|
||||
grub_handler_t cur_handler;
|
||||
};
|
||||
typedef struct grub_handler_class *grub_handler_class_t;
|
||||
|
||||
extern grub_handler_class_t EXPORT_VAR(grub_handler_class_list);
|
||||
|
||||
void EXPORT_FUNC(grub_handler_register) (grub_handler_class_t class,
|
||||
grub_handler_t handler);
|
||||
void EXPORT_FUNC(grub_handler_unregister) (grub_handler_class_t class,
|
||||
grub_handler_t handler);
|
||||
grub_err_t EXPORT_FUNC(grub_handler_set_current) (grub_handler_class_t class,
|
||||
grub_handler_t handler);
|
||||
|
||||
#define GRUB_AS_HANDLER(ptr) \
|
||||
((GRUB_FIELD_MATCH (ptr, grub_handler_t, next) && \
|
||||
GRUB_FIELD_MATCH (ptr, grub_handler_t, name) && \
|
||||
GRUB_FIELD_MATCH (ptr, grub_handler_t, init) && \
|
||||
GRUB_FIELD_MATCH (ptr, grub_handler_t, fini)) ? \
|
||||
(grub_handler_t) ptr : grub_bad_type_cast ())
|
||||
|
||||
#endif /* ! GRUB_HANDLER_HEADER */
|
|
@ -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 */
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -30,15 +30,10 @@ struct grub_list
|
|||
};
|
||||
typedef struct grub_list *grub_list_t;
|
||||
|
||||
typedef int (*grub_list_hook_t) (grub_list_t item);
|
||||
typedef int (*grub_list_test_t) (grub_list_t new_item, grub_list_t item);
|
||||
|
||||
void EXPORT_FUNC(grub_list_push) (grub_list_t *head, grub_list_t item);
|
||||
void * EXPORT_FUNC(grub_list_pop) (grub_list_t *head);
|
||||
void EXPORT_FUNC(grub_list_remove) (grub_list_t *head, grub_list_t item);
|
||||
int EXPORT_FUNC(grub_list_iterate) (grub_list_t head, grub_list_hook_t hook);
|
||||
void EXPORT_FUNC(grub_list_insert) (grub_list_t *head, grub_list_t item,
|
||||
grub_list_test_t test);
|
||||
|
||||
#define FOR_LIST_ELEMENTS(var, list) for ((var) = (list); (var); (var) = (var)->next)
|
||||
|
||||
static inline void *
|
||||
grub_bad_type_cast_real (int line, const char *file)
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
|
||||
#include <grub/types.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/handler.h>
|
||||
#include <grub/reader.h>
|
||||
|
||||
/* All the states for the command line. */
|
||||
|
@ -84,36 +83,9 @@ struct grub_parser
|
|||
};
|
||||
typedef struct grub_parser *grub_parser_t;
|
||||
|
||||
extern struct grub_handler_class EXPORT_VAR(grub_parser_class);
|
||||
grub_err_t EXPORT_FUNC(grub_parser_execute) (char *source);
|
||||
grub_err_t grub_parser_execute (char *source);
|
||||
|
||||
static inline void
|
||||
grub_parser_register (const char *name __attribute__ ((unused)),
|
||||
/* `name' is ignored here, but used by genhandlerlist.sh. */
|
||||
grub_parser_t parser)
|
||||
{
|
||||
grub_handler_register (&grub_parser_class, GRUB_AS_HANDLER (parser));
|
||||
}
|
||||
|
||||
static inline void
|
||||
grub_parser_unregister (grub_parser_t parser)
|
||||
{
|
||||
grub_handler_unregister (&grub_parser_class, GRUB_AS_HANDLER (parser));
|
||||
}
|
||||
|
||||
static inline grub_parser_t
|
||||
grub_parser_get_current (void)
|
||||
{
|
||||
return (grub_parser_t) grub_parser_class.cur_handler;
|
||||
}
|
||||
|
||||
static inline grub_err_t
|
||||
grub_parser_set_current (grub_parser_t parser)
|
||||
{
|
||||
return grub_handler_set_current (&grub_parser_class,
|
||||
GRUB_AS_HANDLER (parser));
|
||||
}
|
||||
|
||||
void grub_register_rescue_parser (void);
|
||||
grub_err_t
|
||||
grub_rescue_parse_line (char *line, grub_reader_getline_t getline);
|
||||
|
||||
#endif /* ! GRUB_PARSER_HEADER */
|
||||
|
|
|
@ -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)
|
||||
|
@ -91,7 +93,7 @@ grub_partition_map_unregister (grub_partition_map_t partmap)
|
|||
GRUB_AS_LIST (partmap));
|
||||
}
|
||||
|
||||
#define FOR_PARTITION_MAPS(var) for (var = grub_partition_map_list; var; var = var->next)
|
||||
#define FOR_PARTITION_MAPS(var) FOR_LIST_ELEMENTS((var), (grub_partition_map_list))
|
||||
|
||||
|
||||
static inline grub_disk_addr_t
|
||||
|
|
|
@ -335,15 +335,22 @@ struct grub_script_function
|
|||
};
|
||||
typedef struct grub_script_function *grub_script_function_t;
|
||||
|
||||
extern grub_script_function_t grub_script_function_list;
|
||||
|
||||
#define FOR_SCRIPT_FUNCTIONS(var) for((var) = grub_script_function_list; \
|
||||
(var); (var) = (var)->next)
|
||||
|
||||
grub_script_function_t grub_script_function_create (struct grub_script_arg *functionname,
|
||||
struct grub_script *cmd);
|
||||
void grub_script_function_remove (const char *name);
|
||||
grub_script_function_t grub_script_function_find (char *functionname);
|
||||
int grub_script_function_iterate (int (*iterate) (grub_script_function_t));
|
||||
int grub_script_function_call (grub_script_function_t func,
|
||||
int argc, char **args);
|
||||
|
||||
char **
|
||||
grub_script_execute_arglist_to_argv (struct grub_script_arglist *arglist, int *count);
|
||||
|
||||
grub_err_t
|
||||
grub_normal_parse_line (char *line, grub_reader_getline_t getline);
|
||||
|
||||
#endif /* ! GRUB_NORMAL_PARSER_HEADER */
|
||||
|
|
|
@ -147,14 +147,14 @@ struct grub_scsi_write12
|
|||
|
||||
typedef enum
|
||||
{
|
||||
grub_scsi_cmd_inquiry = 0x12,
|
||||
grub_scsi_cmd_test_unit_ready = 0x00,
|
||||
grub_scsi_cmd_request_sense = 0x03,
|
||||
grub_scsi_cmd_inquiry = 0x12,
|
||||
grub_scsi_cmd_read_capacity = 0x25,
|
||||
grub_scsi_cmd_read10 = 0x28,
|
||||
grub_scsi_cmd_write10 = 0x2a,
|
||||
grub_scsi_cmd_read12 = 0xa8,
|
||||
grub_scsi_cmd_write12 = 0xaa,
|
||||
grub_scsi_cmd_request_sense = 0x03
|
||||
} grub_scsi_cmd_t;
|
||||
|
||||
typedef enum
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include <grub/err.h>
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/handler.h>
|
||||
#include <grub/list.h>
|
||||
|
||||
/* These are used to represent the various color states we use. */
|
||||
typedef enum
|
||||
|
@ -262,10 +262,10 @@ grub_term_unregister_output (grub_term_output_t term)
|
|||
GRUB_AS_LIST (term));
|
||||
}
|
||||
|
||||
#define FOR_ACTIVE_TERM_INPUTS(var) for (var = grub_term_inputs; var; var = var->next)
|
||||
#define FOR_DISABLED_TERM_INPUTS(var) for (var = grub_term_inputs_disabled; var; var = var->next)
|
||||
#define FOR_ACTIVE_TERM_OUTPUTS(var) for (var = grub_term_outputs; var; var = var->next)
|
||||
#define FOR_DISABLED_TERM_OUTPUTS(var) for (var = grub_term_outputs_disabled; var; var = var->next)
|
||||
#define FOR_ACTIVE_TERM_INPUTS(var) FOR_LIST_ELEMENTS((var), (grub_term_inputs))
|
||||
#define FOR_DISABLED_TERM_INPUTS(var) FOR_LIST_ELEMENTS((var), (grub_term_inputs_disabled))
|
||||
#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,
|
||||
|
|
|
@ -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;
|
||||
|
@ -98,7 +98,7 @@ typedef grub_uint32_t grub_size_t;
|
|||
typedef grub_int32_t grub_ssize_t;
|
||||
#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)
|
||||
|
|
|
@ -35,7 +35,8 @@ typedef enum
|
|||
GRUB_USB_ERR_NAK,
|
||||
GRUB_USB_ERR_BABBLE,
|
||||
GRUB_USB_ERR_TIMEOUT,
|
||||
GRUB_USB_ERR_BITSTUFF
|
||||
GRUB_USB_ERR_BITSTUFF,
|
||||
GRUB_USB_ERR_UNRECOVERABLE
|
||||
} grub_usb_err_t;
|
||||
|
||||
typedef enum
|
||||
|
|
|
@ -58,6 +58,9 @@ struct grub_usb_transfer
|
|||
struct grub_usb_device *dev;
|
||||
|
||||
struct grub_usb_transaction *transactions;
|
||||
|
||||
int last_trans;
|
||||
/* Index of last processed transaction in OHCI/UHCI driver. */
|
||||
};
|
||||
typedef struct grub_usb_transfer *grub_usb_transfer_t;
|
||||
|
||||
|
|
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
|
|
@ -21,6 +21,7 @@
|
|||
|
||||
#include <grub/err.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/list.h>
|
||||
|
||||
/* Video color in hardware dependent format. Users should not assume any
|
||||
specific coding format. */
|
||||
|
@ -182,15 +183,32 @@ 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. */
|
||||
struct grub_video_adapter *next;
|
||||
|
||||
/* The video adapter name. */
|
||||
const char *name;
|
||||
grub_video_driver_id_t id;
|
||||
|
||||
grub_video_adapter_prio_t prio;
|
||||
|
||||
/* Initialize the video adapter. */
|
||||
grub_err_t (*init) (void);
|
||||
|
||||
|
@ -255,15 +273,33 @@ struct grub_video_adapter
|
|||
grub_err_t (*set_active_render_target) (struct grub_video_render_target *target);
|
||||
|
||||
grub_err_t (*get_active_render_target) (struct grub_video_render_target **target);
|
||||
|
||||
/* The next video adapter. */
|
||||
struct grub_video_adapter *next;
|
||||
};
|
||||
typedef struct grub_video_adapter *grub_video_adapter_t;
|
||||
|
||||
void EXPORT_FUNC (grub_video_register) (grub_video_adapter_t adapter);
|
||||
void grub_video_unregister (grub_video_adapter_t adapter);
|
||||
void grub_video_iterate (int (*hook) (grub_video_adapter_t adapter));
|
||||
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_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
|
||||
grub_video_unregister (grub_video_adapter_t adapter)
|
||||
{
|
||||
grub_list_remove (GRUB_AS_LIST_P (&grub_video_adapter_list),
|
||||
GRUB_AS_LIST (adapter));
|
||||
}
|
||||
|
||||
#define FOR_VIDEO_ADAPTERS(var) FOR_LIST_ELEMENTS((var), (grub_video_adapter_list))
|
||||
|
||||
grub_err_t EXPORT_FUNC (grub_video_restore) (void);
|
||||
|
||||
|
|
|
@ -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 */
|
||||
|
|
49
kern/dl.c
49
kern/dl.c
|
@ -39,31 +39,17 @@
|
|||
|
||||
|
||||
|
||||
struct grub_dl_list
|
||||
{
|
||||
struct grub_dl_list *next;
|
||||
grub_dl_t mod;
|
||||
};
|
||||
typedef struct grub_dl_list *grub_dl_list_t;
|
||||
|
||||
static grub_dl_list_t grub_dl_head;
|
||||
grub_dl_t grub_dl_head = 0;
|
||||
|
||||
static grub_err_t
|
||||
grub_dl_add (grub_dl_t mod)
|
||||
{
|
||||
grub_dl_list_t l;
|
||||
|
||||
if (grub_dl_get (mod->name))
|
||||
return grub_error (GRUB_ERR_BAD_MODULE,
|
||||
"`%s' is already loaded", mod->name);
|
||||
|
||||
l = (grub_dl_list_t) grub_malloc (sizeof (*l));
|
||||
if (! l)
|
||||
return grub_errno;
|
||||
|
||||
l->mod = mod;
|
||||
l->next = grub_dl_head;
|
||||
grub_dl_head = l;
|
||||
mod->next = grub_dl_head;
|
||||
grub_dl_head = mod;
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
@ -71,13 +57,12 @@ grub_dl_add (grub_dl_t mod)
|
|||
static void
|
||||
grub_dl_remove (grub_dl_t mod)
|
||||
{
|
||||
grub_dl_list_t *p, q;
|
||||
grub_dl_t *p, q;
|
||||
|
||||
for (p = &grub_dl_head, q = *p; q; p = &q->next, q = *p)
|
||||
if (q->mod == mod)
|
||||
if (q == mod)
|
||||
{
|
||||
*p = q->next;
|
||||
grub_free (q);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
@ -85,25 +70,15 @@ grub_dl_remove (grub_dl_t mod)
|
|||
grub_dl_t
|
||||
grub_dl_get (const char *name)
|
||||
{
|
||||
grub_dl_list_t l;
|
||||
grub_dl_t l;
|
||||
|
||||
for (l = grub_dl_head; l; l = l->next)
|
||||
if (grub_strcmp (name, l->mod->name) == 0)
|
||||
return l->mod;
|
||||
if (grub_strcmp (name, l->name) == 0)
|
||||
return l;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
grub_dl_iterate (int (*hook) (grub_dl_t mod))
|
||||
{
|
||||
grub_dl_list_t l;
|
||||
|
||||
for (l = grub_dl_head; l; l = l->next)
|
||||
if (hook (l->mod))
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
|
||||
struct grub_symbol
|
||||
|
@ -694,11 +669,11 @@ grub_dl_unload_unneeded (void)
|
|||
{
|
||||
/* Because grub_dl_remove modifies the list of modules, this
|
||||
implementation is tricky. */
|
||||
grub_dl_list_t p = grub_dl_head;
|
||||
grub_dl_t p = grub_dl_head;
|
||||
|
||||
while (p)
|
||||
{
|
||||
if (grub_dl_unload (p->mod))
|
||||
if (grub_dl_unload (p))
|
||||
{
|
||||
p = grub_dl_head;
|
||||
continue;
|
||||
|
@ -714,13 +689,13 @@ grub_dl_unload_all (void)
|
|||
{
|
||||
while (grub_dl_head)
|
||||
{
|
||||
grub_dl_list_t p;
|
||||
grub_dl_t p;
|
||||
|
||||
grub_dl_unload_unneeded ();
|
||||
|
||||
/* Force to decrement the ref count. This will purge pre-loaded
|
||||
modules and manually inserted modules. */
|
||||
for (p = grub_dl_head; p; p = p->next)
|
||||
p->mod->ref_count--;
|
||||
p->ref_count--;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -346,6 +346,7 @@ grub_efi_mm_init (void)
|
|||
grub_efi_uintn_t desc_size;
|
||||
grub_efi_uint64_t total_pages;
|
||||
grub_efi_uint64_t required_pages;
|
||||
int mm_status;
|
||||
|
||||
/* First of all, allocate pages to maintain allocations. */
|
||||
allocated_pages
|
||||
|
@ -361,16 +362,32 @@ grub_efi_mm_init (void)
|
|||
if (! memory_map)
|
||||
grub_fatal ("cannot allocate memory");
|
||||
|
||||
filtered_memory_map = NEXT_MEMORY_DESCRIPTOR (memory_map, MEMORY_MAP_SIZE);
|
||||
|
||||
/* Obtain descriptors for available memory. */
|
||||
map_size = MEMORY_MAP_SIZE;
|
||||
|
||||
if (grub_efi_get_memory_map (&map_size, memory_map, 0, &desc_size, 0) < 0)
|
||||
mm_status = grub_efi_get_memory_map (&map_size, memory_map, 0, &desc_size, 0);
|
||||
|
||||
if (mm_status == 0)
|
||||
{
|
||||
grub_efi_free_pages
|
||||
((grub_efi_physical_address_t) ((grub_addr_t) memory_map),
|
||||
2 * BYTES_TO_PAGES (MEMORY_MAP_SIZE));
|
||||
|
||||
memory_map = grub_efi_allocate_pages (0, 2 * BYTES_TO_PAGES (map_size));
|
||||
if (! memory_map)
|
||||
grub_fatal ("cannot allocate memory");
|
||||
|
||||
mm_status = grub_efi_get_memory_map (&map_size, memory_map, 0,
|
||||
&desc_size, 0);
|
||||
}
|
||||
|
||||
if (mm_status < 0)
|
||||
grub_fatal ("cannot get memory map");
|
||||
|
||||
memory_map_end = NEXT_MEMORY_DESCRIPTOR (memory_map, map_size);
|
||||
|
||||
filtered_memory_map = memory_map_end;
|
||||
|
||||
filtered_memory_map_end = filter_memory_map (memory_map, filtered_memory_map,
|
||||
desc_size, memory_map_end);
|
||||
|
||||
|
|
|
@ -80,6 +80,86 @@ xgetcwd (void)
|
|||
return path;
|
||||
}
|
||||
|
||||
#ifdef __linux__
|
||||
|
||||
/* Statting something on a btrfs filesystem always returns a virtual device
|
||||
major/minor pair rather than the real underlying device, because btrfs
|
||||
can span multiple underlying devices (and even if it's currently only
|
||||
using a single device it can be dynamically extended onto another). We
|
||||
can't deal with the multiple-device case yet, but in the meantime, we can
|
||||
at least cope with the single-device case by scanning
|
||||
/proc/self/mountinfo. */
|
||||
static char *
|
||||
find_root_device_from_mountinfo (const char *dir)
|
||||
{
|
||||
FILE *fp;
|
||||
char *buf = NULL;
|
||||
size_t len = 0;
|
||||
char *ret = NULL;
|
||||
|
||||
fp = fopen ("/proc/self/mountinfo", "r");
|
||||
if (! fp)
|
||||
return NULL; /* fall through to other methods */
|
||||
|
||||
while (getline (&buf, &len, fp) > 0)
|
||||
{
|
||||
int mnt_id, parent_mnt_id;
|
||||
unsigned int major, minor;
|
||||
char enc_root[PATH_MAX], enc_path[PATH_MAX];
|
||||
int count;
|
||||
size_t enc_path_len;
|
||||
const char *sep;
|
||||
char fstype[PATH_MAX], device[PATH_MAX];
|
||||
struct stat st;
|
||||
|
||||
if (sscanf (buf, "%d %d %u:%u %s %s%n",
|
||||
&mnt_id, &parent_mnt_id, &major, &minor, enc_root, enc_path,
|
||||
&count) < 6)
|
||||
continue;
|
||||
|
||||
if (strcmp (enc_root, "/") != 0)
|
||||
continue; /* only a subtree is mounted */
|
||||
|
||||
enc_path_len = strlen (enc_path);
|
||||
if (strncmp (dir, enc_path, enc_path_len) != 0 ||
|
||||
(dir[enc_path_len] && dir[enc_path_len] != '/'))
|
||||
continue;
|
||||
|
||||
/* This is a parent of the requested directory. /proc/self/mountinfo
|
||||
is in mount order, so it must be the closest parent we've
|
||||
encountered so far. If it's virtual, return its device node;
|
||||
otherwise, carry on to try to find something closer. */
|
||||
|
||||
free (ret);
|
||||
ret = NULL;
|
||||
|
||||
if (major != 0)
|
||||
continue; /* not a virtual device */
|
||||
|
||||
sep = strstr (buf + count, " - ");
|
||||
if (!sep)
|
||||
continue;
|
||||
|
||||
sep += sizeof (" - ") - 1;
|
||||
if (sscanf (sep, "%s %s", fstype, device) != 2)
|
||||
continue;
|
||||
|
||||
if (stat (device, &st) < 0)
|
||||
continue;
|
||||
|
||||
if (!S_ISBLK (st.st_mode))
|
||||
continue; /* not a block device */
|
||||
|
||||
ret = strdup (device);
|
||||
}
|
||||
|
||||
free (buf);
|
||||
fclose (fp);
|
||||
return ret;
|
||||
}
|
||||
|
||||
#endif /* __linux__ */
|
||||
|
||||
#ifdef __MINGW32__
|
||||
|
||||
static char *
|
||||
|
@ -366,6 +446,12 @@ grub_guess_root_device (const char *dir)
|
|||
#else /* !__GNU__ */
|
||||
struct stat st;
|
||||
|
||||
#ifdef __linux__
|
||||
os_dev = find_root_device_from_mountinfo (dir);
|
||||
if (os_dev)
|
||||
return os_dev;
|
||||
#endif /* __linux__ */
|
||||
|
||||
if (stat (dir, &st) < 0)
|
||||
grub_util_error ("cannot stat `%s'", dir);
|
||||
|
||||
|
|
|
@ -342,7 +342,7 @@ find_partition_start (const char *dev)
|
|||
# endif /* !defined(__NetBSD__) */
|
||||
|
||||
# ifdef HAVE_DEVICE_MAPPER
|
||||
if (device_is_mapped (dev)) {
|
||||
if (grub_device_mapper_supported () && device_is_mapped (dev)) {
|
||||
struct dm_task *task = NULL;
|
||||
grub_uint64_t start, length;
|
||||
char *target_type, *params, *space;
|
||||
|
@ -413,7 +413,11 @@ devmapper_fail:
|
|||
if (fd == -1)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_DEVICE,
|
||||
# if !defined(__NetBSD__)
|
||||
"cannot open `%s' while attempting to get disk geometry", dev);
|
||||
# else /* defined(__NetBSD__) */
|
||||
"cannot open `%s' while attempting to get disk label", dev);
|
||||
# endif /* !defined(__NetBSD__) */
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -425,7 +429,11 @@ devmapper_fail:
|
|||
# endif /* !defined(__NetBSD__) */
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_DEVICE,
|
||||
# if !defined(__NetBSD__)
|
||||
"cannot get disk geometry of `%s'", dev);
|
||||
# else /* defined(__NetBSD__) */
|
||||
"cannot get disk label of `%s'", dev);
|
||||
# endif /* !defined(__NetBSD__) */
|
||||
close (fd);
|
||||
return 0;
|
||||
}
|
||||
|
@ -984,6 +992,11 @@ grub_util_biosdisk_fini (void)
|
|||
grub_disk_dev_unregister (&grub_util_biosdisk_dev);
|
||||
}
|
||||
|
||||
/*
|
||||
* Note: we do not use the new partition naming scheme as dos_part does not
|
||||
* necessarily correspond to an msdos partition. See e.g. the FreeBSD code
|
||||
* in function grub_util_biosdisk_get_grub_dev.
|
||||
*/
|
||||
static char *
|
||||
make_device_name (int drive, int dos_part, int bsd_part)
|
||||
{
|
||||
|
@ -1256,22 +1269,28 @@ devmapper_out:
|
|||
return path;
|
||||
|
||||
#elif defined(__NetBSD__)
|
||||
/* NetBSD uses "/dev/r[wsc]d[0-9]+[a-z]". */
|
||||
/* NetBSD uses "/dev/r[a-z]+[0-9][a-z]". */
|
||||
char *path = xstrdup (os_dev);
|
||||
if (strncmp ("/dev/rwd", path, 8) == 0 ||
|
||||
strncmp ("/dev/rsd", path, 8) == 0 ||
|
||||
strncmp ("/dev/rcd", path, 8) == 0)
|
||||
if (strncmp ("/dev/r", path, sizeof("/dev/r") - 1) == 0 &&
|
||||
(path[sizeof("/dev/r") - 1] >= 'a' && path[sizeof("/dev/r") - 1] <= 'z') &&
|
||||
strncmp ("fd", path + sizeof("/dev/r") - 1, sizeof("fd") - 1) != 0) /* not a floppy device name */
|
||||
{
|
||||
char *q;
|
||||
q = path + strlen(path) - 1; /* last character */
|
||||
if (grub_isalpha(*q) && grub_isdigit(*(q-1)))
|
||||
char *p;
|
||||
for (p = path + sizeof("/dev/r"); *p >= 'a' && *p <= 'z'; p++);
|
||||
if (grub_isdigit(*p))
|
||||
{
|
||||
p++;
|
||||
if ((*p >= 'a' && *p <= 'z') && (*(p+1) == '\0'))
|
||||
{
|
||||
/* path matches the required regular expression and
|
||||
p points to its last character. */
|
||||
int rawpart = -1;
|
||||
# ifdef HAVE_GETRAWPARTITION
|
||||
rawpart = getrawpartition();
|
||||
# endif /* HAVE_GETRAWPARTITION */
|
||||
if (rawpart >= 0)
|
||||
*q = 'a' + rawpart;
|
||||
*p = 'a' + rawpart;
|
||||
}
|
||||
}
|
||||
}
|
||||
return path;
|
||||
|
@ -1386,11 +1405,9 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
|
|||
For NetBSD, proceed as for Linux, except that the start sector is
|
||||
obtained from the disk label. */
|
||||
{
|
||||
char *name;
|
||||
char *name, *partname;
|
||||
grub_disk_t disk;
|
||||
grub_disk_addr_t start;
|
||||
int dos_part = -1;
|
||||
int bsd_part = -1;
|
||||
auto int find_partition (grub_disk_t dsk,
|
||||
const grub_partition_t partition);
|
||||
|
||||
|
@ -1405,17 +1422,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
|
|||
|
||||
if (start == part_start)
|
||||
{
|
||||
if (partition->parent)
|
||||
{
|
||||
dos_part = partition->parent->number;
|
||||
bsd_part = partition->number;
|
||||
}
|
||||
else
|
||||
{
|
||||
dos_part = partition->number;
|
||||
bsd_part = -1;
|
||||
}
|
||||
|
||||
partname = grub_partition_get_name (partition);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -1429,8 +1436,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
|
|||
return name;
|
||||
# else /* defined(__NetBSD__) */
|
||||
/* Since os_dev and convert_system_partition_to_system_disk (os_dev) are
|
||||
* different, we know that os_dev is of the form /dev/r[wsc]d[0-9]+[a-z]
|
||||
* and in particular it cannot be a floppy device. */
|
||||
* different, we know that os_dev cannot be a floppy device. */
|
||||
# endif /* !defined(__NetBSD__) */
|
||||
|
||||
start = find_partition_start (os_dev);
|
||||
|
@ -1452,6 +1458,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
|
|||
if (! disk)
|
||||
return 0;
|
||||
|
||||
partname = NULL;
|
||||
grub_partition_iterate (disk, find_partition);
|
||||
if (grub_errno != GRUB_ERR_NONE)
|
||||
{
|
||||
|
@ -1459,7 +1466,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
if (dos_part < 0)
|
||||
if (partname == NULL)
|
||||
{
|
||||
grub_disk_close (disk);
|
||||
grub_error (GRUB_ERR_BAD_DEVICE,
|
||||
|
@ -1467,7 +1474,9 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
return make_device_name (drive, dos_part, bsd_part);
|
||||
name = grub_xasprintf ("%s,%s", disk->name, partname);
|
||||
free (partname);
|
||||
return name;
|
||||
}
|
||||
|
||||
#elif defined(__GNU__)
|
||||
|
@ -1512,7 +1521,7 @@ grub_util_biosdisk_get_grub_dev (const char *os_dev)
|
|||
for (p = os_dev + 5; *p; ++p)
|
||||
if (grub_isdigit(*p))
|
||||
{
|
||||
p = strchr (p, 's');
|
||||
p = strchr (p, 's'); /* msdos or apple (or ... ?) partition map */
|
||||
if (p)
|
||||
{
|
||||
p++;
|
||||
|
|
|
@ -22,6 +22,10 @@
|
|||
#include <grub/time.h>
|
||||
#include <grub/emu/misc.h>
|
||||
|
||||
#ifdef HAVE_DEVICE_MAPPER
|
||||
# include <libdevmapper.h>
|
||||
#endif
|
||||
|
||||
int verbosity;
|
||||
|
||||
void
|
||||
|
@ -311,3 +315,38 @@ grub_make_system_path_relative_to_its_root (const char *path)
|
|||
|
||||
return buf3;
|
||||
}
|
||||
|
||||
#ifdef HAVE_DEVICE_MAPPER
|
||||
static void device_mapper_null_log (int level __attribute__ ((unused)),
|
||||
const char *file __attribute__ ((unused)),
|
||||
int line __attribute__ ((unused)),
|
||||
int dm_errno __attribute__ ((unused)),
|
||||
const char *f __attribute__ ((unused)),
|
||||
...)
|
||||
{
|
||||
}
|
||||
|
||||
int
|
||||
grub_device_mapper_supported (void)
|
||||
{
|
||||
static int supported = -1;
|
||||
|
||||
if (supported == -1)
|
||||
{
|
||||
struct dm_task *dmt;
|
||||
|
||||
/* Suppress annoying log messages. */
|
||||
dm_log_with_errno_init (&device_mapper_null_log);
|
||||
|
||||
dmt = dm_task_create (DM_DEVICE_VERSION);
|
||||
supported = (dmt != NULL);
|
||||
if (dmt)
|
||||
dm_task_destroy (dmt);
|
||||
|
||||
/* Restore the original logger. */
|
||||
dm_log_with_errno_init (NULL);
|
||||
}
|
||||
|
||||
return supported;
|
||||
}
|
||||
#endif /* HAVE_DEVICE_MAPPER */
|
||||
|
|
32
kern/fs.c
32
kern/fs.c
|
@ -27,40 +27,10 @@
|
|||
#include <grub/mm.h>
|
||||
#include <grub/term.h>
|
||||
|
||||
static grub_fs_t grub_fs_list;
|
||||
grub_fs_t grub_fs_list = 0;
|
||||
|
||||
grub_fs_autoload_hook_t grub_fs_autoload_hook = 0;
|
||||
|
||||
void
|
||||
grub_fs_register (grub_fs_t fs)
|
||||
{
|
||||
fs->next = grub_fs_list;
|
||||
grub_fs_list = fs;
|
||||
}
|
||||
|
||||
void
|
||||
grub_fs_unregister (grub_fs_t fs)
|
||||
{
|
||||
grub_fs_t *p, q;
|
||||
|
||||
for (p = &grub_fs_list, q = *p; q; p = &(q->next), q = q->next)
|
||||
if (q == fs)
|
||||
{
|
||||
*p = q->next;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
grub_fs_iterate (int (*hook) (const grub_fs_t fs))
|
||||
{
|
||||
grub_fs_t p;
|
||||
|
||||
for (p = grub_fs_list; p; p = p->next)
|
||||
if (hook (p))
|
||||
break;
|
||||
}
|
||||
|
||||
grub_fs_t
|
||||
grub_fs_probe (grub_device_t device)
|
||||
{
|
||||
|
|
|
@ -1,64 +0,0 @@
|
|||
/* handler.c - grub handler function */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2009 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/handler.h>
|
||||
|
||||
grub_handler_class_t grub_handler_class_list;
|
||||
|
||||
void
|
||||
grub_handler_register (grub_handler_class_t class, grub_handler_t handler)
|
||||
{
|
||||
int first_handler = (class->handler_list == 0);
|
||||
|
||||
grub_list_push (GRUB_AS_LIST_P (&class->handler_list),
|
||||
GRUB_AS_LIST (handler));
|
||||
|
||||
if (first_handler)
|
||||
{
|
||||
grub_list_push (GRUB_AS_LIST_P (&grub_handler_class_list),
|
||||
GRUB_AS_LIST (class));
|
||||
grub_handler_set_current (class, handler);
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
grub_handler_unregister (grub_handler_class_t class, grub_handler_t handler)
|
||||
{
|
||||
grub_list_remove (GRUB_AS_LIST_P (&class->handler_list),
|
||||
GRUB_AS_LIST (handler));
|
||||
|
||||
if (class->handler_list == 0)
|
||||
grub_list_remove (GRUB_AS_LIST_P (&grub_handler_class_list),
|
||||
GRUB_AS_LIST (class));
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_handler_set_current (grub_handler_class_t class, grub_handler_t handler)
|
||||
{
|
||||
if (class->cur_handler && class->cur_handler->fini)
|
||||
if ((class->cur_handler->fini) () != GRUB_ERR_NONE)
|
||||
return grub_errno;
|
||||
|
||||
if (handler->init)
|
||||
if ((handler->init) () != GRUB_ERR_NONE)
|
||||
return grub_errno;
|
||||
|
||||
class->cur_handler = handler;
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
|
@ -71,6 +71,9 @@ grub_exit (void)
|
|||
void
|
||||
grub_machine_init (void)
|
||||
{
|
||||
#ifdef GRUB_MACHINE_QEMU
|
||||
grub_qemu_init_cirrus ();
|
||||
#endif
|
||||
/* Initialize the console as early as possible. */
|
||||
grub_vga_text_init ();
|
||||
|
||||
|
|
|
@ -83,6 +83,14 @@ make_install_device (void)
|
|||
grub_snprintf (ptr, sizeof (dev) - (ptr - dev), ")%s", grub_prefix);
|
||||
grub_strcpy (grub_prefix, dev);
|
||||
}
|
||||
else if (grub_prefix[1] == ',' || grub_prefix[1] == ')')
|
||||
{
|
||||
/* We have a prefix, but still need to fill in the boot drive. */
|
||||
grub_snprintf (dev, sizeof (dev),
|
||||
"(%cd%u%s", (grub_boot_drive & 0x80) ? 'h' : 'f',
|
||||
grub_boot_drive & 0x7f, grub_prefix + 1);
|
||||
grub_strcpy (grub_prefix, dev);
|
||||
}
|
||||
|
||||
return grub_prefix;
|
||||
}
|
||||
|
|
152
kern/i386/qemu/init.c
Normal file
152
kern/i386/qemu/init.c
Normal file
|
@ -0,0 +1,152 @@
|
|||
/*
|
||||
* 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/>.
|
||||
*/
|
||||
|
||||
#include <grub/pci.h>
|
||||
#include <grub/machine/kernel.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/vga.h>
|
||||
|
||||
static struct {grub_uint8_t r, g, b, a; } colors[] =
|
||||
{
|
||||
// {R, G, B, A}
|
||||
{0x00, 0x00, 0x00, 0xFF}, // 0 = black
|
||||
{0x00, 0x00, 0xA8, 0xFF}, // 1 = blue
|
||||
{0x00, 0xA8, 0x00, 0xFF}, // 2 = green
|
||||
{0x00, 0xA8, 0xA8, 0xFF}, // 3 = cyan
|
||||
{0xA8, 0x00, 0x00, 0xFF}, // 4 = red
|
||||
{0xA8, 0x00, 0xA8, 0xFF}, // 5 = magenta
|
||||
{0xA8, 0x54, 0x00, 0xFF}, // 6 = brown
|
||||
{0xA8, 0xA8, 0xA8, 0xFF}, // 7 = light gray
|
||||
|
||||
{0x54, 0x54, 0x54, 0xFF}, // 8 = dark gray
|
||||
{0x54, 0x54, 0xFE, 0xFF}, // 9 = bright blue
|
||||
{0x54, 0xFE, 0x54, 0xFF}, // 10 = bright green
|
||||
{0x54, 0xFE, 0xFE, 0xFF}, // 11 = bright cyan
|
||||
{0xFE, 0x54, 0x54, 0xFF}, // 12 = bright red
|
||||
{0xFE, 0x54, 0xFE, 0xFF}, // 13 = bright magenta
|
||||
{0xFE, 0xFE, 0x54, 0xFF}, // 14 = yellow
|
||||
{0xFE, 0xFE, 0xFE, 0xFF} // 15 = white
|
||||
};
|
||||
|
||||
#include <ascii.h>
|
||||
|
||||
static void
|
||||
load_font (void)
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
grub_vga_gr_write (0 << 2, GRUB_VGA_GR_GR6);
|
||||
|
||||
grub_vga_sr_write (GRUB_VGA_SR_MEMORY_MODE_NORMAL, GRUB_VGA_SR_MEMORY_MODE);
|
||||
grub_vga_sr_write (1 << GRUB_VGA_TEXT_FONT_PLANE,
|
||||
GRUB_VGA_SR_MAP_MASK_REGISTER);
|
||||
|
||||
grub_vga_gr_write (0, GRUB_VGA_GR_DATA_ROTATE);
|
||||
grub_vga_gr_write (0, GRUB_VGA_GR_MODE);
|
||||
grub_vga_gr_write (0xff, GRUB_VGA_GR_BITMASK);
|
||||
|
||||
for (i = 0; i < 128; i++)
|
||||
grub_memcpy ((void *) (0xa0000 + 32 * i), ascii_bitmaps + 16 * (0x7f - i), 16);
|
||||
}
|
||||
|
||||
static void
|
||||
load_palette (void)
|
||||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < 16; i++)
|
||||
{
|
||||
grub_outb (i, GRUB_VGA_IO_ARX);
|
||||
grub_outb (i, GRUB_VGA_IO_ARX);
|
||||
}
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE (colors); i++)
|
||||
grub_vga_palette_write (i, colors[i].r, colors[i].g, colors[i].b);
|
||||
}
|
||||
|
||||
void
|
||||
grub_qemu_init_cirrus (void)
|
||||
{
|
||||
auto int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev, grub_pci_id_t pciid);
|
||||
int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev, grub_pci_id_t pciid __attribute__ ((unused)))
|
||||
{
|
||||
grub_pci_address_t addr;
|
||||
grub_uint32_t class;
|
||||
|
||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS);
|
||||
class = grub_pci_read (addr);
|
||||
|
||||
if (((class >> 16) & 0xffff) != 0x0300)
|
||||
return 0;
|
||||
|
||||
/* FIXME: chooose addresses dynamically. */
|
||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG0);
|
||||
grub_pci_write (addr, 0xf0000000 | GRUB_PCI_ADDR_MEM_PREFETCH
|
||||
| GRUB_PCI_ADDR_SPACE_MEMORY | GRUB_PCI_ADDR_MEM_TYPE_32);
|
||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG1);
|
||||
grub_pci_write (addr, 0xf2000000
|
||||
| GRUB_PCI_ADDR_SPACE_MEMORY | GRUB_PCI_ADDR_MEM_TYPE_32);
|
||||
|
||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND);
|
||||
grub_pci_write (addr, GRUB_PCI_COMMAND_MEM_ENABLED
|
||||
| GRUB_PCI_COMMAND_IO_ENABLED);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
grub_pci_iterate (find_card);
|
||||
|
||||
grub_outb (1, 0x3c2);
|
||||
|
||||
load_font ();
|
||||
|
||||
grub_vga_gr_write (GRUB_VGA_GR_GR6_MMAP_CGA, GRUB_VGA_GR_GR6);
|
||||
grub_vga_gr_write (GRUB_VGA_GR_MODE_ODD_EVEN, GRUB_VGA_GR_MODE);
|
||||
|
||||
grub_vga_sr_write (GRUB_VGA_SR_MEMORY_MODE_NORMAL, GRUB_VGA_SR_MEMORY_MODE);
|
||||
|
||||
grub_vga_sr_write ((1 << GRUB_VGA_TEXT_TEXT_PLANE)
|
||||
| (1 << GRUB_VGA_TEXT_ATTR_PLANE),
|
||||
GRUB_VGA_SR_MAP_MASK_REGISTER);
|
||||
|
||||
grub_vga_cr_write (15, GRUB_VGA_CR_CELL_HEIGHT);
|
||||
grub_vga_cr_write (79, GRUB_VGA_CR_WIDTH);
|
||||
grub_vga_cr_write (40, GRUB_VGA_CR_PITCH);
|
||||
|
||||
int vert = 25 * 16;
|
||||
grub_vga_cr_write (vert & 0xff, GRUB_VGA_CR_HEIGHT);
|
||||
grub_vga_cr_write (((vert >> GRUB_VGA_CR_OVERFLOW_HEIGHT1_SHIFT)
|
||||
& GRUB_VGA_CR_OVERFLOW_HEIGHT1_MASK)
|
||||
| ((vert >> GRUB_VGA_CR_OVERFLOW_HEIGHT2_SHIFT)
|
||||
& GRUB_VGA_CR_OVERFLOW_HEIGHT2_MASK),
|
||||
GRUB_VGA_CR_OVERFLOW);
|
||||
|
||||
load_palette ();
|
||||
|
||||
grub_outb (0x10, 0x3c0);
|
||||
grub_outb (0, 0x3c1);
|
||||
grub_outb (0x14, 0x3c0);
|
||||
grub_outb (0, 0x3c1);
|
||||
|
||||
grub_vga_sr_write (GRUB_VGA_SR_CLOCKING_MODE_8_DOT_CLOCK,
|
||||
GRUB_VGA_SR_CLOCKING_MODE);
|
||||
|
||||
grub_vga_cr_write (14, GRUB_VGA_CR_CURSOR_START);
|
||||
grub_vga_cr_write (15, GRUB_VGA_CR_CURSOR_END);
|
||||
|
||||
grub_outb (0x20, 0x3c0);
|
||||
}
|
|
@ -27,21 +27,37 @@
|
|||
#define QEMU_CMOS_MEMSIZE_HIGH 0x35
|
||||
#define QEMU_CMOS_MEMSIZE_LOW 0x34
|
||||
|
||||
#define QEMU_CMOS_MEMSIZE2_HIGH 0x31
|
||||
#define QEMU_CMOS_MEMSIZE2_LOW 0x30
|
||||
|
||||
#define min(a,b) ((a) > (b) ? (b) : (a))
|
||||
|
||||
extern char _start[];
|
||||
extern char _end[];
|
||||
|
||||
grub_size_t grub_lower_mem, grub_upper_mem;
|
||||
grub_uint64_t mem_size;
|
||||
static grub_uint64_t mem_size, above_4g;
|
||||
|
||||
void
|
||||
grub_machine_mmap_init ()
|
||||
{
|
||||
mem_size = grub_cmos_read (QEMU_CMOS_MEMSIZE_HIGH) << 24 | grub_cmos_read (QEMU_CMOS_MEMSIZE_LOW) << 16;
|
||||
|
||||
mem_size = ((grub_uint64_t) grub_cmos_read (QEMU_CMOS_MEMSIZE_HIGH)) << 24
|
||||
| ((grub_uint64_t) grub_cmos_read (QEMU_CMOS_MEMSIZE_LOW)) << 16;
|
||||
if (mem_size > 0)
|
||||
{
|
||||
/* Don't ask... */
|
||||
mem_size += (16 * 1024 * 1024);
|
||||
}
|
||||
else
|
||||
{
|
||||
mem_size
|
||||
= ((((grub_uint64_t) grub_cmos_read (QEMU_CMOS_MEMSIZE2_HIGH)) << 18)
|
||||
| ((grub_uint64_t) (grub_cmos_read (QEMU_CMOS_MEMSIZE2_LOW)) << 10))
|
||||
+ 1024 * 1024;
|
||||
}
|
||||
|
||||
above_4g = (((grub_uint64_t) grub_cmos_read (0x5b)) << 16)
|
||||
| (((grub_uint64_t) grub_cmos_read (0x5c)) << 24)
|
||||
| (((grub_uint64_t) grub_cmos_read (0x5d)) << 32);
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
|
@ -57,6 +73,12 @@ grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uin
|
|||
GRUB_MACHINE_MEMORY_RESERVED))
|
||||
return 1;
|
||||
|
||||
/* Everything else is free. */
|
||||
if (hook (0x100000,
|
||||
min (mem_size, (grub_uint32_t) -GRUB_BOOT_MACHINE_SIZE) - 0x100000,
|
||||
GRUB_MACHINE_MEMORY_AVAILABLE))
|
||||
return 1;
|
||||
|
||||
/* Protect boot.img, which contains the gdt. It is mapped at the top of memory
|
||||
(it is also mapped below 0x100000, but we already reserved that area). */
|
||||
if (hook ((grub_uint32_t) -GRUB_BOOT_MACHINE_SIZE,
|
||||
|
@ -64,9 +86,7 @@ grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uin
|
|||
GRUB_MACHINE_MEMORY_RESERVED))
|
||||
return 1;
|
||||
|
||||
/* Everything else is free. */
|
||||
if (hook (0x100000,
|
||||
min (mem_size, (grub_uint32_t) -GRUB_BOOT_MACHINE_SIZE) - 0x100000,
|
||||
if (above_4g != 0 && hook (0x100000000ULL, above_4g,
|
||||
GRUB_MACHINE_MEMORY_AVAILABLE))
|
||||
return 1;
|
||||
|
||||
|
|
82
kern/list.c
82
kern/list.c
|
@ -28,18 +28,6 @@ grub_list_push (grub_list_t *head, grub_list_t item)
|
|||
*head = item;
|
||||
}
|
||||
|
||||
void *
|
||||
grub_list_pop (grub_list_t *head)
|
||||
{
|
||||
grub_list_t item;
|
||||
|
||||
item = *head;
|
||||
if (item)
|
||||
*head = item->next;
|
||||
|
||||
return item;
|
||||
}
|
||||
|
||||
void
|
||||
grub_list_remove (grub_list_t *head, grub_list_t item)
|
||||
{
|
||||
|
@ -53,51 +41,16 @@ grub_list_remove (grub_list_t *head, grub_list_t item)
|
|||
}
|
||||
}
|
||||
|
||||
int
|
||||
grub_list_iterate (grub_list_t head, grub_list_hook_t hook)
|
||||
{
|
||||
grub_list_t p;
|
||||
|
||||
for (p = head; p; p = p->next)
|
||||
if (hook (p))
|
||||
return 1;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void
|
||||
grub_list_insert (grub_list_t *head, grub_list_t item,
|
||||
grub_list_test_t test)
|
||||
{
|
||||
grub_list_t *p, q;
|
||||
|
||||
for (p = head, q = *p; q; p = &(q->next), q = q->next)
|
||||
if (test (item, q))
|
||||
break;
|
||||
|
||||
*p = item;
|
||||
item->next = q;
|
||||
}
|
||||
|
||||
void *
|
||||
grub_named_list_find (grub_named_list_t head, const char *name)
|
||||
{
|
||||
grub_named_list_t result = NULL;
|
||||
grub_named_list_t item;
|
||||
|
||||
auto int list_find (grub_named_list_t item);
|
||||
int list_find (grub_named_list_t item)
|
||||
{
|
||||
if (! grub_strcmp (item->name, name))
|
||||
{
|
||||
result = item;
|
||||
return 1;
|
||||
}
|
||||
FOR_LIST_ELEMENTS (item, head)
|
||||
if (grub_strcmp (item->name, name) == 0)
|
||||
return item;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
grub_list_iterate (GRUB_AS_LIST (head), (grub_list_hook_t) list_find);
|
||||
return result;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -105,27 +58,30 @@ grub_prio_list_insert (grub_prio_list_t *head, grub_prio_list_t nitem)
|
|||
{
|
||||
int inactive = 0;
|
||||
|
||||
auto int test (grub_prio_list_t new_item, grub_prio_list_t item);
|
||||
int test (grub_prio_list_t new_item, grub_prio_list_t item)
|
||||
grub_prio_list_t *p, q;
|
||||
|
||||
for (p = head, q = *p; q; p = &(q->next), q = q->next)
|
||||
{
|
||||
int r;
|
||||
|
||||
r = grub_strcmp (new_item->name, item->name);
|
||||
if (r)
|
||||
return (r < 0);
|
||||
r = grub_strcmp (nitem->name, q->name);
|
||||
if (r < 0)
|
||||
break;
|
||||
if (r > 0)
|
||||
continue;
|
||||
|
||||
if (new_item->prio >= (item->prio & GRUB_PRIO_LIST_PRIO_MASK))
|
||||
if (nitem->prio >= (q->prio & GRUB_PRIO_LIST_PRIO_MASK))
|
||||
{
|
||||
item->prio &= ~GRUB_PRIO_LIST_FLAG_ACTIVE;
|
||||
return 1;
|
||||
q->prio &= ~GRUB_PRIO_LIST_FLAG_ACTIVE;
|
||||
break;
|
||||
}
|
||||
|
||||
inactive = 1;
|
||||
return 0;
|
||||
}
|
||||
|
||||
grub_list_insert (GRUB_AS_LIST_P (head), GRUB_AS_LIST (nitem),
|
||||
(grub_list_test_t) test);
|
||||
*p = nitem;
|
||||
nitem->next = q;
|
||||
|
||||
if (! inactive)
|
||||
nitem->prio |= GRUB_PRIO_LIST_FLAG_ACTIVE;
|
||||
}
|
||||
|
|
|
@ -191,7 +191,6 @@ grub_main (void)
|
|||
grub_set_root_dev ();
|
||||
|
||||
grub_register_core_commands ();
|
||||
grub_register_rescue_parser ();
|
||||
|
||||
grub_load_config ();
|
||||
grub_load_normal_mode ();
|
||||
|
|
|
@ -230,10 +230,6 @@ grub_parser_split_cmdline (const char *cmdline, grub_reader_getline_t getline,
|
|||
return 0;
|
||||
}
|
||||
|
||||
struct grub_handler_class grub_parser_class = {
|
||||
.name = "parser"
|
||||
};
|
||||
|
||||
grub_err_t
|
||||
grub_parser_execute (char *source)
|
||||
{
|
||||
|
@ -261,11 +257,9 @@ grub_parser_execute (char *source)
|
|||
while (source)
|
||||
{
|
||||
char *line;
|
||||
grub_parser_t parser;
|
||||
|
||||
getline (&line, 0);
|
||||
parser = grub_parser_get_current ();
|
||||
parser->parse_line (line, getline);
|
||||
grub_rescue_parse_line (line, getline);
|
||||
grub_free (line);
|
||||
}
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/command.h>
|
||||
|
||||
static grub_err_t
|
||||
grub_err_t
|
||||
grub_rescue_parse_line (char *line, grub_reader_getline_t getline)
|
||||
{
|
||||
char *name;
|
||||
|
@ -74,15 +74,3 @@ grub_rescue_parse_line (char *line, grub_reader_getline_t getline)
|
|||
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
static struct grub_parser grub_rescue_parser =
|
||||
{
|
||||
.name = "rescue",
|
||||
.parse_line = grub_rescue_parse_line
|
||||
};
|
||||
|
||||
void
|
||||
grub_register_rescue_parser (void)
|
||||
{
|
||||
grub_parser_register ("rescue", &grub_rescue_parser);
|
||||
}
|
||||
|
|
|
@ -86,7 +86,7 @@ grub_rescue_run (void)
|
|||
if (! line || line[0] == '\0')
|
||||
continue;
|
||||
|
||||
grub_parser_get_current ()->parse_line (line, grub_rescue_read_line);
|
||||
grub_rescue_parse_line (line, grub_rescue_read_line);
|
||||
grub_free (line);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -29,10 +29,11 @@
|
|||
#include <grub/cpu/linux.h>
|
||||
#include <grub/efi/api.h>
|
||||
#include <grub/efi/efi.h>
|
||||
#include <grub/efi/uga_draw.h>
|
||||
#include <grub/pci.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/memory.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/video.h>
|
||||
#include <grub/time.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
#define GRUB_LINUX_CL_OFFSET 0x1000
|
||||
|
@ -286,6 +287,67 @@ grub_e820_add_region (struct grub_e820_mmap *e820_map, int *e820_num,
|
|||
}
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_linux_setup_video (struct linux_kernel_params *params)
|
||||
{
|
||||
struct grub_video_mode_info mode_info;
|
||||
void *framebuffer;
|
||||
grub_err_t err;
|
||||
|
||||
err = grub_video_get_info_and_fini (&mode_info, &framebuffer);
|
||||
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
params->lfb_width = mode_info.width;
|
||||
params->lfb_height = mode_info.height;
|
||||
params->lfb_depth = mode_info.bpp;
|
||||
params->lfb_line_len = mode_info.pitch;
|
||||
|
||||
params->lfb_base = (grub_size_t) framebuffer;
|
||||
params->lfb_size = ALIGN_UP (params->lfb_line_len * params->lfb_height,
|
||||
65536);
|
||||
|
||||
params->red_mask_size = mode_info.red_mask_size;
|
||||
params->red_field_pos = mode_info.red_field_pos;
|
||||
params->green_mask_size = mode_info.green_mask_size;
|
||||
params->green_field_pos = mode_info.green_field_pos;
|
||||
params->blue_mask_size = mode_info.blue_mask_size;
|
||||
params->blue_field_pos = mode_info.blue_field_pos;
|
||||
params->reserved_mask_size = mode_info.reserved_mask_size;
|
||||
params->reserved_field_pos = mode_info.reserved_field_pos;
|
||||
|
||||
params->have_vga = GRUB_VIDEO_LINUX_TYPE_SIMPLE;
|
||||
|
||||
#ifdef GRUB_MACHINE_PCBIOS
|
||||
/* VESA packed modes may come with zeroed mask sizes, which need
|
||||
to be set here according to DAC Palette width. If we don't,
|
||||
this results in Linux displaying a black screen. */
|
||||
if (mode_info.bpp <= 8)
|
||||
{
|
||||
struct grub_vbe_info_block controller_info;
|
||||
int status;
|
||||
int width = 8;
|
||||
|
||||
status = grub_vbe_bios_get_controller_info (&controller_info);
|
||||
|
||||
if (status == GRUB_VBE_STATUS_OK &&
|
||||
(controller_info.capabilities & GRUB_VBE_CAPABILITY_DACWIDTH))
|
||||
status = grub_vbe_bios_set_dac_palette_width (&width);
|
||||
|
||||
if (status != GRUB_VBE_STATUS_OK)
|
||||
/* 6 is default after mode reset. */
|
||||
width = 6;
|
||||
|
||||
params->red_mask_size = params->green_mask_size
|
||||
= params->blue_mask_size = width;
|
||||
params->reserved_mask_size = 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#ifdef __x86_64__
|
||||
extern grub_uint8_t grub_linux_trampoline_start[];
|
||||
extern grub_uint8_t grub_linux_trampoline_end[];
|
||||
|
@ -300,6 +362,9 @@ grub_linux_boot (void)
|
|||
grub_efi_uintn_t desc_size;
|
||||
grub_efi_uint32_t desc_version;
|
||||
int e820_num;
|
||||
const char *modevar;
|
||||
char *tmp;
|
||||
grub_err_t err;
|
||||
|
||||
params = real_mode_mem;
|
||||
|
||||
|
@ -353,6 +418,35 @@ grub_linux_boot (void)
|
|||
grub_mmap_iterate (hook);
|
||||
params->mmap_size = e820_num;
|
||||
|
||||
grub_dprintf ("linux", "Trampoline at %p. code32=%x, real_mode_mem=%p\n",
|
||||
((char *) prot_mode_mem + (prot_mode_pages << 12)),
|
||||
(unsigned) params->code32_start, real_mode_mem);
|
||||
|
||||
modevar = grub_env_get ("gfxpayload");
|
||||
|
||||
/* Now all graphical modes are acceptable.
|
||||
May change in future if we have modes without framebuffer. */
|
||||
if (modevar && *modevar != 0)
|
||||
{
|
||||
tmp = grub_xasprintf ("%s;auto", modevar);
|
||||
if (! tmp)
|
||||
return grub_errno;
|
||||
err = grub_video_set_mode (tmp, GRUB_VIDEO_MODE_TYPE_PURE_TEXT, 0);
|
||||
grub_free (tmp);
|
||||
}
|
||||
else
|
||||
err = grub_video_set_mode ("auto", GRUB_VIDEO_MODE_TYPE_PURE_TEXT, 0);
|
||||
|
||||
if (!err)
|
||||
err = grub_linux_setup_video (params);
|
||||
|
||||
if (err)
|
||||
{
|
||||
grub_print_error ();
|
||||
grub_printf ("Booting however\n");
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
mmap_size = find_mmap_size ();
|
||||
if (grub_efi_get_memory_map (&mmap_size, mmap_buf, &map_key,
|
||||
&desc_size, &desc_version) <= 0)
|
||||
|
@ -425,174 +519,6 @@ grub_linux_unload (void)
|
|||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_efi_guid_t uga_draw_guid = GRUB_EFI_UGA_DRAW_GUID;
|
||||
|
||||
|
||||
#define RGB_MASK 0xffffff
|
||||
#define RGB_MAGIC 0x121314
|
||||
#define LINE_MIN 800
|
||||
#define LINE_MAX 4096
|
||||
#define FBTEST_STEP (0x10000 >> 2)
|
||||
#define FBTEST_COUNT 8
|
||||
|
||||
static int
|
||||
find_line_len (grub_uint32_t *fb_base, grub_uint32_t *line_len)
|
||||
{
|
||||
grub_uint32_t *base = (grub_uint32_t *) (grub_target_addr_t) *fb_base;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < FBTEST_COUNT; i++, base += FBTEST_STEP)
|
||||
{
|
||||
if ((*base & RGB_MASK) == RGB_MAGIC)
|
||||
{
|
||||
int j;
|
||||
|
||||
for (j = LINE_MIN; j <= LINE_MAX; j++)
|
||||
{
|
||||
if ((base[j] & RGB_MASK) == RGB_MAGIC)
|
||||
{
|
||||
*fb_base = (grub_uint32_t) (grub_target_addr_t) base;
|
||||
*line_len = j << 2;
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
find_framebuf (grub_uint32_t *fb_base, grub_uint32_t *line_len)
|
||||
{
|
||||
int found = 0;
|
||||
|
||||
auto int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev,
|
||||
grub_pci_id_t pciid);
|
||||
|
||||
int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev,
|
||||
grub_pci_id_t pciid)
|
||||
{
|
||||
grub_pci_address_t addr;
|
||||
|
||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS);
|
||||
if (grub_pci_read (addr) >> 24 == 0x3)
|
||||
{
|
||||
int i;
|
||||
|
||||
grub_printf ("Display controller: %d:%d.%d\nDevice id: %x\n",
|
||||
grub_pci_get_bus (dev), grub_pci_get_device (dev),
|
||||
grub_pci_get_function (dev), pciid);
|
||||
addr += 8;
|
||||
for (i = 0; i < 6; i++, addr += 4)
|
||||
{
|
||||
grub_uint32_t old_bar1, old_bar2, type;
|
||||
grub_uint64_t base64;
|
||||
|
||||
old_bar1 = grub_pci_read (addr);
|
||||
if ((! old_bar1) || (old_bar1 & GRUB_PCI_ADDR_SPACE_IO))
|
||||
continue;
|
||||
|
||||
type = old_bar1 & GRUB_PCI_ADDR_MEM_TYPE_MASK;
|
||||
if (type == GRUB_PCI_ADDR_MEM_TYPE_64)
|
||||
{
|
||||
if (i == 5)
|
||||
break;
|
||||
|
||||
old_bar2 = grub_pci_read (addr + 4);
|
||||
}
|
||||
else
|
||||
old_bar2 = 0;
|
||||
|
||||
base64 = old_bar2;
|
||||
base64 <<= 32;
|
||||
base64 |= (old_bar1 & GRUB_PCI_ADDR_MEM_MASK);
|
||||
|
||||
grub_printf ("%s(%d): 0x%llx\n",
|
||||
((old_bar1 & GRUB_PCI_ADDR_MEM_PREFETCH) ?
|
||||
"VMEM" : "MMIO"), i,
|
||||
(unsigned long long) base64);
|
||||
|
||||
if ((old_bar1 & GRUB_PCI_ADDR_MEM_PREFETCH) && (! found))
|
||||
{
|
||||
*fb_base = base64;
|
||||
if (find_line_len (fb_base, line_len))
|
||||
found++;
|
||||
}
|
||||
|
||||
if (type == GRUB_PCI_ADDR_MEM_TYPE_64)
|
||||
{
|
||||
i++;
|
||||
addr += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
grub_pci_iterate (find_card);
|
||||
return found;
|
||||
}
|
||||
|
||||
static int
|
||||
grub_linux_setup_video (struct linux_kernel_params *params)
|
||||
{
|
||||
grub_efi_uga_draw_protocol_t *c;
|
||||
grub_uint32_t width, height, depth, rate, pixel, fb_base, line_len;
|
||||
int ret;
|
||||
|
||||
c = grub_efi_locate_protocol (&uga_draw_guid, 0);
|
||||
if (! c)
|
||||
return 1;
|
||||
|
||||
if (efi_call_5 (c->get_mode, c, &width, &height, &depth, &rate))
|
||||
return 1;
|
||||
|
||||
grub_printf ("Video mode: %ux%u-%u@%u\n", width, height, depth, rate);
|
||||
|
||||
grub_efi_set_text_mode (0);
|
||||
pixel = RGB_MAGIC;
|
||||
efi_call_10 (c->blt, c, (struct grub_efi_uga_pixel *) &pixel,
|
||||
GRUB_EFI_UGA_VIDEO_FILL, 0, 0, 0, 0, 1, height, 0);
|
||||
ret = find_framebuf (&fb_base, &line_len);
|
||||
grub_efi_set_text_mode (1);
|
||||
|
||||
if (! ret)
|
||||
{
|
||||
grub_printf ("Can\'t find frame buffer address\n");
|
||||
return 1;
|
||||
}
|
||||
|
||||
grub_printf ("Frame buffer base: 0x%x\n", fb_base);
|
||||
grub_printf ("Video line length: %d\n", line_len);
|
||||
|
||||
params->lfb_width = width;
|
||||
params->lfb_height = height;
|
||||
params->lfb_depth = depth;
|
||||
params->lfb_line_len = line_len;
|
||||
|
||||
params->lfb_base = fb_base;
|
||||
params->lfb_size = ALIGN_UP (line_len * params->lfb_height, 65536);
|
||||
|
||||
params->red_mask_size = 8;
|
||||
params->red_field_pos = 16;
|
||||
params->green_mask_size = 8;
|
||||
params->green_field_pos = 8;
|
||||
params->blue_mask_size = 8;
|
||||
params->blue_field_pos = 0;
|
||||
params->reserved_mask_size = 8;
|
||||
params->reserved_field_pos = 24;
|
||||
|
||||
params->have_vga = GRUB_VIDEO_LINUX_TYPE_VESA;
|
||||
params->vid_mode = 0x338; /* 1024x768x32 */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
||||
int argc, char *argv[])
|
||||
|
@ -806,11 +732,9 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
grub_file_seek (file, real_size + GRUB_DISK_SECTOR_SIZE);
|
||||
|
||||
/* XXX there is no way to know if the kernel really supports EFI. */
|
||||
grub_printf (" [Linux-bzImage, setup=0x%x, size=0x%x]\n",
|
||||
grub_dprintf ("linux", "bzImage, setup=0x%x, size=0x%x\n",
|
||||
(unsigned) real_size, (unsigned) prot_size);
|
||||
|
||||
grub_linux_setup_video (params);
|
||||
|
||||
/* Detect explicitly specified memory size, if any. */
|
||||
linux_mem_size = 0;
|
||||
for (i = 1; i < argc; i++)
|
||||
|
@ -876,7 +800,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
|
||||
if (grub_errno == GRUB_ERR_NONE)
|
||||
{
|
||||
grub_loader_set (grub_linux_boot, grub_linux_unload, 1);
|
||||
grub_loader_set (grub_linux_boot, grub_linux_unload, 0);
|
||||
loaded = 1;
|
||||
}
|
||||
|
||||
|
@ -989,7 +913,7 @@ grub_cmd_initrd (grub_command_t cmd __attribute__ ((unused)),
|
|||
goto fail;
|
||||
}
|
||||
|
||||
grub_printf (" [Initrd, addr=0x%x, size=0x%x]\n",
|
||||
grub_dprintf ("linux", "Initrd, addr=0x%x, size=0x%x\n",
|
||||
(unsigned) addr, (unsigned) size);
|
||||
|
||||
lh->ramdisk_image = addr;
|
||||
|
|
|
@ -1,178 +0,0 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2009 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/env.h>
|
||||
#include <grub/xnu.h>
|
||||
#include <grub/cpu/xnu.h>
|
||||
#include <grub/efi/api.h>
|
||||
#include <grub/efi/efi.h>
|
||||
#include <grub/efi/uga_draw.h>
|
||||
#include <grub/pci.h>
|
||||
#include <grub/misc.h>
|
||||
|
||||
/* Setup video for xnu. Big parts are copied from linux.c. */
|
||||
|
||||
static grub_efi_guid_t uga_draw_guid = GRUB_EFI_UGA_DRAW_GUID;
|
||||
|
||||
#define RGB_MASK 0xffffff
|
||||
#define RGB_MAGIC 0x121314
|
||||
#define LINE_MIN 800
|
||||
#define LINE_MAX 4096
|
||||
#define FBTEST_STEP (0x10000 >> 2)
|
||||
#define FBTEST_COUNT 8
|
||||
|
||||
static int
|
||||
find_line_len (grub_uint32_t *fb_base, grub_uint32_t *line_len)
|
||||
{
|
||||
grub_uint32_t *base = (grub_uint32_t *) (grub_target_addr_t) *fb_base;
|
||||
int i;
|
||||
|
||||
for (i = 0; i < FBTEST_COUNT; i++, base += FBTEST_STEP)
|
||||
{
|
||||
if ((*base & RGB_MASK) == RGB_MAGIC)
|
||||
{
|
||||
int j;
|
||||
|
||||
for (j = LINE_MIN; j <= LINE_MAX; j++)
|
||||
{
|
||||
if ((base[j] & RGB_MASK) == RGB_MAGIC)
|
||||
{
|
||||
*fb_base = (grub_uint32_t) (grub_target_addr_t) base;
|
||||
*line_len = j << 2;
|
||||
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int
|
||||
find_framebuf (grub_uint32_t *fb_base, grub_uint32_t *line_len)
|
||||
{
|
||||
int found = 0;
|
||||
|
||||
auto int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev,
|
||||
grub_pci_id_t pciid);
|
||||
|
||||
int NESTED_FUNC_ATTR find_card (grub_pci_device_t dev,
|
||||
grub_pci_id_t pciid)
|
||||
{
|
||||
grub_pci_address_t addr;
|
||||
|
||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS);
|
||||
if (grub_pci_read (addr) >> 24 == 0x3)
|
||||
{
|
||||
int i;
|
||||
|
||||
grub_printf ("Display controller: %d:%d.%d\nDevice id: %x\n",
|
||||
grub_pci_get_bus (dev), grub_pci_get_device (dev),
|
||||
grub_pci_get_function (dev), pciid);
|
||||
addr += 8;
|
||||
for (i = 0; i < 6; i++, addr += 4)
|
||||
{
|
||||
grub_uint32_t old_bar1, old_bar2, type;
|
||||
grub_uint64_t base64;
|
||||
|
||||
old_bar1 = grub_pci_read (addr);
|
||||
if ((! old_bar1) || (old_bar1 & GRUB_PCI_ADDR_SPACE_IO))
|
||||
continue;
|
||||
|
||||
type = old_bar1 & GRUB_PCI_ADDR_MEM_TYPE_MASK;
|
||||
if (type == GRUB_PCI_ADDR_MEM_TYPE_64)
|
||||
{
|
||||
if (i == 5)
|
||||
break;
|
||||
|
||||
old_bar2 = grub_pci_read (addr + 4);
|
||||
}
|
||||
else
|
||||
old_bar2 = 0;
|
||||
|
||||
base64 = old_bar2;
|
||||
base64 <<= 32;
|
||||
base64 |= (old_bar1 & GRUB_PCI_ADDR_MEM_MASK);
|
||||
|
||||
grub_printf ("%s(%d): 0x%llx\n",
|
||||
((old_bar1 & GRUB_PCI_ADDR_MEM_PREFETCH) ?
|
||||
"VMEM" : "MMIO"), i,
|
||||
(unsigned long long) base64);
|
||||
|
||||
if ((old_bar1 & GRUB_PCI_ADDR_MEM_PREFETCH) && (! found))
|
||||
{
|
||||
*fb_base = base64;
|
||||
if (find_line_len (fb_base, line_len))
|
||||
found++;
|
||||
}
|
||||
|
||||
if (type == GRUB_PCI_ADDR_MEM_TYPE_64)
|
||||
{
|
||||
i++;
|
||||
addr += 4;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return found;
|
||||
}
|
||||
|
||||
grub_pci_iterate (find_card);
|
||||
return found;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_xnu_set_video (struct grub_xnu_boot_params *params)
|
||||
{
|
||||
grub_efi_uga_draw_protocol_t *c;
|
||||
grub_uint32_t width, height, depth, rate, pixel, fb_base, line_len;
|
||||
int ret;
|
||||
|
||||
c = grub_efi_locate_protocol (&uga_draw_guid, 0);
|
||||
if (! c)
|
||||
return grub_error (GRUB_ERR_IO, "couldn't find UGADraw");
|
||||
|
||||
if (efi_call_5 (c->get_mode, c, &width, &height, &depth, &rate))
|
||||
return grub_error (GRUB_ERR_IO, "couldn't retrieve video mode");
|
||||
|
||||
grub_printf ("Video mode: %ux%u-%u@%u\n", width, height, depth, rate);
|
||||
|
||||
grub_efi_set_text_mode (0);
|
||||
pixel = RGB_MAGIC;
|
||||
efi_call_10 (c->blt, c, (struct grub_efi_uga_pixel *) &pixel,
|
||||
GRUB_EFI_UGA_VIDEO_FILL, 0, 0, 0, 0, 1, height, 0);
|
||||
ret = find_framebuf (&fb_base, &line_len);
|
||||
grub_efi_set_text_mode (1);
|
||||
|
||||
if (! ret)
|
||||
return grub_error (GRUB_ERR_IO, "can\'t find frame buffer address");
|
||||
|
||||
grub_printf ("Frame buffer base: 0x%x\n", fb_base);
|
||||
grub_printf ("Video line length: %d\n", line_len);
|
||||
|
||||
params->lfb_width = width;
|
||||
params->lfb_height = height;
|
||||
params->lfb_depth = depth;
|
||||
params->lfb_line_len = line_len;
|
||||
params->lfb_mode = GRUB_XNU_VIDEO_TEXT_IN_VIDEO;
|
||||
params->lfb_base = fb_base;
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
|
@ -205,7 +205,7 @@ grub_cmd_linux (grub_command_t cmd __attribute__ ((unused)),
|
|||
real_size = setup_sects << GRUB_DISK_SECTOR_BITS;
|
||||
prot_size = grub_file_size (file) - real_size - GRUB_DISK_SECTOR_SIZE;
|
||||
|
||||
grub_printf (" [Linux-%s, setup=0x%x, size=0x%x]\n",
|
||||
grub_dprintf ("linux", "Linux-%s, setup=0x%x, size=0x%x\n",
|
||||
"bzImage", real_size, prot_size);
|
||||
|
||||
grub_file_seek (file, real_size + GRUB_DISK_SECTOR_SIZE);
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue