merge with mainline
This commit is contained in:
commit
b2d0e6c3fd
221 changed files with 8188 additions and 14930 deletions
|
@ -3,6 +3,8 @@
|
||||||
30_os-prober
|
30_os-prober
|
||||||
40_custom
|
40_custom
|
||||||
aclocal.m4
|
aclocal.m4
|
||||||
|
ascii.bitmaps
|
||||||
|
ascii.h
|
||||||
autom4te.cache
|
autom4te.cache
|
||||||
build_env.mk
|
build_env.mk
|
||||||
.bzrignore
|
.bzrignore
|
||||||
|
@ -48,6 +50,8 @@ grub_script_check_init.c
|
||||||
grub_script_check_init.h
|
grub_script_check_init.h
|
||||||
grub_script.tab.c
|
grub_script.tab.c
|
||||||
grub_script.tab.h
|
grub_script.tab.h
|
||||||
|
grub_script.yy.c
|
||||||
|
grub_script.yy.h
|
||||||
grub-set-default
|
grub-set-default
|
||||||
grub-setup
|
grub-setup
|
||||||
grub_setup_init.c
|
grub_setup_init.c
|
||||||
|
|
994
ChangeLog
994
ChangeLog
|
@ -1,3 +1,997 @@
|
||||||
|
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
|
||||||
|
to the empty string.
|
||||||
|
|
||||||
|
2010-05-28 BVK Chaitanya <bvk.groups@gmail.com>
|
||||||
|
|
||||||
|
Fix grub-emu issues on NetBSD, with gcc 4.1.3.
|
||||||
|
|
||||||
|
* conf/any-emu.rmk: Remove unnecessary COMMON_CFLAGS.
|
||||||
|
* include/grub/emu/misc.h (canonicalize_file_name): New Prototype.
|
||||||
|
* kern/misc.c (__enable_execute_stack): Disable on
|
||||||
|
GRUB_MACHINE_EMU.
|
||||||
|
|
||||||
|
2010-05-28 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
Make grub-probe work with symbolic links under /dev/mapper as well
|
||||||
|
as with real block devices. The Linux world seems to be (at best)
|
||||||
|
in transition here, and GRUB shouldn't get caught in the middle.
|
||||||
|
|
||||||
|
* kern/emu/getroot.c (find_root_device): Follow symbolic links under
|
||||||
|
/dev/mapper.
|
||||||
|
|
||||||
|
2010-05-27 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
* util/grub-script-check.c (main): Ensure defined behaviour on empty
|
||||||
|
input files (in which case exit zero).
|
||||||
|
|
||||||
|
2010-05-27 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
* kern/emu/misc.c (canonicalize_file_name): realpath can still
|
||||||
|
return NULL for various reasons even if it has a maximum-length
|
||||||
|
buffer: for example, there might be a symlink loop, or the path
|
||||||
|
might exceed PATH_MAX. If this happens, return NULL.
|
||||||
|
|
||||||
|
2010-05-27 Robert Millan <rmh@gnu.org>
|
||||||
|
|
||||||
|
* util/grub-mkconfig_lib.in (prepare_grub_to_access_device): Insert
|
||||||
|
partmap module to handle cross-partmap setups.
|
||||||
|
Reported by Orestes Mas. Gràcies!
|
||||||
|
|
||||||
|
2010-05-27 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
* util/grub-mkrescue.in: Initialise override_dir rather than
|
||||||
|
assuming that it's unset or empty in the environment.
|
||||||
|
|
||||||
|
2010-05-26 Grégoire Sutre <gregoire.sutre@gmail.com>
|
||||||
|
|
||||||
|
* kern/emu/hostdisk.c (find_partition_start) [__NetBSD__]: Renamed
|
||||||
|
variable index into p_index to suppress a warning with -Wshadow.
|
||||||
|
|
||||||
|
2010-05-25 BVK Chaitanya <bvk.groups@gmail.com>
|
||||||
|
|
||||||
|
* INSTALL: Added flex >= 2.5.35 requirement.
|
||||||
|
|
||||||
|
2010-05-23 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* commands/usbtest.c (grub_usb_get_string): Properly support UTF-16.
|
||||||
|
|
||||||
|
2010-05-23 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
cmostest support.
|
||||||
|
|
||||||
|
* commands/i386/cmostest.c: New file.
|
||||||
|
* conf/i386-coreboot.rmk (pkglib_MODULES): Add cmostest.mod.
|
||||||
|
(cmostest_mod_SOURCES): New variable.
|
||||||
|
(cmostest_mod_CFLAGS): Likewise.
|
||||||
|
(cmostest_mod_LDFLAGS): Likewise.
|
||||||
|
* conf/i386-pc.rmk: Likewise.
|
||||||
|
* docs/grub.texi (Vendor power-on keys): New section.
|
||||||
|
* util/grub-mkconfig.in: export GRUB_DEFAULT_BUTTON,
|
||||||
|
GRUB_HIDDEN_TIMEOUT_BUTTON, GRUB_TIMEOUT_BUTTON
|
||||||
|
and GRUB_BUTTON_CMOS_ADDRESS.
|
||||||
|
* util/grub.d/00_header.in: Handle powering-on by separate button.
|
||||||
|
|
||||||
|
2010-05-23 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* gfxmenu/gui_list.c (draw_menu): Don't add scrollbar width to padding.
|
||||||
|
Removed drawing_scrollbar argument. All users updated
|
||||||
|
Fixes #29792.
|
||||||
|
Reported by Jo Shields
|
||||||
|
|
||||||
|
2010-05-23 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* gfxmenu/view.c (grub_gfxmenu_draw_terminal_box): Apply only to current
|
||||||
|
buffer since gfxterm handles double repaint.
|
||||||
|
|
||||||
|
2010-05-23 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* gfxmenu/gfxmenu.c (grub_gfxmenu_try): Change viewport on both buffers.
|
||||||
|
* term/gfxterm.c (real_scroll): Likewise.
|
||||||
|
|
||||||
|
2010-05-21 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* kern/i386/pc/mmap.c (grub_machine_mmap_iterate): Zero-fill entry
|
||||||
|
before calling BIOS.
|
||||||
|
|
||||||
|
2010-05-21 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* include/grub/i18n.h: Always enable grub_gettext.
|
||||||
|
|
||||||
|
2010-05-21 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* kern/i386/pc/init.c (make_install_device): Fix a leftover usage of old
|
||||||
|
partition naming style.
|
||||||
|
|
||||||
|
2010-05-21 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
* util/grub-mkconfig.in: Fix handling of -o so that it works when
|
||||||
|
not the first option.
|
||||||
|
|
||||||
|
2010-05-20 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
* util/grub-mkrelpath.c (usage): Remove excess apostrophe.
|
||||||
|
|
||||||
|
2010-05-20 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
* util/misc.c: Move inclusion of <limits.h> to ...
|
||||||
|
* kern/emu/misc.c: ... here. Needed for canonicalize_file_name.
|
||||||
|
|
||||||
|
2010-05-20 Grégoire Sutre <gregoire.sutre@gmail.com>
|
||||||
|
|
||||||
|
* kern/emu/hostdisk.c (grub_util_biosdisk_get_grub_dev) [__NetBSD__]:
|
||||||
|
Fix merge error in NetBSD code.
|
||||||
|
(find_partition_start) [__NetBSD__]: Likewise.
|
||||||
|
|
||||||
|
2010-05-19 BVK Chaitanya <bvk.groups@gmail.com>
|
||||||
|
|
||||||
|
Fix grub-mkrescue usage unit testing.
|
||||||
|
|
||||||
|
* tests/util/grub-shell.in: Use --grub-mkimage with grub-mkrescue.
|
||||||
|
|
||||||
|
2010-05-18 Christian Franke <franke@computer.org>
|
||||||
|
|
||||||
|
* util/grub.d/10_windows.in: Use path names instead of
|
||||||
|
drive letters to prevent warning from Cygwin 1.7.
|
||||||
|
Add drivemap command to menuentry if needed.
|
||||||
|
|
||||||
|
2010-05-18 Justus Winter <4winter@informatik.uni-hamburg.de>
|
||||||
|
|
||||||
|
* util/grub.d/10_hurd.in: Include all gnumach* kernels, not only
|
||||||
|
gnumach and gnumach.gz.
|
||||||
|
|
||||||
|
2010-05-18 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* include/grub/i18n.h (gettext): Inline instead of using #define.
|
||||||
|
(grub_gettext): Likewise.
|
||||||
|
(_): Likewise.
|
||||||
|
|
||||||
|
2010-05-18 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* Makefile.in (CPPFLAGS): Replace -DGRUB_LIBDIR with
|
||||||
|
-DGRUB_PKGLIBROOTDIR= and prepend @PACKAGE_TARNAME@. All users updated.
|
||||||
|
* util/grub-mkimage.c (image_targets): Add i386-multiboot.
|
||||||
|
(main): Add a slash after pkglibdirroot.
|
||||||
|
|
||||||
|
2010-05-18 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* util/grub-install.in: Add missing "in" keyword.
|
||||||
|
|
||||||
|
2010-05-18 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* util/grub-mkrescue.in: Remove -O i386-pc duplication.
|
||||||
|
Reported by: Seth Goldberg.
|
||||||
|
|
||||||
|
2010-05-18 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
* po/POTFILES: Rename util/grub-mkrawimage.c to util/grub-mkimage.c.
|
||||||
|
|
||||||
|
2010-05-18 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
* configure.ac: Check for Linux device-mapper support.
|
||||||
|
|
||||||
|
* util/hostdisk.c (device_is_mapped): New function.
|
||||||
|
(find_partition_start): New function, partly broken out from
|
||||||
|
linux_find_partition and grub_util_biosdisk_get_grub_dev but with
|
||||||
|
device-mapper support added.
|
||||||
|
(linux_find_partition): Use find_partition_start.
|
||||||
|
(convert_system_partition_to_system_disk): Add `st' argument.
|
||||||
|
Support Linux /dev/mapper/* devices if device-mapper support is
|
||||||
|
available; only DM-RAID devices are understood at present.
|
||||||
|
(find_system_device): Add `st' argument. Pass it to
|
||||||
|
convert_system_partition_to_system_disk.
|
||||||
|
(grub_util_biosdisk_get_grub_dev): Pass stat result to
|
||||||
|
find_system_device and convert_system_partition_to_system_disk. Use
|
||||||
|
find_partition_start.
|
||||||
|
|
||||||
|
* conf/common.rmk (grub_mkdevicemap_SOURCES): Add kern/env.c,
|
||||||
|
kern/err.c, kern/list.c, kern/misc.c, and kern/emu/mm.c.
|
||||||
|
* util/deviceiter.c [__linux__]: Define MINOR.
|
||||||
|
(grub_util_iterate_devices): Add support for DM-RAID disk devices.
|
||||||
|
* util/mkdevicemap.c (grub_putchar): New function.
|
||||||
|
(grub_getkey): New function.
|
||||||
|
(grub_refresh): New function.
|
||||||
|
(main): Set debug=all if -v -v is used.
|
||||||
|
|
||||||
|
2010-05-18 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
Fix build with non-GNU libcs.
|
||||||
|
|
||||||
|
* util/misc.c (canonicalize_file_name): Move to ...
|
||||||
|
* kern/emu/misc.c (canonicalize_file_name): ... here. Needed by
|
||||||
|
grub_make_system_path_relative_to_its_root.
|
||||||
|
|
||||||
|
2010-05-18 Colin Watson <cjwatson@ubuntu.com>
|
||||||
|
|
||||||
|
* util/grub-mkrescue.in: Sync up with grub-install in terms of how
|
||||||
|
we handle finding grub-mkimage. Default to finding grub-mkimage in
|
||||||
|
${bindir} with program_transform_name applied, and provide a
|
||||||
|
--grub-mkimage option to override this.
|
||||||
|
|
||||||
|
2010-05-17 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Remove grub-mkisofs.
|
||||||
|
|
||||||
|
* conf/common.rmk (bin_UTILITIES): Remove grub-mkisofs.
|
||||||
|
(grub_mkisofs_SOURCES): Removed.
|
||||||
|
(grub_mkisofs_CFLAGS): Removed.
|
||||||
|
* util/mkisofs/defaults.h: Removed.
|
||||||
|
* util/mkisofs/eltorito.c: Likewise.
|
||||||
|
* util/mkisofs/exclude.h: Likewise.
|
||||||
|
* util/mkisofs/hash.c: Likewise.
|
||||||
|
* util/mkisofs/include/: Likewise.
|
||||||
|
* util/mkisofs/include/fctldefs.h: Likewise.
|
||||||
|
* util/mkisofs/include/mconfig.h: Likewise.
|
||||||
|
* util/mkisofs/include/prototyp.h: Likewise.
|
||||||
|
* util/mkisofs/include/statdefs.h: Likewise.
|
||||||
|
* util/mkisofs/iso9660.h: Likewise.
|
||||||
|
* util/mkisofs/joliet.c: Likewise.
|
||||||
|
* util/mkisofs/match.c: Likewise.
|
||||||
|
* util/mkisofs/match.h: Likewise.
|
||||||
|
* util/mkisofs/mkisofs.c: Likewise.
|
||||||
|
* util/mkisofs/mkisofs.h: Likewise.
|
||||||
|
* util/mkisofs/msdos_partition.h: Likewise.
|
||||||
|
* util/mkisofs/multi.c: Likewise.
|
||||||
|
* util/mkisofs/name.c: Likewise.
|
||||||
|
* util/mkisofs/rock.c: Likewise.
|
||||||
|
* util/mkisofs/tree.c: Likewise.
|
||||||
|
* util/mkisofs/write.c: Likewise.
|
||||||
|
|
||||||
|
2010-05-17 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Unify grub-mkimage accross platforms.
|
||||||
|
|
||||||
|
* Makefile.in (CPPFLAGS): Set GRUB_LIBDIR to $(libdir).
|
||||||
|
* conf/common.rmk (bin_UTILITIES): Removed grub-mkelfimage.
|
||||||
|
(grub_mkelfimage_SOURCES): Removed.
|
||||||
|
(util/elf/grub-mkimage.c_DEPENDENCIES): Renamed to ..
|
||||||
|
(util/grub-mkimage.c_DEPENDENCIES): .. this.
|
||||||
|
(bin_UTILITIES): Add grub-mkimage.
|
||||||
|
(grub_mkimage_SOURCES): New variable.
|
||||||
|
(kernel_img_HEADERS): Remove machine/kernel.h.
|
||||||
|
* conf/i386-pc.rmk (pkglib_IMAGES): Remove kernel.img.
|
||||||
|
(pkglib_PROGRAMS): Add kernel.img.
|
||||||
|
(kernel_img_HEADERS): Add machine/kernel.h.
|
||||||
|
(kernel_img_FORMAT): Removed.
|
||||||
|
(bin_UTILITIES): Remove grub-mkimage.
|
||||||
|
(grub_mkimage_SOURCES): Removed.
|
||||||
|
(grub_mkimage_CFLAGS): Likewise.
|
||||||
|
(util/grub-mkrawimage.c_DEPENDENCIES): Likewise.
|
||||||
|
* conf/i386-qemu.rmk (pkglib_IMAGES): Remove kernel.img.
|
||||||
|
(pkglib_PROGRAMS): Add kernel.img.
|
||||||
|
(bin_UTILITIES): Remove grub-mkimage.
|
||||||
|
(grub_mkimage_SOURCES): Removed.
|
||||||
|
(grub_mkimage_CFLAGS): Likewise.
|
||||||
|
(util/grub-mkrawimage.c_DEPENDENCIES): Likewise.
|
||||||
|
* conf/mips-qemu-mips.rmk (pkglib_IMAGES): Remove kernel.img.
|
||||||
|
(pkglib_PROGRAMS): Add kernel.img.
|
||||||
|
* conf/mips-yeeloong.rmk (pkglib_IMAGES): Remove kernel.img.
|
||||||
|
(pkglib_PROGRAMS): Add kernel.img.
|
||||||
|
* conf/mips.rmk (bin_UTILITIES): Remove grub-mkimage.
|
||||||
|
(grub_mkimage_SOURCES): Removed.
|
||||||
|
(grub_mkimage_CFLAGS): Likewise.
|
||||||
|
(util/grub-mkrawimage.c_DEPENDENCIES): Likewise.
|
||||||
|
* conf/sparc64-ieee1275.rmk (pkglib_IMAGES): Remove kernel.img.
|
||||||
|
(pkglib_PROGRAMS): Add kernel.img.
|
||||||
|
(bin_UTILITIES): Remove grub-mkimage.
|
||||||
|
(grub_mkimage_SOURCES): Removed.
|
||||||
|
(grub_mkimage_CFLAGS): Likewise.
|
||||||
|
(util/grub-mkrawimage.c_DEPENDENCIES): Likewise.
|
||||||
|
* conf/x86-efi.rmk (bin_UTILITIES): Remove grub-mkimage.
|
||||||
|
(grub_mkimage_SOURCES): Removed.
|
||||||
|
(grub_mkimage_CFLAGS): Likewise.
|
||||||
|
(util/grub-mkrawimage.c_DEPENDENCIES): Likewise.
|
||||||
|
* configure.ac (machine_CFLAGS): Add "-DMACHINE".
|
||||||
|
* include/grub/efi/pe32.h (grub_pe32_optional_header): Split into ...
|
||||||
|
(grub_pe32_optional_header): ... this.
|
||||||
|
(grub_pe64_optional_header): ... and this. All users updated.
|
||||||
|
(GRUB_PE32_PE32_MAGIC): Split into ..
|
||||||
|
(GRUB_PE32_PE32_MAGIC): .. this.
|
||||||
|
(GRUB_PE32_PE64_MAGIC): .. and this.
|
||||||
|
(GRUB_PE32_SIGNATURE_SIZE): New definition.
|
||||||
|
* include/grub/elf.h (PT_GNU_STACK): New definition.
|
||||||
|
* include/grub/i386/coreboot/kernel.h: Merged into include/grub/offsets.h. All users updated.
|
||||||
|
* include/grub/i386/efi/kernel.h: Likewise.
|
||||||
|
* include/grub/i386/kernel.h: Likewise.
|
||||||
|
* include/grub/i386/pc/kernel.h: Likewise.
|
||||||
|
* include/grub/i386/qemu/boot.h: Likewise.
|
||||||
|
* include/grub/mips/kernel.h: Likewise.
|
||||||
|
* include/grub/mips/qemu-mips/kernel.h: Likewise.
|
||||||
|
* include/grub/powerpc/ieee1275/kernel.h: Likewise.
|
||||||
|
* include/grub/powerpc/kernel.h: Likewise.
|
||||||
|
* include/grub/sparc64/ieee1275/boot.h: Likewise.
|
||||||
|
* include/grub/sparc64/ieee1275/kernel.h: Likewise.
|
||||||
|
* include/grub/sparc64/kernel.h: Likewise.
|
||||||
|
* include/grub/x86_64/efi/kernel.h: Likewise.
|
||||||
|
* include/grub/x86_64/kernel.h: Likewise.
|
||||||
|
* include/grub/offsets.h: New file.
|
||||||
|
* include/grub/kernel.h (grub_module_info): Split into ...
|
||||||
|
(grub_module_info32): ... this.
|
||||||
|
(grub_module_info64): ... and this.
|
||||||
|
* include/grub/i386/pc/boot.h (GRUB_BOOT_MACHINE_KERNEL_SEG): Moved from here ...
|
||||||
|
* include/grub/offsets.h (GRUB_BOOT_I386_PC_KERNEL_SEG): ... here.
|
||||||
|
(grub_boot_blocklist): Moved from here ...
|
||||||
|
* include/grub/offsets.h (grub_pc_bios_boot_blocklist): ... here.
|
||||||
|
* include/grub/i386/pc/memory.h (GRUB_MEMORY_MACHINE_UPPER): Moved from here.
|
||||||
|
* include/grub/offsets.h (GRUB_MEMORY_I386_PC_UPPER): .. here.
|
||||||
|
* include/grub/types.h (grub_target_to_host16): Removed.
|
||||||
|
(grub_target_to_host32): Likewise.
|
||||||
|
(grub_target_to_host64): Likewise.
|
||||||
|
(grub_host_to_target16): Likewise.
|
||||||
|
(grub_host_to_target32): Likewise.
|
||||||
|
(grub_host_to_target64): Likewise.
|
||||||
|
(grub_host_to_target_addr): Likewise.
|
||||||
|
|
||||||
|
Support grub-mkrescue for efi, coreboot and qemu.
|
||||||
|
|
||||||
|
* conf/x86-efi.rmk (bin_SCRIPTS): Add grub-mkrescue.
|
||||||
|
* kern/efi/init.c (grub_efi_set_prefix): Handle baked in prefix.
|
||||||
|
* util/elf/grub-mkimage.c: Merged into util/grub-mkimage.c.
|
||||||
|
* util/grub-mkrawimage.c: Moved from here ...
|
||||||
|
* util/grub-mkimage.c: ... here. All users updated.
|
||||||
|
(ALIGN_ADDR): Use image_target.
|
||||||
|
(TARGET_NO_FIELD): New const.
|
||||||
|
(image_target_desc): New type.
|
||||||
|
(image_targets): New array.
|
||||||
|
(grub_target_to_host64): Use image_target.
|
||||||
|
(grub_target_to_host32): Likewise.
|
||||||
|
(grub_target_to_host16): Likewise.
|
||||||
|
(grub_host_to_target64): Likewise.
|
||||||
|
(grub_host_to_target32): Likewise.
|
||||||
|
(grub_host_to_target16): Likewise.
|
||||||
|
(grub_host_to_target_addr): Likewise.
|
||||||
|
(generate_image): Handle multiimage.
|
||||||
|
(main): Require -O parameter. All users updated.
|
||||||
|
* util/grub-mkimagexx.c: New file. Based on util/grub-mkrawimage.c and
|
||||||
|
util/efi/grub-mkimage.c
|
||||||
|
* util/grub-mkrescue.in: Handle coreboot, efi and qemu.
|
||||||
|
New option --rom-directory.
|
||||||
|
Use xorriso.
|
||||||
|
* util/i386/efi/grub-mkimage.c: Removed.
|
||||||
|
* util/i386/pc/grub-setup.c (grub_target_to_host16): New definition.
|
||||||
|
(grub_target_to_host32): Likewise.
|
||||||
|
(grub_target_to_host64): Likewise.
|
||||||
|
(grub_host_to_target16): Likewise.
|
||||||
|
(grub_host_to_target32): Likewise.
|
||||||
|
(grub_host_to_target64): Likewise.
|
||||||
|
* util/sparc64/ieee1275/grub-setup.c (grub_target_to_host16): New definition.
|
||||||
|
(grub_target_to_host32): Likewise.
|
||||||
|
(grub_target_to_host64): Likewise.
|
||||||
|
(grub_host_to_target16): Likewise.
|
||||||
|
(grub_host_to_target32): Likewise.
|
||||||
|
(grub_host_to_target64): Likewise.
|
||||||
|
|
||||||
|
2010-05-17 BVK Chaitanya <bvk.groups@gmail.com>
|
||||||
|
|
||||||
|
Source tree is reorganized for emu build.
|
||||||
|
|
||||||
|
* include/grub/util/console.h: Move from here...
|
||||||
|
* include/grub/emu/console.h: ...to here.
|
||||||
|
* include/grub/util/getroot.h: Move from here...
|
||||||
|
* include/grub/emu/getroot.h: ...to here.
|
||||||
|
* include/grub/util/hostdisk.h: Move from here...
|
||||||
|
* include/grub/emu/hostdisk.h: ...to here.
|
||||||
|
* util/console.c: Move from here...
|
||||||
|
* kern/emu/console.c: ...to here.
|
||||||
|
* util/getroot.c: Move from here...
|
||||||
|
* kern/emu/getroot.c: ...to here.
|
||||||
|
* util/grub-emu.c: Move from here...
|
||||||
|
* kern/emu/main.c: ...to here.
|
||||||
|
* util/hostdisk.c: Move from here...
|
||||||
|
* kern/emu/hostdisk.c: ...to here.
|
||||||
|
* util/hostfs.c: Move from here...
|
||||||
|
* kern/emu/hostfs.c: ...to here.
|
||||||
|
* util/mm.c: Move from here...
|
||||||
|
* kern/emu/mm.c: ...to here.
|
||||||
|
* util/pci.c: Move from here...
|
||||||
|
* bus/emu/pci.c: ...to here.
|
||||||
|
* util/sdl.c: Move from here...
|
||||||
|
* video/emu/sdl.c: ...to here.
|
||||||
|
* util/time.c: Move from here...
|
||||||
|
* kern/emu/time.c: ...to here.
|
||||||
|
* util/usb.c: Move from here...
|
||||||
|
* bus/usb/emu/usb.c: ...to here.
|
||||||
|
|
||||||
|
* include/grub/emu/misc.h: New header for grub-emu functions.
|
||||||
|
* kern/emu/misc.c: grub-emu functions separated from util/misc.c
|
||||||
|
|
||||||
|
* conf/any-emu.rmk: Rule updates for above renames.
|
||||||
|
* conf/common.rmk: Likewise.
|
||||||
|
* conf/i386-pc.rmk: Likewise.
|
||||||
|
* conf/i386-qemu.rmk: Likewise.
|
||||||
|
* conf/mips.rmk: Likewise.
|
||||||
|
* conf/sparc64-ieee1275.rmk: Likewise.
|
||||||
|
* conf/x86-efi.rmk: Likewise.
|
||||||
|
|
||||||
|
* disk/lvm.h: #include updates for above renames.
|
||||||
|
* util/grub-mkrelpath.c: Likewise.
|
||||||
|
* util/grub-probe.c: Likewise.
|
||||||
|
* util/i386/pc/grub-setup.c: Likewise.
|
||||||
|
* util/sparc64/ieee1275/grub-setup.c: Likewise.
|
||||||
|
* kern/emu/console.c: Likewise.
|
||||||
|
* kern/emu/getroot.c: Likewise.
|
||||||
|
* kern/emu/hostdisk.c: Likewise.
|
||||||
|
* kern/emu/main.c: Likewise. (was grub-emu.c earlier)
|
||||||
|
|
||||||
|
* include/grub/dl.h: Remove grub_dl_{ref,unref}.
|
||||||
|
* include/grub/util/misc.h: Move grub-emu functions to emu/misc.h.
|
||||||
|
* kern/dl.c: Handle null mod in grub_dl_{ref,unref}.
|
||||||
|
* util/misc.c: Remove grub-emu functions.
|
||||||
|
|
||||||
|
2010-05-13 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
|
Fix gfxmenu crash.
|
||||||
|
Reported by: Thorsten Grützmacher.
|
||||||
|
|
||||||
|
* gfxmenu/gui_circular_progress.c (circprog_destroy): Unregister
|
||||||
|
timeout hook.
|
||||||
|
(circprog_set_property): Register and unregister timeout hook.
|
||||||
|
* gfxmenu/gui_label.c (grub_gui_label): New fields template and value.
|
||||||
|
(label_destroy): Free template. and unregister hook.
|
||||||
|
(label_set_state): New function.
|
||||||
|
(label_set_property): Handle templates and hooks.
|
||||||
|
* gfxmenu/gui_progress_bar.c (progress_bar_destroy): Unregister
|
||||||
|
timeout hook.
|
||||||
|
(progress_bar_set_property): Register and unregister timeout hook.
|
||||||
|
* gfxmenu/view.c (TIMEOUT_COMPONENT_ID): Move from here ...
|
||||||
|
* include/grub/gui.h (GRUB_GFXMENU_TIMEOUT_COMPONENT_ID): ...to here
|
||||||
|
* gfxmenu/view.c (grub_gfxmenu_timeout_notifications): New variable.
|
||||||
|
(update_timeout_visit): Removed.
|
||||||
|
(update_timeouts): New function.
|
||||||
|
(redraw_timeouts): Likewise.
|
||||||
|
(grub_gfxmenu_print_timeout): Use update_timeouts and redraw_timeouts.
|
||||||
|
(grub_gfxmenu_clear_timeout): Likewise.
|
||||||
|
* include/grub/gui.h (grub_gfxmenu_set_state_t): New type.
|
||||||
|
(grub_gfxmenu_timeout_notify): Likewise.
|
||||||
|
(grub_gfxmenu_timeout_notifications): New external variable.
|
||||||
|
(grub_gfxmenu_timeout_register): New function.
|
||||||
|
(grub_gfxmenu_timeout_unregister): Likewise.
|
||||||
|
|
||||||
2010-05-09 Vladimir Serbinenko <phcoder@gmail.com>
|
2010-05-09 Vladimir Serbinenko <phcoder@gmail.com>
|
||||||
|
|
||||||
Transform (broken) vga terminal into (working) vga video driver.
|
Transform (broken) vga terminal into (working) vga video driver.
|
||||||
|
|
16
INSTALL
16
INSTALL
|
@ -16,8 +16,24 @@ configuring the GRUB.
|
||||||
* GNU Bison 2.3 or later
|
* GNU Bison 2.3 or later
|
||||||
* GNU gettext 0.17 or later
|
* GNU gettext 0.17 or later
|
||||||
* GNU binutils 2.9.1.0.23 or later
|
* GNU binutils 2.9.1.0.23 or later
|
||||||
|
* Flex 2.5.35 or later
|
||||||
* Other standard GNU/Unix tools
|
* 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
|
If you use a development snapshot or want to hack on GRUB you may
|
||||||
need the following.
|
need the following.
|
||||||
|
|
||||||
|
|
10
Makefile.in
10
Makefile.in
|
@ -90,7 +90,7 @@ GNULIB_CFLAGS = $(GNULIB_UTIL_CFLAGS) $(POSIX_CFLAGS)
|
||||||
ASFLAGS = @ASFLAGS@
|
ASFLAGS = @ASFLAGS@
|
||||||
LDFLAGS = @LDFLAGS@ $(LIBS)
|
LDFLAGS = @LDFLAGS@ $(LIBS)
|
||||||
CPPFLAGS = @CPPFLAGS@ -I$(builddir) -I$(builddir)/include -I$(srcdir)/gnulib -I$(srcdir)/include -Wall -W \
|
CPPFLAGS = @CPPFLAGS@ -I$(builddir) -I$(builddir)/include -I$(srcdir)/gnulib -I$(srcdir)/include -Wall -W \
|
||||||
-DGRUB_LIBDIR=\"$(pkglibdir)\" -DLOCALEDIR=\"$(localedir)\"
|
-DGRUB_PKGLIBROOTDIR=\"$(libdir)/`echo @PACKAGE_TARNAME@ | sed '$(transform)'`\" -DLOCALEDIR=\"$(localedir)\"
|
||||||
TARGET_CC = @TARGET_CC@
|
TARGET_CC = @TARGET_CC@
|
||||||
TARGET_CFLAGS = -ffreestanding @TARGET_CFLAGS@
|
TARGET_CFLAGS = -ffreestanding @TARGET_CFLAGS@
|
||||||
TARGET_ASFLAGS = -nostdinc -fno-builtin @TARGET_ASFLAGS@
|
TARGET_ASFLAGS = -nostdinc -fno-builtin @TARGET_ASFLAGS@
|
||||||
|
@ -323,26 +323,26 @@ install-local: all
|
||||||
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
||||||
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
||||||
$(INSTALL_PROGRAM) $$dir$$file $(DESTDIR)$(bindir)/$$dest; \
|
$(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/$$dest.h2m -o $(DESTDIR)$(mandir)/man1/$$dest.1 $(builddir)/$$file; \
|
||||||
done
|
done
|
||||||
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(mandir)/man8
|
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(sbindir) $(DESTDIR)$(mandir)/man8
|
||||||
@list='$(sbin_UTILITIES)'; for file in $$list; do \
|
@list='$(sbin_UTILITIES)'; for file in $$list; do \
|
||||||
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
||||||
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
||||||
$(INSTALL_PROGRAM) $$dir$$file $(DESTDIR)$(sbindir)/$$dest; \
|
$(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/$$dest.h2m -o $(DESTDIR)$(mandir)/man8/$$dest.8 $(builddir)/$$file; \
|
||||||
done
|
done
|
||||||
@list='$(bin_SCRIPTS)'; for file in $$list; do \
|
@list='$(bin_SCRIPTS)'; for file in $$list; do \
|
||||||
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
||||||
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
||||||
$(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(bindir)/$$dest; \
|
$(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/$$dest.h2m -o $(DESTDIR)$(mandir)/man1/$$dest.1 $(builddir)/$$file; \
|
||||||
done
|
done
|
||||||
@list='$(sbin_SCRIPTS)'; for file in $$list; do \
|
@list='$(sbin_SCRIPTS)'; for file in $$list; do \
|
||||||
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
if test -f "$$file"; then dir=; else dir="$(srcdir)/"; fi; \
|
||||||
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
dest="`echo $$file | sed 's,.*/,,' | sed '$(transform)'`"; \
|
||||||
$(INSTALL_SCRIPT) $$dir$$file $(DESTDIR)$(sbindir)/$$dest; \
|
$(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/$$dest.h2m -o $(DESTDIR)$(mandir)/man8/$$dest.8 $(builddir)/$$file; \
|
||||||
done
|
done
|
||||||
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/grub.d
|
$(SHELL) $(mkinstalldirs) $(DESTDIR)$(sysconfdir)/grub.d
|
||||||
@list='$(grub-mkconfig_SCRIPTS)'; for file in $$list; do \
|
@list='$(grub-mkconfig_SCRIPTS)'; for file in $$list; do \
|
||||||
|
|
|
@ -31,7 +31,7 @@ _start:
|
||||||
|
|
||||||
jmp 1f
|
jmp 1f
|
||||||
|
|
||||||
. = _start + GRUB_BOOT_MACHINE_CORE_ENTRY_ADDR
|
. = _start + GRUB_BOOT_I386_QEMU_CORE_ENTRY_ADDR
|
||||||
VARIABLE(grub_core_entry_addr)
|
VARIABLE(grub_core_entry_addr)
|
||||||
.long 0
|
.long 0
|
||||||
1:
|
1:
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
#include <grub/boot.h>
|
#include <grub/boot.h>
|
||||||
#include <grub/machine/boot.h>
|
#include <grub/machine/boot.h>
|
||||||
|
#include <grub/offsets.h>
|
||||||
|
|
||||||
.text
|
.text
|
||||||
.align 4
|
.align 4
|
||||||
|
@ -87,8 +88,8 @@ after_info_block:
|
||||||
call console_write
|
call console_write
|
||||||
mov NOTIFICATION_STRING_LEN, %o3
|
mov NOTIFICATION_STRING_LEN, %o3
|
||||||
|
|
||||||
GET_ABS(firstlist - GRUB_BOOT_MACHINE_LIST_SIZE, %l2)
|
GET_ABS(firstlist - GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE, %l2)
|
||||||
set GRUB_BOOT_MACHINE_IMAGE_ADDRESS, %l3
|
set GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS, %l3
|
||||||
bootloop:
|
bootloop:
|
||||||
lduw [%l2 + 0x08], %o0
|
lduw [%l2 + 0x08], %o0
|
||||||
brz %o0, bootit
|
brz %o0, bootit
|
||||||
|
@ -115,7 +116,7 @@ bootloop:
|
||||||
mov NOTIFICATION_STEP_LEN, %o3
|
mov NOTIFICATION_STEP_LEN, %o3
|
||||||
|
|
||||||
ba bootloop
|
ba bootloop
|
||||||
sub %l2, GRUB_BOOT_MACHINE_LIST_SIZE, %l2
|
sub %l2, GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE, %l2
|
||||||
|
|
||||||
bootit:
|
bootit:
|
||||||
GET_ABS(prom_close_name, %o0)
|
GET_ABS(prom_close_name, %o0)
|
||||||
|
@ -127,8 +128,8 @@ bootit:
|
||||||
GET_ABS(notification_done, %o2)
|
GET_ABS(notification_done, %o2)
|
||||||
call console_write
|
call console_write
|
||||||
mov NOTIFICATION_DONE_LEN, %o3
|
mov NOTIFICATION_DONE_LEN, %o3
|
||||||
sethi %hi(GRUB_BOOT_MACHINE_IMAGE_ADDRESS), %o2
|
sethi %hi(GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS), %o2
|
||||||
jmpl %o2 + %lo(GRUB_BOOT_MACHINE_IMAGE_ADDRESS), %o7
|
jmpl %o2 + %lo(GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS), %o7
|
||||||
mov CIF_REG, %o4
|
mov CIF_REG, %o4
|
||||||
1: ba,a 1b
|
1: ba,a 1b
|
||||||
|
|
||||||
|
@ -136,7 +137,7 @@ lastlist:
|
||||||
.word 0
|
.word 0
|
||||||
.word 0
|
.word 0
|
||||||
|
|
||||||
. = _start + (0x200 - GRUB_BOOT_MACHINE_LIST_SIZE)
|
. = _start + (0x200 - GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE)
|
||||||
blocklist_default_start:
|
blocklist_default_start:
|
||||||
.word 0
|
.word 0
|
||||||
.word 2
|
.word 2
|
||||||
|
|
215
bus/cs5536.c
Normal file
215
bus/cs5536.c
Normal file
|
@ -0,0 +1,215 @@
|
||||||
|
/*
|
||||||
|
* 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/types.h>
|
||||||
|
#include <grub/cs5536.h>
|
||||||
|
#include <grub/pci.h>
|
||||||
|
#include <grub/time.h>
|
||||||
|
#include <grub/ata.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
grub_cs5536_find (grub_pci_device_t *devp)
|
||||||
|
{
|
||||||
|
int found = 0;
|
||||||
|
auto int NESTED_FUNC_ATTR hook (grub_pci_device_t dev,
|
||||||
|
grub_pci_id_t pciid);
|
||||||
|
|
||||||
|
int NESTED_FUNC_ATTR hook (grub_pci_device_t dev,
|
||||||
|
grub_pci_id_t pciid)
|
||||||
|
{
|
||||||
|
if (pciid == GRUB_CS5536_PCIID)
|
||||||
|
{
|
||||||
|
*devp = dev;
|
||||||
|
found = 1;
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
grub_pci_iterate (hook);
|
||||||
|
|
||||||
|
return found;
|
||||||
|
}
|
||||||
|
|
||||||
|
grub_uint64_t
|
||||||
|
grub_cs5536_read_msr (grub_pci_device_t dev, grub_uint32_t addr)
|
||||||
|
{
|
||||||
|
grub_uint64_t ret = 0;
|
||||||
|
grub_pci_write (grub_pci_make_address (dev, GRUB_CS5536_MSR_MAILBOX_ADDR),
|
||||||
|
addr);
|
||||||
|
ret = (grub_uint64_t)
|
||||||
|
grub_pci_read (grub_pci_make_address (dev, GRUB_CS5536_MSR_MAILBOX_DATA0));
|
||||||
|
ret |= (((grub_uint64_t)
|
||||||
|
grub_pci_read (grub_pci_make_address (dev,
|
||||||
|
GRUB_CS5536_MSR_MAILBOX_DATA1)))
|
||||||
|
<< 32);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
grub_cs5536_write_msr (grub_pci_device_t dev, grub_uint32_t addr,
|
||||||
|
grub_uint64_t val)
|
||||||
|
{
|
||||||
|
grub_pci_write (grub_pci_make_address (dev, GRUB_CS5536_MSR_MAILBOX_ADDR),
|
||||||
|
addr);
|
||||||
|
grub_pci_write (grub_pci_make_address (dev, GRUB_CS5536_MSR_MAILBOX_DATA0),
|
||||||
|
val & 0xffffffff);
|
||||||
|
grub_pci_write (grub_pci_make_address (dev, GRUB_CS5536_MSR_MAILBOX_DATA1),
|
||||||
|
val >> 32);
|
||||||
|
}
|
||||||
|
|
||||||
|
grub_err_t
|
||||||
|
grub_cs5536_smbus_wait (grub_port_t smbbase)
|
||||||
|
{
|
||||||
|
grub_uint64_t start = grub_get_time_ms ();
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
grub_uint8_t status;
|
||||||
|
status = grub_inb (smbbase + GRUB_CS5536_SMB_REG_STATUS);
|
||||||
|
if (status & GRUB_CS5536_SMB_REG_STATUS_SDAST)
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
if (status & GRUB_CS5536_SMB_REG_STATUS_BER)
|
||||||
|
return grub_error (GRUB_ERR_IO, "SM bus error");
|
||||||
|
if (status & GRUB_CS5536_SMB_REG_STATUS_NACK)
|
||||||
|
return grub_error (GRUB_ERR_IO, "NACK received");
|
||||||
|
if (grub_get_time_ms () > start + 40)
|
||||||
|
return grub_error (GRUB_ERR_IO, "SM stalled");
|
||||||
|
}
|
||||||
|
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
grub_err_t
|
||||||
|
grub_cs5536_read_spd_byte (grub_port_t smbbase, grub_uint8_t dev,
|
||||||
|
grub_uint8_t addr, grub_uint8_t *res)
|
||||||
|
{
|
||||||
|
grub_err_t err;
|
||||||
|
|
||||||
|
/* Send START. */
|
||||||
|
grub_outb (grub_inb (smbbase + GRUB_CS5536_SMB_REG_CTRL1)
|
||||||
|
| GRUB_CS5536_SMB_REG_CTRL1_START,
|
||||||
|
smbbase + GRUB_CS5536_SMB_REG_CTRL1);
|
||||||
|
|
||||||
|
/* Send device address. */
|
||||||
|
err = grub_cs5536_smbus_wait (smbbase);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
grub_outb (dev << 1, smbbase + GRUB_CS5536_SMB_REG_DATA);
|
||||||
|
|
||||||
|
/* Send ACK. */
|
||||||
|
err = grub_cs5536_smbus_wait (smbbase);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
grub_outb (grub_inb (smbbase + GRUB_CS5536_SMB_REG_CTRL1)
|
||||||
|
| GRUB_CS5536_SMB_REG_CTRL1_ACK,
|
||||||
|
smbbase + GRUB_CS5536_SMB_REG_CTRL1);
|
||||||
|
|
||||||
|
/* Send byte address. */
|
||||||
|
grub_outb (addr, smbbase + GRUB_CS5536_SMB_REG_DATA);
|
||||||
|
|
||||||
|
/* Send START. */
|
||||||
|
err = grub_cs5536_smbus_wait (smbbase);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
grub_outb (grub_inb (smbbase + GRUB_CS5536_SMB_REG_CTRL1)
|
||||||
|
| GRUB_CS5536_SMB_REG_CTRL1_START,
|
||||||
|
smbbase + GRUB_CS5536_SMB_REG_CTRL1);
|
||||||
|
|
||||||
|
/* Send device address. */
|
||||||
|
err = grub_cs5536_smbus_wait (smbbase);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
grub_outb ((dev << 1) | 1, smbbase + GRUB_CS5536_SMB_REG_DATA);
|
||||||
|
|
||||||
|
/* Send STOP. */
|
||||||
|
err = grub_cs5536_smbus_wait (smbbase);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
grub_outb (grub_inb (smbbase + GRUB_CS5536_SMB_REG_CTRL1)
|
||||||
|
| GRUB_CS5536_SMB_REG_CTRL1_STOP,
|
||||||
|
smbbase + GRUB_CS5536_SMB_REG_CTRL1);
|
||||||
|
|
||||||
|
err = grub_cs5536_smbus_wait (smbbase);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
*res = grub_inb (smbbase + GRUB_CS5536_SMB_REG_DATA);
|
||||||
|
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
grub_err_t
|
||||||
|
grub_cs5536_init_smbus (grub_pci_device_t dev, grub_uint16_t divisor,
|
||||||
|
grub_port_t *smbbase)
|
||||||
|
{
|
||||||
|
grub_uint64_t smbbar;
|
||||||
|
|
||||||
|
smbbar = grub_cs5536_read_msr (dev, GRUB_CS5536_MSR_SMB_BAR);
|
||||||
|
|
||||||
|
/* FIXME */
|
||||||
|
if (!(smbbar & GRUB_CS5536_LBAR_ENABLE))
|
||||||
|
return grub_error(GRUB_ERR_IO, "SMB controller not enabled\n");
|
||||||
|
*smbbase = (smbbar & GRUB_CS5536_LBAR_ADDR_MASK) + GRUB_MACHINE_PCI_IO_BASE;
|
||||||
|
|
||||||
|
if (divisor < 8)
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid divisor");
|
||||||
|
|
||||||
|
/* Disable SMB. */
|
||||||
|
grub_outb (0, *smbbase + GRUB_CS5536_SMB_REG_CTRL2);
|
||||||
|
|
||||||
|
/* Disable interrupts. */
|
||||||
|
grub_outb (0, *smbbase + GRUB_CS5536_SMB_REG_CTRL1);
|
||||||
|
|
||||||
|
/* Set as master. */
|
||||||
|
grub_outb (GRUB_CS5536_SMB_REG_ADDR_MASTER,
|
||||||
|
*smbbase + GRUB_CS5536_SMB_REG_ADDR);
|
||||||
|
|
||||||
|
/* Launch. */
|
||||||
|
grub_outb (((divisor >> 7) & 0xff), *smbbase + GRUB_CS5536_SMB_REG_CTRL3);
|
||||||
|
grub_outb (((divisor << 1) & 0xfe) | GRUB_CS5536_SMB_REG_CTRL2_ENABLE,
|
||||||
|
*smbbase + GRUB_CS5536_SMB_REG_CTRL2);
|
||||||
|
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
grub_err_t
|
||||||
|
grub_cs5536_read_spd (grub_port_t smbbase, grub_uint8_t dev,
|
||||||
|
struct grub_smbus_spd *res)
|
||||||
|
{
|
||||||
|
grub_err_t err;
|
||||||
|
grub_size_t size;
|
||||||
|
grub_uint8_t b;
|
||||||
|
grub_size_t ptr;
|
||||||
|
|
||||||
|
err = grub_cs5536_read_spd_byte (smbbase, dev, 0, &b);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
if (b == 0)
|
||||||
|
return grub_error (GRUB_ERR_IO, "no SPD found");
|
||||||
|
size = b;
|
||||||
|
|
||||||
|
((grub_uint8_t *) res)[0] = b;
|
||||||
|
for (ptr = 1; ptr < size; ptr++)
|
||||||
|
{
|
||||||
|
err = grub_cs5536_read_spd_byte (smbbase, dev, ptr,
|
||||||
|
&((grub_uint8_t *) res)[ptr]);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
54
bus/pci.c
54
bus/pci.c
|
@ -19,6 +19,50 @@
|
||||||
|
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
#include <grub/pci.h>
|
#include <grub/pci.h>
|
||||||
|
#include <grub/mm.h>
|
||||||
|
|
||||||
|
/* 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)
|
||||||
|
{
|
||||||
|
return grub_memalign (align, size);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
grub_dma_free (struct grub_pci_dma_chunk *ch)
|
||||||
|
{
|
||||||
|
grub_free (ch);
|
||||||
|
}
|
||||||
|
/* #endif */
|
||||||
|
|
||||||
|
#ifdef GRUB_MACHINE_MIPS_YEELOONG
|
||||||
|
volatile void *
|
||||||
|
grub_dma_get_virt (struct grub_pci_dma_chunk *ch)
|
||||||
|
{
|
||||||
|
return (void *) ((((grub_uint32_t) ch) & 0x1fffffff) | 0xa0000000);
|
||||||
|
}
|
||||||
|
|
||||||
|
grub_uint32_t
|
||||||
|
grub_dma_get_phys (struct grub_pci_dma_chunk *ch)
|
||||||
|
{
|
||||||
|
return (((grub_uint32_t) ch) & 0x1fffffff) | 0x80000000;
|
||||||
|
}
|
||||||
|
#else
|
||||||
|
|
||||||
|
volatile void *
|
||||||
|
grub_dma_get_virt (struct grub_pci_dma_chunk *ch)
|
||||||
|
{
|
||||||
|
return (void *) ch;
|
||||||
|
}
|
||||||
|
|
||||||
|
grub_uint32_t
|
||||||
|
grub_dma_get_phys (struct grub_pci_dma_chunk *ch)
|
||||||
|
{
|
||||||
|
return (grub_uint32_t) (grub_addr_t) ch;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
grub_pci_address_t
|
grub_pci_address_t
|
||||||
grub_pci_make_address (grub_pci_device_t dev, int reg)
|
grub_pci_make_address (grub_pci_device_t dev, int reg)
|
||||||
|
@ -48,6 +92,16 @@ grub_pci_iterate (grub_pci_iteratefunc_t hook)
|
||||||
if (id >> 16 == 0xFFFF)
|
if (id >> 16 == 0xFFFF)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
|
#ifdef GRUB_MACHINE_MIPS_YEELOONG
|
||||||
|
/* Skip ghosts. */
|
||||||
|
if (id == GRUB_YEELOONG_OHCI_PCIID
|
||||||
|
&& dev.function == GRUB_YEELOONG_OHCI_GHOST_FUNCTION)
|
||||||
|
continue;
|
||||||
|
if (id == GRUB_YEELOONG_EHCI_PCIID
|
||||||
|
&& dev.function == GRUB_YEELOONG_EHCI_GHOST_FUNCTION)
|
||||||
|
continue;
|
||||||
|
#endif
|
||||||
|
|
||||||
if (hook (dev, id))
|
if (hook (dev, id))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
|
@ -105,14 +105,14 @@ grub_usb_root_hub (grub_usb_controller_t controller __attribute__((unused)))
|
||||||
grub_usb_err_t
|
grub_usb_err_t
|
||||||
grub_usb_control_msg (grub_usb_device_t dev, grub_uint8_t reqtype,
|
grub_usb_control_msg (grub_usb_device_t dev, grub_uint8_t reqtype,
|
||||||
grub_uint8_t request, grub_uint16_t value,
|
grub_uint8_t request, grub_uint16_t value,
|
||||||
grub_uint16_t index, grub_size_t size, char *data)
|
grub_uint16_t idx, grub_size_t size, char *data)
|
||||||
{
|
{
|
||||||
usb_dev_handle *devh;
|
usb_dev_handle *devh;
|
||||||
struct usb_device *d = dev->data;
|
struct usb_device *d = dev->data;
|
||||||
|
|
||||||
devh = usb_open (d);
|
devh = usb_open (d);
|
||||||
if (usb_control_msg (devh, reqtype, request,
|
if (usb_control_msg (devh, reqtype, request,
|
||||||
value, index, data, size, 20) < 0)
|
value, idx, data, size, 20) < 0)
|
||||||
{
|
{
|
||||||
usb_close (devh);
|
usb_close (devh);
|
||||||
return GRUB_USB_ERR_STALL;
|
return GRUB_USB_ERR_STALL;
|
627
bus/usb/ohci.c
627
bus/usb/ohci.c
|
@ -24,8 +24,10 @@
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/pci.h>
|
#include <grub/pci.h>
|
||||||
#include <grub/cpu/pci.h>
|
#include <grub/cpu/pci.h>
|
||||||
#include <grub/i386/io.h>
|
#include <grub/cpu/io.h>
|
||||||
#include <grub/time.h>
|
#include <grub/time.h>
|
||||||
|
#include <grub/cs5536.h>
|
||||||
|
#include <grub/loader.h>
|
||||||
|
|
||||||
struct grub_ohci_hcca
|
struct grub_ohci_hcca
|
||||||
{
|
{
|
||||||
|
@ -63,13 +65,15 @@ struct grub_ohci_td
|
||||||
grub_uint32_t buffer_end;
|
grub_uint32_t buffer_end;
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
|
|
||||||
typedef struct grub_ohci_td *grub_ohci_td_t;
|
typedef volatile struct grub_ohci_td *grub_ohci_td_t;
|
||||||
typedef struct grub_ohci_ed *grub_ohci_ed_t;
|
typedef volatile struct grub_ohci_ed *grub_ohci_ed_t;
|
||||||
|
|
||||||
struct grub_ohci
|
struct grub_ohci
|
||||||
{
|
{
|
||||||
volatile grub_uint32_t *iobase;
|
volatile grub_uint32_t *iobase;
|
||||||
volatile struct grub_ohci_hcca *hcca;
|
volatile struct grub_ohci_hcca *hcca;
|
||||||
|
grub_uint32_t hcca_addr;
|
||||||
|
struct grub_pci_dma_chunk *hcca_chunk;
|
||||||
struct grub_ohci *next;
|
struct grub_ohci *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -91,10 +95,32 @@ typedef enum
|
||||||
GRUB_OHCI_REG_BULKCURR,
|
GRUB_OHCI_REG_BULKCURR,
|
||||||
GRUB_OHCI_REG_DONEHEAD,
|
GRUB_OHCI_REG_DONEHEAD,
|
||||||
GRUB_OHCI_REG_FRAME_INTERVAL,
|
GRUB_OHCI_REG_FRAME_INTERVAL,
|
||||||
|
GRUB_OHCI_REG_PERIODIC_START = 16,
|
||||||
GRUB_OHCI_REG_RHUBA = 18,
|
GRUB_OHCI_REG_RHUBA = 18,
|
||||||
GRUB_OHCI_REG_RHUBPORT = 21
|
GRUB_OHCI_REG_RHUBPORT = 21,
|
||||||
|
GRUB_OHCI_REG_LEGACY_CONTROL = 0x100,
|
||||||
|
GRUB_OHCI_REG_LEGACY_INPUT = 0x104,
|
||||||
|
GRUB_OHCI_REG_LEGACY_OUTPUT = 0x108,
|
||||||
|
GRUB_OHCI_REG_LEGACY_STATUS = 0x10c
|
||||||
} grub_ohci_reg_t;
|
} grub_ohci_reg_t;
|
||||||
|
|
||||||
|
#define GRUB_OHCI_RHUB_PORT_POWER_MASK 0x300
|
||||||
|
#define GRUB_OHCI_RHUB_PORT_ALL_POWERED 0x200
|
||||||
|
|
||||||
|
#define GRUB_OHCI_REG_FRAME_INTERVAL_FSMPS_MASK 0x8fff0000
|
||||||
|
#define GRUB_OHCI_REG_FRAME_INTERVAL_FSMPS_SHIFT 16
|
||||||
|
#define GRUB_OHCI_REG_FRAME_INTERVAL_FI_SHIFT 0
|
||||||
|
|
||||||
|
/* XXX: Is this choice of timings sane? */
|
||||||
|
#define GRUB_OHCI_FSMPS 0x2778
|
||||||
|
#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
|
static grub_uint32_t
|
||||||
grub_ohci_readreg32 (struct grub_ohci *o, grub_ohci_reg_t reg)
|
grub_ohci_readreg32 (struct grub_ohci *o, grub_ohci_reg_t reg)
|
||||||
{
|
{
|
||||||
|
@ -114,51 +140,81 @@ grub_ohci_writereg32 (struct grub_ohci *o,
|
||||||
controller. If this is the case, initialize it. */
|
controller. If this is the case, initialize it. */
|
||||||
static int NESTED_FUNC_ATTR
|
static int NESTED_FUNC_ATTR
|
||||||
grub_ohci_pci_iter (grub_pci_device_t dev,
|
grub_ohci_pci_iter (grub_pci_device_t dev,
|
||||||
grub_pci_id_t pciid __attribute__((unused)))
|
grub_pci_id_t pciid)
|
||||||
{
|
{
|
||||||
grub_uint32_t class_code;
|
|
||||||
grub_uint32_t class;
|
|
||||||
grub_uint32_t subclass;
|
|
||||||
grub_uint32_t interf;
|
grub_uint32_t interf;
|
||||||
grub_uint32_t base;
|
grub_uint32_t base;
|
||||||
grub_pci_address_t addr;
|
grub_pci_address_t addr;
|
||||||
struct grub_ohci *o;
|
struct grub_ohci *o;
|
||||||
grub_uint32_t revision;
|
grub_uint32_t revision;
|
||||||
grub_uint32_t frame_interval;
|
int cs5536;
|
||||||
|
|
||||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS);
|
|
||||||
class_code = grub_pci_read (addr) >> 8;
|
|
||||||
|
|
||||||
interf = class_code & 0xFF;
|
|
||||||
subclass = (class_code >> 8) & 0xFF;
|
|
||||||
class = class_code >> 16;
|
|
||||||
|
|
||||||
/* If this is not an OHCI controller, just return. */
|
|
||||||
if (class != 0x0c || subclass != 0x03 || interf != 0x10)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
/* Determine IO base address. */
|
/* Determine IO base address. */
|
||||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG0);
|
grub_dprintf ("ohci", "pciid = %x\n", pciid);
|
||||||
base = grub_pci_read (addr);
|
|
||||||
|
if (pciid == GRUB_CS5536_PCIID)
|
||||||
|
{
|
||||||
|
grub_uint64_t basereg;
|
||||||
|
|
||||||
|
cs5536 = 1;
|
||||||
|
basereg = grub_cs5536_read_msr (dev, GRUB_CS5536_MSR_USB_OHCI_BASE);
|
||||||
|
if (!(basereg & GRUB_CS5536_MSR_USB_BASE_MEMORY_ENABLE))
|
||||||
|
{
|
||||||
|
/* Shouldn't happen. */
|
||||||
|
grub_dprintf ("ohci", "No OHCI address is assigned\n");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
base = (basereg & GRUB_CS5536_MSR_USB_BASE_ADDR_MASK);
|
||||||
|
basereg |= GRUB_CS5536_MSR_USB_BASE_BUS_MASTER;
|
||||||
|
basereg &= ~GRUB_CS5536_MSR_USB_BASE_PME_ENABLED;
|
||||||
|
basereg &= ~GRUB_CS5536_MSR_USB_BASE_PME_STATUS;
|
||||||
|
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_USB_OHCI_BASE, basereg);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
grub_uint32_t class_code;
|
||||||
|
grub_uint32_t class;
|
||||||
|
grub_uint32_t subclass;
|
||||||
|
|
||||||
|
addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS);
|
||||||
|
class_code = grub_pci_read (addr) >> 8;
|
||||||
|
|
||||||
|
interf = class_code & 0xFF;
|
||||||
|
subclass = (class_code >> 8) & 0xFF;
|
||||||
|
class = class_code >> 16;
|
||||||
|
|
||||||
|
/* If this is not an OHCI controller, just return. */
|
||||||
|
if (class != 0x0c || subclass != 0x03 || interf != 0x10)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG0);
|
||||||
|
base = grub_pci_read (addr);
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
/* Stop if there is no IO space base address defined. */
|
/* Stop if there is no IO space base address defined. */
|
||||||
if (! (base & 1))
|
if (! (base & 1))
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
grub_dprintf ("ohci", "class=0x%02x 0x%02x interface 0x%02x\n",
|
||||||
|
class, subclass, interf);
|
||||||
|
}
|
||||||
|
|
||||||
/* Allocate memory for the controller and register it. */
|
/* Allocate memory for the controller and register it. */
|
||||||
o = grub_malloc (sizeof (*o));
|
o = grub_malloc (sizeof (*o));
|
||||||
if (! o)
|
if (! o)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
o->iobase = (grub_uint32_t *) base;
|
o->iobase = grub_pci_device_map_range (dev, base, 0x800);
|
||||||
|
|
||||||
|
grub_dprintf ("ohci", "base=%p\n", o->iobase);
|
||||||
|
|
||||||
/* Reserve memory for the HCCA. */
|
/* Reserve memory for the HCCA. */
|
||||||
o->hcca = (struct grub_ohci_hcca *) grub_memalign (256, 256);
|
o->hcca_chunk = grub_memalign_dma32 (256, 256);
|
||||||
|
if (! o->hcca_chunk)
|
||||||
grub_dprintf ("ohci", "class=0x%02x 0x%02x interface 0x%02x base=%p\n",
|
return 1;
|
||||||
class, subclass, interf, o->iobase);
|
o->hcca = grub_dma_get_virt (o->hcca_chunk);
|
||||||
|
o->hcca_addr = grub_dma_get_phys (o->hcca_chunk);
|
||||||
|
|
||||||
/* Check if the OHCI revision is actually 1.0 as supported. */
|
/* Check if the OHCI revision is actually 1.0 as supported. */
|
||||||
revision = grub_ohci_readreg32 (o, GRUB_OHCI_REG_REVISION);
|
revision = grub_ohci_readreg32 (o, GRUB_OHCI_REG_REVISION);
|
||||||
|
@ -166,27 +222,116 @@ grub_ohci_pci_iter (grub_pci_device_t dev,
|
||||||
if ((revision & 0xFF) != 0x10)
|
if ((revision & 0xFF) != 0x10)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
/* Backup the frame interval register. */
|
|
||||||
frame_interval = grub_ohci_readreg32 (o, GRUB_OHCI_REG_FRAME_INTERVAL);
|
{
|
||||||
|
grub_uint32_t control;
|
||||||
|
/* Check SMM/BIOS ownership of OHCI (SMM = USB Legacy Support driver for BIOS) */
|
||||||
|
control = grub_ohci_readreg32 (o, GRUB_OHCI_REG_CONTROL);
|
||||||
|
if ((control & 0x100) != 0)
|
||||||
|
{
|
||||||
|
unsigned i;
|
||||||
|
grub_dprintf("ohci", "OHCI is owned by SMM\n");
|
||||||
|
/* Do change of ownership */
|
||||||
|
/* Ownership change request */
|
||||||
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CMDSTATUS, (1<<3)); /* XXX: Magic. */
|
||||||
|
/* Waiting for SMM deactivation */
|
||||||
|
for (i=0; i < 10; i++)
|
||||||
|
{
|
||||||
|
if ((grub_ohci_readreg32 (o, GRUB_OHCI_REG_CONTROL) & 0x100) == 0)
|
||||||
|
{
|
||||||
|
grub_dprintf("ohci", "Ownership changed normally.\n");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
grub_millisleep (100);
|
||||||
|
}
|
||||||
|
if (i >= 10)
|
||||||
|
{
|
||||||
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CONTROL,
|
||||||
|
grub_ohci_readreg32 (o, GRUB_OHCI_REG_CONTROL) & ~0x100);
|
||||||
|
grub_dprintf("ohci", "Ownership changing timeout, change forced !\n");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if (((control & 0x100) == 0) &&
|
||||||
|
((control & 0xc0) != 0)) /* Not owned by SMM nor reset */
|
||||||
|
{
|
||||||
|
grub_dprintf("ohci", "OHCI is owned by BIOS\n");
|
||||||
|
/* Do change of ownership - not implemented yet... */
|
||||||
|
/* In fact we probably need to do nothing ...? */
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
grub_dprintf("ohci", "OHCI is not owned by SMM nor BIOS\n");
|
||||||
|
/* We can setup OHCI. */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Suspend the OHCI by issuing a reset. */
|
/* Suspend the OHCI by issuing a reset. */
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CMDSTATUS, 1); /* XXX: Magic. */
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CMDSTATUS, 1); /* XXX: Magic. */
|
||||||
grub_millisleep (1);
|
grub_millisleep (1);
|
||||||
grub_dprintf ("ohci", "OHCI reset\n");
|
grub_dprintf ("ohci", "OHCI reset\n");
|
||||||
|
|
||||||
/* Restore the frame interval register. */
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_FRAME_INTERVAL,
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_FRAME_INTERVAL, frame_interval);
|
(GRUB_OHCI_FSMPS
|
||||||
|
<< GRUB_OHCI_REG_FRAME_INTERVAL_FSMPS_SHIFT)
|
||||||
|
| (GRUB_OHCI_FRAME_INTERVAL
|
||||||
|
<< GRUB_OHCI_REG_FRAME_INTERVAL_FI_SHIFT));
|
||||||
|
|
||||||
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_PERIODIC_START,
|
||||||
|
GRUB_OHCI_PERIODIC_START);
|
||||||
|
|
||||||
/* Setup the HCCA. */
|
/* Setup the HCCA. */
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_HCCA, (grub_uint32_t) o->hcca);
|
o->hcca->donehead = 0;
|
||||||
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_HCCA, o->hcca_addr);
|
||||||
grub_dprintf ("ohci", "OHCI HCCA\n");
|
grub_dprintf ("ohci", "OHCI HCCA\n");
|
||||||
|
|
||||||
|
/* Misc. pre-sets. */
|
||||||
|
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);
|
||||||
|
|
||||||
|
/* Check OHCI Legacy Support */
|
||||||
|
if ((revision & 0x100) != 0)
|
||||||
|
{
|
||||||
|
grub_dprintf ("ohci", "Legacy Support registers detected\n");
|
||||||
|
grub_dprintf ("ohci", "Current state of legacy control reg.: 0x%04x\n",
|
||||||
|
grub_ohci_readreg32 (o, GRUB_OHCI_REG_LEGACY_CONTROL));
|
||||||
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_LEGACY_CONTROL,
|
||||||
|
(grub_ohci_readreg32 (o, GRUB_OHCI_REG_LEGACY_CONTROL)) & ~1);
|
||||||
|
grub_dprintf ("ohci", "OHCI Legacy Support disabled.\n");
|
||||||
|
}
|
||||||
|
|
||||||
/* Enable the OHCI. */
|
/* Enable the OHCI. */
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CONTROL,
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CONTROL,
|
||||||
(2 << 6));
|
(2 << 6));
|
||||||
grub_dprintf ("ohci", "OHCI enable: 0x%02x\n",
|
grub_dprintf ("ohci", "OHCI enable: 0x%02x\n",
|
||||||
(grub_ohci_readreg32 (o, GRUB_OHCI_REG_CONTROL) >> 6) & 3);
|
(grub_ohci_readreg32 (o, GRUB_OHCI_REG_CONTROL) >> 6) & 3);
|
||||||
|
|
||||||
|
/* Power on all ports */
|
||||||
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_RHUBA,
|
||||||
|
(grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBA)
|
||||||
|
& ~GRUB_OHCI_RHUB_PORT_POWER_MASK)
|
||||||
|
| GRUB_OHCI_RHUB_PORT_ALL_POWERED);
|
||||||
|
/* Wait for stable power (100ms) and stable attachment (100ms) */
|
||||||
|
/* I.e. minimum wait time should be probably 200ms. */
|
||||||
|
/* We assume that device is attached when ohci is loaded. */
|
||||||
|
/* Some devices take long time to power-on or indicate attach. */
|
||||||
|
/* Here is some experimental value which should probably mostly work. */
|
||||||
|
/* Cameras with manual USB mode selection and maybe some other similar
|
||||||
|
* devices will not work in some cases - they are repowered during
|
||||||
|
* ownership change and then they are starting slowly and mostly they
|
||||||
|
* are wanting select proper mode again...
|
||||||
|
* The same situation can be on computers where BIOS not set-up OHCI
|
||||||
|
* to be at least powered USB bus (maybe it is Yeelong case...?)
|
||||||
|
* Possible workaround could be for example some prompt
|
||||||
|
* for user with confirmation of proper USB device connection.
|
||||||
|
* Another workaround - "rmmod usbms", "rmmod ohci", proper start
|
||||||
|
* and configuration of USB device and then "insmod ohci"
|
||||||
|
* and "insmod usbms". */
|
||||||
|
grub_millisleep (500);
|
||||||
|
|
||||||
/* Link to ohci now that initialisation is successful. */
|
/* Link to ohci now that initialisation is successful. */
|
||||||
o->next = ohci;
|
o->next = ohci;
|
||||||
ohci = o;
|
ohci = o;
|
||||||
|
@ -195,10 +340,10 @@ grub_ohci_pci_iter (grub_pci_device_t dev,
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
if (o)
|
if (o)
|
||||||
grub_free ((void *) o->hcca);
|
grub_dma_free (o->hcca_chunk);
|
||||||
grub_free (o);
|
grub_free (o);
|
||||||
|
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -229,7 +374,7 @@ grub_ohci_iterate (int (*hook) (grub_usb_controller_t dev))
|
||||||
static void
|
static void
|
||||||
grub_ohci_transaction (grub_ohci_td_t td,
|
grub_ohci_transaction (grub_ohci_td_t td,
|
||||||
grub_transfer_type_t type, unsigned int toggle,
|
grub_transfer_type_t type, unsigned int toggle,
|
||||||
grub_size_t size, char *data)
|
grub_size_t size, grub_uint32_t data)
|
||||||
{
|
{
|
||||||
grub_uint32_t token;
|
grub_uint32_t token;
|
||||||
grub_uint32_t buffer;
|
grub_uint32_t buffer;
|
||||||
|
@ -254,20 +399,38 @@ grub_ohci_transaction (grub_ohci_td_t td,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#if 0 /* Always generate interrupt */
|
||||||
/* Generate no interrupts. */
|
/* Generate no interrupts. */
|
||||||
token |= 7 << 21;
|
token |= 7 << 21;
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Set the token. */
|
/* Set the token. */
|
||||||
token |= toggle << 24;
|
token |= toggle << 24;
|
||||||
token |= 1 << 25;
|
token |= 1 << 25;
|
||||||
|
|
||||||
buffer = (grub_uint32_t) data;
|
/* Set "Not accessed" error code */
|
||||||
|
token |= 15 << 28;
|
||||||
|
|
||||||
|
buffer = data;
|
||||||
buffer_end = buffer + size - 1;
|
buffer_end = buffer + size - 1;
|
||||||
|
|
||||||
|
/* Set correct buffer values in TD if zero transfer occurs */
|
||||||
|
if (size)
|
||||||
|
{
|
||||||
|
buffer = (grub_uint32_t) data;
|
||||||
|
buffer_end = buffer + size - 1;
|
||||||
|
td->buffer = grub_cpu_to_le32 (buffer);
|
||||||
|
td->buffer_end = grub_cpu_to_le32 (buffer_end);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
td->buffer = 0;
|
||||||
|
td->buffer_end = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Set the rest of TD */
|
||||||
td->token = grub_cpu_to_le32 (token);
|
td->token = grub_cpu_to_le32 (token);
|
||||||
td->buffer = grub_cpu_to_le32 (buffer);
|
|
||||||
td->next_td = 0;
|
td->next_td = 0;
|
||||||
td->buffer_end = grub_cpu_to_le32 (buffer_end);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_usb_err_t
|
static grub_usb_err_t
|
||||||
|
@ -276,7 +439,10 @@ grub_ohci_transfer (grub_usb_controller_t dev,
|
||||||
{
|
{
|
||||||
struct grub_ohci *o = (struct grub_ohci *) dev->data;
|
struct grub_ohci *o = (struct grub_ohci *) dev->data;
|
||||||
grub_ohci_ed_t ed;
|
grub_ohci_ed_t ed;
|
||||||
|
grub_uint32_t ed_addr;
|
||||||
|
struct grub_pci_dma_chunk *ed_chunk, *td_list_chunk;
|
||||||
grub_ohci_td_t td_list;
|
grub_ohci_td_t td_list;
|
||||||
|
grub_uint32_t td_list_addr;
|
||||||
grub_uint32_t target;
|
grub_uint32_t target;
|
||||||
grub_uint32_t td_tail;
|
grub_uint32_t td_tail;
|
||||||
grub_uint32_t td_head;
|
grub_uint32_t td_head;
|
||||||
|
@ -284,20 +450,30 @@ grub_ohci_transfer (grub_usb_controller_t dev,
|
||||||
grub_uint32_t control;
|
grub_uint32_t control;
|
||||||
grub_usb_err_t err;
|
grub_usb_err_t err;
|
||||||
int i;
|
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. */
|
/* Allocate an Endpoint Descriptor. */
|
||||||
ed = grub_memalign (16, sizeof (*ed));
|
ed_chunk = grub_memalign_dma32 (256, sizeof (*ed));
|
||||||
if (! ed)
|
if (! ed_chunk)
|
||||||
return GRUB_USB_ERR_INTERNAL;
|
return GRUB_USB_ERR_INTERNAL;
|
||||||
|
ed = grub_dma_get_virt (ed_chunk);
|
||||||
|
ed_addr = grub_dma_get_phys (ed_chunk);
|
||||||
|
|
||||||
td_list = grub_memalign (16, sizeof (*td_list) * (transfer->transcnt + 1));
|
td_list_chunk = grub_memalign_dma32 (256, sizeof (*td_list)
|
||||||
if (! td_list)
|
* (transfer->transcnt + 1));
|
||||||
|
if (! td_list_chunk)
|
||||||
{
|
{
|
||||||
grub_free ((void *) ed);
|
grub_dma_free (ed_chunk);
|
||||||
return GRUB_USB_ERR_INTERNAL;
|
return GRUB_USB_ERR_INTERNAL;
|
||||||
}
|
}
|
||||||
|
td_list = grub_dma_get_virt (td_list_chunk);
|
||||||
|
td_list_addr = grub_dma_get_phys (td_list_chunk);
|
||||||
|
|
||||||
grub_dprintf ("ohci", "alloc=%p\n", td_list);
|
grub_dprintf ("ohci", "alloc=%p/0x%x\n", td_list, td_list_addr);
|
||||||
|
|
||||||
/* Setup all Transfer Descriptors. */
|
/* Setup all Transfer Descriptors. */
|
||||||
for (i = 0; i < transfer->transcnt; i++)
|
for (i = 0; i < transfer->transcnt; i++)
|
||||||
|
@ -307,16 +483,31 @@ grub_ohci_transfer (grub_usb_controller_t dev,
|
||||||
grub_ohci_transaction (&td_list[i], tr->pid, tr->toggle,
|
grub_ohci_transaction (&td_list[i], tr->pid, tr->toggle,
|
||||||
tr->size, tr->data);
|
tr->size, tr->data);
|
||||||
|
|
||||||
td_list[i].next_td = grub_cpu_to_le32 (&td_list[i + 1]);
|
td_list[i].next_td = grub_cpu_to_le32 (td_list_addr
|
||||||
|
+ (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;
|
||||||
|
td_list[transfer->transcnt].buffer_end = 0;
|
||||||
|
td_list[transfer->transcnt].next_td =
|
||||||
|
(grub_uint32_t) &td_list[transfer->transcnt];
|
||||||
|
|
||||||
/* Setup the Endpoint Descriptor. */
|
/* Setup the Endpoint Descriptor. */
|
||||||
|
|
||||||
/* Set the device address. */
|
/* Set the device address. */
|
||||||
target = transfer->devaddr;
|
target = transfer->devaddr;
|
||||||
|
|
||||||
/* Set the endpoint. */
|
/* Set the endpoint. It should be masked, we need 4 bits only. */
|
||||||
target |= transfer->endpoint << 7;
|
target |= (transfer->endpoint & 15) << 7;
|
||||||
|
|
||||||
/* Set the device speed. */
|
/* Set the device speed. */
|
||||||
target |= (transfer->dev->speed == GRUB_USB_SPEED_LOW) << 13;
|
target |= (transfer->dev->speed == GRUB_USB_SPEED_LOW) << 13;
|
||||||
|
@ -324,9 +515,9 @@ grub_ohci_transfer (grub_usb_controller_t dev,
|
||||||
/* Set the maximum packet size. */
|
/* Set the maximum packet size. */
|
||||||
target |= transfer->max << 16;
|
target |= transfer->max << 16;
|
||||||
|
|
||||||
td_head = (grub_uint32_t) td_list;
|
td_head = td_list_addr;
|
||||||
|
|
||||||
td_tail = (grub_uint32_t) &td_list[transfer->transcnt];
|
td_tail = td_list_addr + transfer->transcnt * sizeof (*td_list);
|
||||||
|
|
||||||
ed->target = grub_cpu_to_le32 (target);
|
ed->target = grub_cpu_to_le32 (target);
|
||||||
ed->td_head = grub_cpu_to_le32 (td_head);
|
ed->td_head = grub_cpu_to_le32 (td_head);
|
||||||
|
@ -335,6 +526,30 @@ grub_ohci_transfer (grub_usb_controller_t dev,
|
||||||
|
|
||||||
grub_dprintf ("ohci", "program OHCI\n");
|
grub_dprintf ("ohci", "program OHCI\n");
|
||||||
|
|
||||||
|
/* Disable the Control and Bulk lists. */
|
||||||
|
control = grub_ohci_readreg32 (o, GRUB_OHCI_REG_CONTROL);
|
||||||
|
control &= ~(3 << 4);
|
||||||
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CONTROL, control);
|
||||||
|
|
||||||
|
/* Clear BulkListFilled and ControlListFilled. */
|
||||||
|
status = grub_ohci_readreg32 (o, GRUB_OHCI_REG_CMDSTATUS);
|
||||||
|
status &= ~(3 << 1);
|
||||||
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CMDSTATUS, status);
|
||||||
|
|
||||||
|
/* Now we should wait for start of next frame. Because we are not using
|
||||||
|
* interrupt, we reset SF bit and wait when it goes to 1. */
|
||||||
|
/* 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);
|
||||||
|
/* Now it should be safe to change CONTROL and BULK lists. */
|
||||||
|
|
||||||
|
/* This we do for safety's sake - it should be done in previous call
|
||||||
|
* of grub_ohci_transfer and nobody should change it in meantime...
|
||||||
|
* It should be done before start of control or bulk OHCI list. */
|
||||||
|
o->hcca->donehead = 0;
|
||||||
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_INTSTATUS, (1 << 1)); /* Clears WDH */
|
||||||
|
|
||||||
/* Program the OHCI to actually transfer. */
|
/* Program the OHCI to actually transfer. */
|
||||||
switch (transfer->type)
|
switch (transfer->type)
|
||||||
{
|
{
|
||||||
|
@ -342,24 +557,22 @@ grub_ohci_transfer (grub_usb_controller_t dev,
|
||||||
{
|
{
|
||||||
grub_dprintf ("ohci", "add to bulk list\n");
|
grub_dprintf ("ohci", "add to bulk list\n");
|
||||||
|
|
||||||
status = grub_ohci_readreg32 (o, GRUB_OHCI_REG_CMDSTATUS);
|
/* Set BulkList Head and Current */
|
||||||
control = grub_ohci_readreg32 (o, GRUB_OHCI_REG_CONTROL);
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_BULKHEAD, ed_addr);
|
||||||
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_BULKCURR, 0);
|
||||||
|
|
||||||
/* Disable the Control and Bulk lists. */
|
#define GRUB_OHCI_REG_CONTROL_BULK_ENABLE (1 << 5)
|
||||||
control &= ~(3 << 4);
|
#define GRUB_OHCI_REG_CONTROL_CONTROL_ENABLE (1 << 4)
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CONTROL, control);
|
|
||||||
|
|
||||||
/* Clear BulkListFilled. */
|
|
||||||
status &= ~(1 << 2);
|
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CMDSTATUS, status);
|
|
||||||
|
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_BULKHEAD, (grub_uint32_t) ed);
|
|
||||||
|
|
||||||
/* Enable the Bulk list. */
|
/* Enable the Bulk list. */
|
||||||
control |= 1 << 5;
|
control = grub_ohci_readreg32 (o, GRUB_OHCI_REG_CONTROL);
|
||||||
|
control |= GRUB_OHCI_REG_CONTROL_BULK_ENABLE;
|
||||||
|
control &= ~GRUB_OHCI_REG_CONTROL_CONTROL_ENABLE;
|
||||||
|
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CONTROL, control);
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CONTROL, control);
|
||||||
|
|
||||||
/* Set BulkListFilled. */
|
/* Set BulkListFilled. */
|
||||||
|
status = grub_ohci_readreg32 (o, GRUB_OHCI_REG_CMDSTATUS);
|
||||||
status |= 1 << 2;
|
status |= 1 << 2;
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CMDSTATUS, status);
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CMDSTATUS, status);
|
||||||
|
|
||||||
|
@ -369,24 +582,14 @@ grub_ohci_transfer (grub_usb_controller_t dev,
|
||||||
case GRUB_USB_TRANSACTION_TYPE_CONTROL:
|
case GRUB_USB_TRANSACTION_TYPE_CONTROL:
|
||||||
{
|
{
|
||||||
grub_dprintf ("ohci", "add to control list\n");
|
grub_dprintf ("ohci", "add to control list\n");
|
||||||
status = grub_ohci_readreg32 (o, GRUB_OHCI_REG_CMDSTATUS);
|
|
||||||
control = grub_ohci_readreg32 (o, GRUB_OHCI_REG_CONTROL);
|
|
||||||
|
|
||||||
/* Disable the Control and Bulk lists. */
|
/* Set ControlList Head and Current */
|
||||||
control &= ~(3 << 4);
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CONTROLHEAD, ed_addr);
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CONTROL, control);
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CONTROLCURR, 0);
|
||||||
|
|
||||||
/* Clear ControlListFilled. */
|
|
||||||
status &= ~(1 << 1);
|
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CMDSTATUS, status);
|
|
||||||
|
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CONTROLHEAD,
|
|
||||||
(grub_uint32_t) ed);
|
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CONTROLHEAD+1,
|
|
||||||
(grub_uint32_t) ed);
|
|
||||||
|
|
||||||
/* Enable the Control list. */
|
/* 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);
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CONTROL, control);
|
||||||
|
|
||||||
/* Set ControlListFilled. */
|
/* Set ControlListFilled. */
|
||||||
|
@ -397,37 +600,138 @@ grub_ohci_transfer (grub_usb_controller_t dev,
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_dprintf ("ohci", "wait for completion\n");
|
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_CONTROL),
|
||||||
grub_ohci_readreg32 (o, GRUB_OHCI_REG_CMDSTATUS));
|
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;
|
||||||
|
|
||||||
/* Wait until the transfer is completed or STALLs. */
|
/* Wait until the transfer is completed or STALLs. */
|
||||||
while ((ed->td_head & ~0xf) != (ed->td_tail & ~0xf))
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
grub_dprintf ("ohci", "head=0x%02x tail=0x%02x\n", ed->td_head, ed->td_tail);
|
if ((intstatus & 0x10) != 0)
|
||||||
|
{ /* Unrecoverable error - only reset can help...! */
|
||||||
|
err_unrec = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
/* Detected a STALL. */
|
/* Detected a HALT. */
|
||||||
if (ed->td_head & 1)
|
if (grub_le_to_cpu32 (ed->td_head) & 1)
|
||||||
|
break;
|
||||||
|
|
||||||
|
/* Timeout ? */
|
||||||
|
if (grub_get_time_ms () > maxtime)
|
||||||
|
{
|
||||||
|
/* Disable the Control and Bulk lists. */
|
||||||
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CONTROL,
|
||||||
|
grub_ohci_readreg32 (o, GRUB_OHCI_REG_CONTROL) & ~(3 << 4));
|
||||||
|
err_timeout = 1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ((ed->td_head & ~0xf) == (ed->td_tail & ~0xf))
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
grub_cpu_idle ();
|
||||||
}
|
}
|
||||||
|
while (1);
|
||||||
|
|
||||||
grub_dprintf ("ohci", "complete\n");
|
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 (ed->td_head & 1) */
|
if (!tderr_addr)
|
||||||
/* err = GRUB_USB_ERR_STALL; */
|
{
|
||||||
/* else if (ed->td */
|
/* 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;
|
||||||
|
|
||||||
if (ed->td_head & 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",
|
||||||
|
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));
|
||||||
|
}
|
||||||
|
/* 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_uint8_t errcode;
|
grub_uint8_t errcode;
|
||||||
grub_ohci_td_t tderr;
|
grub_ohci_td_t tderr = NULL;
|
||||||
|
|
||||||
tderr = (grub_ohci_td_t) grub_ohci_readreg32 (o,
|
transfer->last_trans--;
|
||||||
GRUB_OHCI_REG_DONEHEAD);
|
|
||||||
errcode = tderr->token >> 28;
|
tderr = (grub_ohci_td_t) ((char *) td_list
|
||||||
|
+ (tderr_addr - td_list_addr));
|
||||||
|
|
||||||
|
errcode = grub_le_to_cpu32 (tderr->token) >> 28;
|
||||||
|
grub_dprintf ("ohci", "OHCI errcode=0x%02x\n", errcode);
|
||||||
|
|
||||||
switch (errcode)
|
switch (errcode)
|
||||||
{
|
{
|
||||||
|
@ -473,11 +777,17 @@ grub_ohci_transfer (grub_usb_controller_t dev,
|
||||||
case 8:
|
case 8:
|
||||||
/* XXX: Data overrun error. */
|
/* XXX: Data overrun error. */
|
||||||
err = GRUB_USB_ERR_DATA;
|
err = GRUB_USB_ERR_DATA;
|
||||||
|
grub_dprintf ("ohci", "Overrun, failed TD address: %p, index: %d\n",
|
||||||
|
tderr, transfer->last_trans);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 9:
|
case 9:
|
||||||
/* XXX: Data underrun error. */
|
/* XXX: Data underrun error. */
|
||||||
err = GRUB_USB_ERR_DATA;
|
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));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 10:
|
case 10:
|
||||||
|
@ -515,12 +825,58 @@ grub_ohci_transfer (grub_usb_controller_t dev,
|
||||||
|
|
||||||
/* Clear BulkListFilled and ControlListFilled. */
|
/* Clear BulkListFilled and ControlListFilled. */
|
||||||
status = grub_ohci_readreg32 (o, GRUB_OHCI_REG_CMDSTATUS);
|
status = grub_ohci_readreg32 (o, GRUB_OHCI_REG_CMDSTATUS);
|
||||||
status &= ~((1 << 2) | (1 << 3));
|
status &= ~(3 << 1);
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CMDSTATUS, status);
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_CMDSTATUS, status);
|
||||||
|
|
||||||
|
/* Set ED to be skipped - for safety */
|
||||||
|
ed->target |= grub_cpu_to_le32 (1 << 14);
|
||||||
|
|
||||||
|
/* Now we should wait for start of next frame.
|
||||||
|
* It is necessary because we will invalidate pointer to ED and it
|
||||||
|
* can be on OHCI active till SOF!
|
||||||
|
* Because we are not using interrupt, we reset SF bit and wait when
|
||||||
|
* it goes to 1. */
|
||||||
|
/* 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)
|
||||||
|
&& !err_unrec);
|
||||||
|
/* Now it should be safe to change CONTROL and BULK lists. */
|
||||||
|
|
||||||
|
/* Important cleaning. */
|
||||||
|
o->hcca->donehead = 0;
|
||||||
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_INTSTATUS, (1 << 1)); /* Clears WDH */
|
||||||
|
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);
|
||||||
|
|
||||||
/* XXX */
|
if (err_unrec)
|
||||||
grub_free (td_list);
|
{
|
||||||
grub_free (ed);
|
/* 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);
|
||||||
|
grub_dma_free (ed_chunk);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -530,28 +886,30 @@ grub_ohci_portstatus (grub_usb_controller_t dev,
|
||||||
unsigned int port, unsigned int enable)
|
unsigned int port, unsigned int enable)
|
||||||
{
|
{
|
||||||
struct grub_ohci *o = (struct grub_ohci *) dev->data;
|
struct grub_ohci *o = (struct grub_ohci *) dev->data;
|
||||||
grub_uint32_t status;
|
|
||||||
|
|
||||||
/* Reset the port. */
|
grub_dprintf ("ohci", "begin of portstatus=0x%02x\n",
|
||||||
status = grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port);
|
grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port));
|
||||||
status |= (1 << 4); /* XXX: Magic. */
|
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_RHUBPORT + port, status);
|
|
||||||
grub_millisleep (100);
|
|
||||||
|
|
||||||
/* End the reset signaling. */
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_RHUBPORT + port,
|
||||||
status = grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port);
|
GRUB_OHCI_SET_PORT_RESET);
|
||||||
status |= (1 << 20); /* XXX: Magic. */
|
grub_millisleep (50); /* For root hub should be nominaly 50ms */
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_RHUBPORT + port, status);
|
|
||||||
|
/* End the reset signaling. */
|
||||||
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_RHUBPORT + port,
|
||||||
|
GRUB_OHCI_SET_PORT_RESET_STATUS_CHANGE);
|
||||||
grub_millisleep (10);
|
grub_millisleep (10);
|
||||||
|
|
||||||
/* Enable the port. */
|
if (enable)
|
||||||
status = grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port);
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_RHUBPORT + port,
|
||||||
status |= (enable << 1); /* XXX: Magic. */
|
GRUB_OHCI_SET_PORT_ENABLE);
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_RHUBPORT + port, status);
|
else
|
||||||
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_RHUBPORT + port,
|
||||||
status = grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port);
|
GRUB_OHCI_CLEAR_PORT_ENABLE);
|
||||||
grub_dprintf ("ohci", "portstatus=0x%02x\n", status);
|
grub_millisleep (10);
|
||||||
|
|
||||||
|
grub_dprintf ("ohci", "end of portstatus=0x%02x\n",
|
||||||
|
grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port));
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -587,6 +945,42 @@ grub_ohci_hubports (grub_usb_controller_t dev)
|
||||||
return portinfo & 0xFF;
|
return portinfo & 0xFF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
grub_ohci_fini_hw (int noreturn __attribute__ ((unused)))
|
||||||
|
{
|
||||||
|
struct grub_ohci *o;
|
||||||
|
|
||||||
|
for (o = ohci; o; o = o->next)
|
||||||
|
{
|
||||||
|
int i, nports = grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBA) & 0xff;
|
||||||
|
for (i = 0; i < nports; i++)
|
||||||
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_RHUBPORT + i,
|
||||||
|
GRUB_OHCI_CLEAR_PORT_ENABLE);
|
||||||
|
|
||||||
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_HCCA, 0);
|
||||||
|
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);
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
grub_ohci_restore_hw (void)
|
||||||
|
{
|
||||||
|
struct grub_ohci *o;
|
||||||
|
|
||||||
|
for (o = ohci; o; o = o->next)
|
||||||
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_HCCA, o->hcca_addr);
|
||||||
|
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
static struct grub_usb_controller_dev usb_controller =
|
static struct grub_usb_controller_dev usb_controller =
|
||||||
|
@ -603,9 +997,12 @@ GRUB_MOD_INIT(ohci)
|
||||||
{
|
{
|
||||||
grub_ohci_inithw ();
|
grub_ohci_inithw ();
|
||||||
grub_usb_controller_dev_register (&usb_controller);
|
grub_usb_controller_dev_register (&usb_controller);
|
||||||
|
grub_loader_register_preboot_hook (grub_ohci_fini_hw, grub_ohci_restore_hw,
|
||||||
|
GRUB_LOADER_PREBOOT_HOOK_PRIO_DISK);
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(ohci)
|
GRUB_MOD_FINI(ohci)
|
||||||
{
|
{
|
||||||
|
grub_ohci_fini_hw (0);
|
||||||
grub_usb_controller_dev_unregister (&usb_controller);
|
grub_usb_controller_dev_unregister (&usb_controller);
|
||||||
}
|
}
|
||||||
|
|
|
@ -174,14 +174,15 @@ grub_uhci_pci_iter (grub_pci_device_t dev,
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
u->iobase = base & GRUB_UHCI_IOMASK;
|
u->iobase = base & GRUB_UHCI_IOMASK;
|
||||||
grub_dprintf ("uhci", "class=0x%02x 0x%02x interface 0x%02x base=0x%x\n",
|
|
||||||
class, subclass, interf, u->iobase);
|
|
||||||
|
|
||||||
/* Reserve a page for the frame list. */
|
/* Reserve a page for the frame list. */
|
||||||
u->framelist = grub_memalign (4096, 4096);
|
u->framelist = grub_memalign (4096, 4096);
|
||||||
if (! u->framelist)
|
if (! u->framelist)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
grub_dprintf ("uhci", "class=0x%02x 0x%02x interface 0x%02x base=0x%x framelist=%p\n",
|
||||||
|
class, subclass, interf, u->iobase, u->framelist);
|
||||||
|
|
||||||
/* The framelist pointer of UHCI is only 32 bits, make sure this
|
/* The framelist pointer of UHCI is only 32 bits, make sure this
|
||||||
code works on on 64 bits architectures. */
|
code works on on 64 bits architectures. */
|
||||||
#if GRUB_CPU_SIZEOF_VOID_P == 8
|
#if GRUB_CPU_SIZEOF_VOID_P == 8
|
||||||
|
@ -221,6 +222,9 @@ grub_uhci_pci_iter (grub_pci_device_t dev,
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
grub_dprintf ("uhci", "QH=%p, TD=%p\n",
|
||||||
|
u->qh, u->td);
|
||||||
|
|
||||||
/* Link all Transfer Descriptors in a list of available Transfer
|
/* Link all Transfer Descriptors in a list of available Transfer
|
||||||
Descriptors. */
|
Descriptors. */
|
||||||
for (i = 0; i < 256; i++)
|
for (i = 0; i < 256; i++)
|
||||||
|
@ -328,13 +332,20 @@ grub_free_td (struct grub_uhci *u, grub_uhci_td_t td)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
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. */
|
int i; /* Index of TD in transfer */
|
||||||
while (td)
|
|
||||||
|
/* Free the TDs in this queue and set last_trans. */
|
||||||
|
for (i=0; td; i++)
|
||||||
{
|
{
|
||||||
grub_uhci_td_t tdprev;
|
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. */
|
/* Unlink the queue. */
|
||||||
tdprev = td;
|
tdprev = td;
|
||||||
td = (grub_uhci_td_t) td->linkptr2;
|
td = (grub_uhci_td_t) td->linkptr2;
|
||||||
|
@ -380,7 +391,7 @@ static grub_uhci_td_t
|
||||||
grub_uhci_transaction (struct grub_uhci *u, unsigned int endp,
|
grub_uhci_transaction (struct grub_uhci *u, unsigned int endp,
|
||||||
grub_transfer_type_t type, unsigned int addr,
|
grub_transfer_type_t type, unsigned int addr,
|
||||||
unsigned int toggle, grub_size_t size,
|
unsigned int toggle, grub_size_t size,
|
||||||
char *data)
|
grub_uint32_t data)
|
||||||
{
|
{
|
||||||
grub_uhci_td_t td;
|
grub_uhci_td_t td;
|
||||||
static const unsigned int tf[] = { 0x69, 0xE1, 0x2D };
|
static const unsigned int tf[] = { 0x69, 0xE1, 0x2D };
|
||||||
|
@ -398,7 +409,7 @@ grub_uhci_transaction (struct grub_uhci *u, unsigned int endp,
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_dprintf ("uhci",
|
grub_dprintf ("uhci",
|
||||||
"transaction: endp=%d, type=%d, addr=%d, toggle=%d, size=%d data=%p td=%p\n",
|
"transaction: endp=%d, type=%d, addr=%d, toggle=%d, size=%d data=0x%x td=%p\n",
|
||||||
endp, type, addr, toggle, size, data, td);
|
endp, type, addr, toggle, size, data, td);
|
||||||
|
|
||||||
/* Don't point to any TD, just terminate. */
|
/* Don't point to any TD, just terminate. */
|
||||||
|
@ -418,7 +429,7 @@ grub_uhci_transaction (struct grub_uhci *u, unsigned int endp,
|
||||||
td->token = ((size << 21) | (toggle << 19) | (endp << 15)
|
td->token = ((size << 21) | (toggle << 19) | (endp << 15)
|
||||||
| (addr << 8) | tf[type]);
|
| (addr << 8) | tf[type]);
|
||||||
|
|
||||||
td->buffer = (grub_uint32_t) data;
|
td->buffer = data;
|
||||||
|
|
||||||
return td;
|
return td;
|
||||||
}
|
}
|
||||||
|
@ -441,6 +452,8 @@ grub_uhci_transfer (grub_usb_controller_t dev,
|
||||||
if (! qh)
|
if (! qh)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
|
grub_dprintf ("uhci", "transfer, iobase:%08x\n", u->iobase);
|
||||||
|
|
||||||
for (i = 0; i < transfer->transcnt; i++)
|
for (i = 0; i < transfer->transcnt; i++)
|
||||||
{
|
{
|
||||||
grub_usb_transaction_t tr = &transfer->transactions[i];
|
grub_usb_transaction_t tr = &transfer->transactions[i];
|
||||||
|
@ -455,7 +468,7 @@ grub_uhci_transfer (grub_usb_controller_t dev,
|
||||||
td_prev->linkptr = 1;
|
td_prev->linkptr = 1;
|
||||||
|
|
||||||
if (td_first)
|
if (td_first)
|
||||||
grub_free_queue (u, td_first);
|
grub_free_queue (u, td_first, NULL);
|
||||||
|
|
||||||
return GRUB_USB_ERR_INTERNAL;
|
return GRUB_USB_ERR_INTERNAL;
|
||||||
}
|
}
|
||||||
|
@ -548,12 +561,13 @@ grub_uhci_transfer (grub_usb_controller_t dev,
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
|
|
||||||
grub_dprintf ("uhci", "transaction failed\n");
|
if (err != GRUB_USB_ERR_NONE)
|
||||||
|
grub_dprintf ("uhci", "transaction failed\n");
|
||||||
|
|
||||||
/* Place the QH back in the free list and deallocate the associated
|
/* Place the QH back in the free list and deallocate the associated
|
||||||
TDs. */
|
TDs. */
|
||||||
qh->elinkptr = 1;
|
qh->elinkptr = 1;
|
||||||
grub_free_queue (u, td_first);
|
grub_free_queue (u, td_first, transfer);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -583,6 +597,8 @@ grub_uhci_portstatus (grub_usb_controller_t dev,
|
||||||
unsigned int status;
|
unsigned int status;
|
||||||
grub_uint64_t endtime;
|
grub_uint64_t endtime;
|
||||||
|
|
||||||
|
grub_dprintf ("uhci", "portstatus, iobase:%08x\n", u->iobase);
|
||||||
|
|
||||||
grub_dprintf ("uhci", "enable=%d port=%d\n", enable, port);
|
grub_dprintf ("uhci", "enable=%d port=%d\n", enable, port);
|
||||||
|
|
||||||
if (port == 0)
|
if (port == 0)
|
||||||
|
@ -600,7 +616,7 @@ grub_uhci_portstatus (grub_usb_controller_t dev,
|
||||||
grub_uhci_writereg16 (u, reg, enable << 9);
|
grub_uhci_writereg16 (u, reg, enable << 9);
|
||||||
|
|
||||||
/* Wait for the reset to complete. XXX: How long exactly? */
|
/* 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);
|
status = grub_uhci_readreg16 (u, reg);
|
||||||
grub_uhci_writereg16 (u, reg, status & ~(1 << 9));
|
grub_uhci_writereg16 (u, reg, status & ~(1 << 9));
|
||||||
grub_dprintf ("uhci", "reset completed\n");
|
grub_dprintf ("uhci", "reset completed\n");
|
||||||
|
@ -631,6 +647,8 @@ grub_uhci_detect_dev (grub_usb_controller_t dev, int port)
|
||||||
int reg;
|
int reg;
|
||||||
unsigned int status;
|
unsigned int status;
|
||||||
|
|
||||||
|
grub_dprintf ("uhci", "detect_dev, iobase:%08x\n", u->iobase);
|
||||||
|
|
||||||
if (port == 0)
|
if (port == 0)
|
||||||
reg = GRUB_UHCI_REG_PORTSC1;
|
reg = GRUB_UHCI_REG_PORTSC1;
|
||||||
else if (port == 1)
|
else if (port == 1)
|
||||||
|
|
|
@ -105,10 +105,7 @@ grub_usb_clear_halt (grub_usb_device_t dev, int endpoint)
|
||||||
grub_usb_err_t
|
grub_usb_err_t
|
||||||
grub_usb_set_configuration (grub_usb_device_t dev, int configuration)
|
grub_usb_set_configuration (grub_usb_device_t dev, int configuration)
|
||||||
{
|
{
|
||||||
int i;
|
grub_memset (dev->toggle, 0, sizeof (dev->toggle));
|
||||||
|
|
||||||
for (i = 0; i < 16; i++)
|
|
||||||
dev->toggle[i] = 0;
|
|
||||||
|
|
||||||
return grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_OUT
|
return grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_OUT
|
||||||
| GRUB_USB_REQTYPE_STANDARD
|
| GRUB_USB_REQTYPE_STANDARD
|
||||||
|
@ -163,6 +160,16 @@ grub_usb_device_initialize (grub_usb_device_t dev)
|
||||||
grub_usb_err_t err;
|
grub_usb_err_t err;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
/* First we have to read first 8 bytes only and determine
|
||||||
|
* max. size of packet */
|
||||||
|
dev->descdev.maxsize0 = 0; /* invalidating, for safety only, can be removed if it is sure it is zero here */
|
||||||
|
err = grub_usb_get_descriptor (dev, GRUB_USB_DESCRIPTOR_DEVICE,
|
||||||
|
0, 8, (char *) &dev->descdev);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
/* Now we have valid value in dev->descdev.maxsize0,
|
||||||
|
* so we can read whole device descriptor */
|
||||||
err = grub_usb_get_descriptor (dev, GRUB_USB_DESCRIPTOR_DEVICE,
|
err = grub_usb_get_descriptor (dev, GRUB_USB_DESCRIPTOR_DEVICE,
|
||||||
0, sizeof (struct grub_usb_desc_device),
|
0, sizeof (struct grub_usb_desc_device),
|
||||||
(char *) &dev->descdev);
|
(char *) &dev->descdev);
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
|
#include <grub/pci.h>
|
||||||
#include <grub/mm.h>
|
#include <grub/mm.h>
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/usb.h>
|
#include <grub/usb.h>
|
||||||
|
@ -29,30 +30,59 @@ grub_usb_control_msg (grub_usb_device_t dev,
|
||||||
grub_uint8_t request,
|
grub_uint8_t request,
|
||||||
grub_uint16_t value,
|
grub_uint16_t value,
|
||||||
grub_uint16_t index,
|
grub_uint16_t index,
|
||||||
grub_size_t size, char *data)
|
grub_size_t size0, char *data_in)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
grub_usb_transfer_t transfer;
|
grub_usb_transfer_t transfer;
|
||||||
int datablocks;
|
int datablocks;
|
||||||
struct grub_usb_packet_setup setupdata;
|
volatile struct grub_usb_packet_setup *setupdata;
|
||||||
|
grub_uint32_t setupdata_addr;
|
||||||
grub_usb_err_t err;
|
grub_usb_err_t err;
|
||||||
unsigned int max;
|
unsigned int max;
|
||||||
|
struct grub_pci_dma_chunk *data_chunk, *setupdata_chunk;
|
||||||
|
volatile char *data;
|
||||||
|
grub_uint32_t data_addr;
|
||||||
|
grub_size_t size = size0;
|
||||||
|
|
||||||
|
/* FIXME: avoid allocation any kind of buffer in a first place. */
|
||||||
|
data_chunk = grub_memalign_dma32 (128, size ? : 16);
|
||||||
|
if (!data_chunk)
|
||||||
|
return GRUB_USB_ERR_INTERNAL;
|
||||||
|
data = grub_dma_get_virt (data_chunk);
|
||||||
|
data_addr = grub_dma_get_phys (data_chunk);
|
||||||
|
grub_memcpy ((char *) data, data_in, size);
|
||||||
|
|
||||||
grub_dprintf ("usb",
|
grub_dprintf ("usb",
|
||||||
"control: reqtype=0x%02x req=0x%02x val=0x%02x idx=0x%02x size=%d\n",
|
"control: reqtype=0x%02x req=0x%02x val=0x%02x idx=0x%02x size=%d\n",
|
||||||
reqtype, request, value, index, size);
|
reqtype, request, value, index, size);
|
||||||
|
|
||||||
/* Create a transfer. */
|
/* Create a transfer. */
|
||||||
transfer = grub_malloc (sizeof (struct grub_usb_transfer));
|
transfer = grub_malloc (sizeof (*transfer));
|
||||||
if (! transfer)
|
if (! transfer)
|
||||||
return grub_errno;
|
{
|
||||||
|
grub_dma_free (data_chunk);
|
||||||
|
return grub_errno;
|
||||||
|
}
|
||||||
|
|
||||||
|
setupdata_chunk = grub_memalign_dma32 (32, sizeof (*setupdata));
|
||||||
|
if (! setupdata_chunk)
|
||||||
|
{
|
||||||
|
grub_free (transfer);
|
||||||
|
grub_dma_free (data_chunk);
|
||||||
|
return grub_errno;
|
||||||
|
}
|
||||||
|
|
||||||
|
setupdata = grub_dma_get_virt (setupdata_chunk);
|
||||||
|
setupdata_addr = grub_dma_get_phys (setupdata_chunk);
|
||||||
|
|
||||||
/* Determine the maximum packet size. */
|
/* Determine the maximum packet size. */
|
||||||
if (dev->initialized)
|
if (dev->descdev.maxsize0)
|
||||||
max = dev->descdev.maxsize0;
|
max = dev->descdev.maxsize0;
|
||||||
else
|
else
|
||||||
max = 64;
|
max = 64;
|
||||||
|
|
||||||
|
grub_dprintf ("usb", "transfer = %p, dev = %p\n", transfer, dev);
|
||||||
|
|
||||||
datablocks = (size + max - 1) / max;
|
datablocks = (size + max - 1) / max;
|
||||||
|
|
||||||
/* XXX: Discriminate between different types of control
|
/* XXX: Discriminate between different types of control
|
||||||
|
@ -71,18 +101,20 @@ grub_usb_control_msg (grub_usb_device_t dev,
|
||||||
if (! transfer->transactions)
|
if (! transfer->transactions)
|
||||||
{
|
{
|
||||||
grub_free (transfer);
|
grub_free (transfer);
|
||||||
|
grub_dma_free (setupdata_chunk);
|
||||||
|
grub_dma_free (data_chunk);
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build a Setup packet. XXX: Endianness. */
|
/* Build a Setup packet. XXX: Endianness. */
|
||||||
setupdata.reqtype = reqtype;
|
setupdata->reqtype = reqtype;
|
||||||
setupdata.request = request;
|
setupdata->request = request;
|
||||||
setupdata.value = value;
|
setupdata->value = value;
|
||||||
setupdata.index = index;
|
setupdata->index = index;
|
||||||
setupdata.length = size;
|
setupdata->length = size;
|
||||||
transfer->transactions[0].size = sizeof (setupdata);
|
transfer->transactions[0].size = sizeof (*setupdata);
|
||||||
transfer->transactions[0].pid = GRUB_USB_TRANSFER_TYPE_SETUP;
|
transfer->transactions[0].pid = GRUB_USB_TRANSFER_TYPE_SETUP;
|
||||||
transfer->transactions[0].data = (char *) &setupdata;
|
transfer->transactions[0].data = setupdata_addr;
|
||||||
transfer->transactions[0].toggle = 0;
|
transfer->transactions[0].toggle = 0;
|
||||||
|
|
||||||
/* Now the data... XXX: Is this the right way to transfer control
|
/* Now the data... XXX: Is this the right way to transfer control
|
||||||
|
@ -99,14 +131,14 @@ grub_usb_control_msg (grub_usb_device_t dev,
|
||||||
tr->pid = GRUB_USB_TRANSFER_TYPE_IN;
|
tr->pid = GRUB_USB_TRANSFER_TYPE_IN;
|
||||||
else
|
else
|
||||||
tr->pid = GRUB_USB_TRANSFER_TYPE_OUT;
|
tr->pid = GRUB_USB_TRANSFER_TYPE_OUT;
|
||||||
tr->data = &data[i * max];
|
tr->data = data_addr + i * max;
|
||||||
size -= max;
|
size -= max;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* End with an empty OUT transaction. */
|
/* End with an empty OUT transaction. */
|
||||||
transfer->transactions[datablocks + 1].size = 0;
|
transfer->transactions[datablocks + 1].size = 0;
|
||||||
transfer->transactions[datablocks + 1].data = NULL;
|
transfer->transactions[datablocks + 1].data = 0;
|
||||||
if (reqtype & 128)
|
if ((reqtype & 128) && datablocks)
|
||||||
transfer->transactions[datablocks + 1].pid = GRUB_USB_TRANSFER_TYPE_OUT;
|
transfer->transactions[datablocks + 1].pid = GRUB_USB_TRANSFER_TYPE_OUT;
|
||||||
else
|
else
|
||||||
transfer->transactions[datablocks + 1].pid = GRUB_USB_TRANSFER_TYPE_IN;
|
transfer->transactions[datablocks + 1].pid = GRUB_USB_TRANSFER_TYPE_IN;
|
||||||
|
@ -116,14 +148,19 @@ grub_usb_control_msg (grub_usb_device_t dev,
|
||||||
err = dev->controller.dev->transfer (&dev->controller, transfer);
|
err = dev->controller.dev->transfer (&dev->controller, transfer);
|
||||||
|
|
||||||
grub_free (transfer->transactions);
|
grub_free (transfer->transactions);
|
||||||
|
|
||||||
grub_free (transfer);
|
grub_free (transfer);
|
||||||
|
grub_dma_free (data_chunk);
|
||||||
|
grub_dma_free (setupdata_chunk);
|
||||||
|
|
||||||
|
grub_memcpy (data_in, (char *) data, size0);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_usb_err_t
|
static grub_usb_err_t
|
||||||
grub_usb_bulk_readwrite (grub_usb_device_t dev,
|
grub_usb_bulk_readwrite (grub_usb_device_t dev,
|
||||||
int endpoint, grub_size_t size, char *data,
|
int endpoint, grub_size_t size0, char *data_in,
|
||||||
grub_transfer_type_t type)
|
grub_transfer_type_t type)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
@ -132,6 +169,19 @@ grub_usb_bulk_readwrite (grub_usb_device_t dev,
|
||||||
unsigned int max;
|
unsigned int max;
|
||||||
grub_usb_err_t err;
|
grub_usb_err_t err;
|
||||||
int toggle = dev->toggle[endpoint];
|
int toggle = dev->toggle[endpoint];
|
||||||
|
volatile char *data;
|
||||||
|
grub_uint32_t data_addr;
|
||||||
|
struct grub_pci_dma_chunk *data_chunk;
|
||||||
|
grub_size_t size = size0;
|
||||||
|
|
||||||
|
/* FIXME: avoid allocation any kind of buffer in a first place. */
|
||||||
|
data_chunk = grub_memalign_dma32 (128, size);
|
||||||
|
if (!data_chunk)
|
||||||
|
return GRUB_USB_ERR_INTERNAL;
|
||||||
|
data = grub_dma_get_virt (data_chunk);
|
||||||
|
data_addr = grub_dma_get_phys (data_chunk);
|
||||||
|
if (type == GRUB_USB_TRANSFER_TYPE_OUT)
|
||||||
|
grub_memcpy ((char *) data, data_in, size);
|
||||||
|
|
||||||
/* Use the maximum packet size given in the endpoint descriptor. */
|
/* Use the maximum packet size given in the endpoint descriptor. */
|
||||||
if (dev->initialized)
|
if (dev->initialized)
|
||||||
|
@ -150,16 +200,20 @@ grub_usb_bulk_readwrite (grub_usb_device_t dev,
|
||||||
/* Create a transfer. */
|
/* Create a transfer. */
|
||||||
transfer = grub_malloc (sizeof (struct grub_usb_transfer));
|
transfer = grub_malloc (sizeof (struct grub_usb_transfer));
|
||||||
if (! transfer)
|
if (! transfer)
|
||||||
return grub_errno;
|
{
|
||||||
|
grub_dma_free (data_chunk);
|
||||||
|
return grub_errno;
|
||||||
|
}
|
||||||
|
|
||||||
datablocks = ((size + max - 1) / max);
|
datablocks = ((size + max - 1) / max);
|
||||||
transfer->transcnt = datablocks;
|
transfer->transcnt = datablocks;
|
||||||
transfer->size = size - 1;
|
transfer->size = size - 1;
|
||||||
transfer->endpoint = endpoint;
|
transfer->endpoint = endpoint & 15;
|
||||||
transfer->devaddr = dev->addr;
|
transfer->devaddr = dev->addr;
|
||||||
transfer->type = GRUB_USB_TRANSACTION_TYPE_BULK;
|
transfer->type = GRUB_USB_TRANSACTION_TYPE_BULK;
|
||||||
transfer->max = max;
|
transfer->max = max;
|
||||||
transfer->dev = dev;
|
transfer->dev = dev;
|
||||||
|
transfer->last_trans = -1; /* Reset index of last processed transaction (TD) */
|
||||||
|
|
||||||
/* Allocate an array of transfer data structures. */
|
/* Allocate an array of transfer data structures. */
|
||||||
transfer->transactions = grub_malloc (transfer->transcnt
|
transfer->transactions = grub_malloc (transfer->transcnt
|
||||||
|
@ -167,6 +221,7 @@ grub_usb_bulk_readwrite (grub_usb_device_t dev,
|
||||||
if (! transfer->transactions)
|
if (! transfer->transactions)
|
||||||
{
|
{
|
||||||
grub_free (transfer);
|
grub_free (transfer);
|
||||||
|
grub_dma_free (data_chunk);
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -181,16 +236,27 @@ grub_usb_bulk_readwrite (grub_usb_device_t dev,
|
||||||
tr->toggle = toggle;
|
tr->toggle = toggle;
|
||||||
toggle = toggle ? 0 : 1;
|
toggle = toggle ? 0 : 1;
|
||||||
tr->pid = type;
|
tr->pid = type;
|
||||||
tr->data = &data[i * max];
|
tr->data = data_addr + i * max;
|
||||||
size -= tr->size;
|
size -= tr->size;
|
||||||
}
|
}
|
||||||
|
|
||||||
err = dev->controller.dev->transfer (&dev->controller, transfer);
|
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);
|
grub_dprintf ("usb", "toggle=%d\n", toggle);
|
||||||
dev->toggle[endpoint] = toggle;
|
dev->toggle[endpoint] = toggle;
|
||||||
|
|
||||||
grub_free (transfer->transactions);
|
grub_free (transfer->transactions);
|
||||||
grub_free (transfer);
|
grub_free (transfer);
|
||||||
|
grub_dma_free (data_chunk);
|
||||||
|
|
||||||
|
if (type == GRUB_USB_TRANSFER_TYPE_IN)
|
||||||
|
grub_memcpy (data_in, (char *) data, size0);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
|
@ -138,8 +138,8 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)),
|
||||||
{
|
{
|
||||||
grub_device_close (dev);
|
grub_device_close (dev);
|
||||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||||
"only partitions resding in the first 2TB "
|
"only partitions residing in the first 2TB "
|
||||||
"can be presen in hybrid MBR");
|
"can be present in hybrid MBR");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -243,8 +243,8 @@ GRUB_MOD_INIT(gptsync)
|
||||||
cmd = grub_register_command ("gptsync", grub_cmd_gptsync,
|
cmd = grub_register_command ("gptsync", grub_cmd_gptsync,
|
||||||
N_("DEVICE [PARTITION[+/-[TYPE]]] ..."),
|
N_("DEVICE [PARTITION[+/-[TYPE]]] ..."),
|
||||||
N_("Fill hybrid MBR of GPT drive DEVICE. "
|
N_("Fill hybrid MBR of GPT drive DEVICE. "
|
||||||
"specified partitions will be a part "
|
"Specified partitions will be a part "
|
||||||
"of hybrid mbr. Up to 3 partitions are "
|
"of hybrid MBR. Up to 3 partitions are "
|
||||||
"allowed. TYPE is an MBR type. "
|
"allowed. TYPE is an MBR type. "
|
||||||
"+ means that partition is active. "
|
"+ means that partition is active. "
|
||||||
"Only one partition can be 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);
|
|
||||||
}
|
|
145
commands/help.c
145
commands/help.c
|
@ -33,94 +33,87 @@ grub_cmd_help (grub_extcmd_t ext __attribute__ ((unused)), int argc,
|
||||||
int cnt = 0;
|
int cnt = 0;
|
||||||
char *currarg;
|
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 ((cmd->prio & GRUB_PRIO_LIST_FLAG_ACTIVE) &&
|
|
||||||
(cmd->flags & GRUB_COMMAND_FLAG_CMDLINE))
|
|
||||||
{
|
|
||||||
struct grub_term_output *term;
|
|
||||||
const char *summary_translated = _(cmd->summary);
|
|
||||||
char *command_help;
|
|
||||||
grub_uint32_t *unicode_command_help;
|
|
||||||
grub_uint32_t *unicode_last_position;
|
|
||||||
|
|
||||||
command_help = grub_xasprintf ("%s %s", cmd->name, summary_translated);
|
|
||||||
if (!command_help)
|
|
||||||
return 1;
|
|
||||||
|
|
||||||
grub_utf8_to_ucs4_alloc (command_help, &unicode_command_help,
|
|
||||||
&unicode_last_position);
|
|
||||||
|
|
||||||
FOR_ACTIVE_TERM_OUTPUTS(term)
|
|
||||||
{
|
|
||||||
unsigned stringwidth;
|
|
||||||
grub_uint32_t *unicode_last_screen_position;
|
|
||||||
|
|
||||||
unicode_last_screen_position = unicode_command_help;
|
|
||||||
|
|
||||||
stringwidth = 0;
|
|
||||||
|
|
||||||
while (unicode_last_screen_position < unicode_last_position &&
|
|
||||||
stringwidth < ((grub_term_width (term) / 2) - 2))
|
|
||||||
{
|
|
||||||
stringwidth
|
|
||||||
+= grub_term_getcharwidth (term,
|
|
||||||
*unicode_last_screen_position);
|
|
||||||
unicode_last_screen_position++;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_print_ucs4 (unicode_command_help,
|
|
||||||
unicode_last_screen_position, term);
|
|
||||||
if (!(cnt % 2))
|
|
||||||
grub_print_spaces (term, grub_term_width (term) / 2
|
|
||||||
- stringwidth);
|
|
||||||
}
|
|
||||||
if (cnt % 2)
|
|
||||||
grub_printf ("\n");
|
|
||||||
cnt++;
|
|
||||||
|
|
||||||
grub_free (command_help);
|
|
||||||
grub_free (unicode_command_help);
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int print_command_help (grub_command_t cmd)
|
|
||||||
{
|
|
||||||
if (cmd->prio & GRUB_PRIO_LIST_FLAG_ACTIVE)
|
|
||||||
{
|
|
||||||
if (! grub_strncmp (cmd->name, currarg, grub_strlen (currarg)))
|
|
||||||
{
|
|
||||||
if (cnt++ > 0)
|
|
||||||
grub_printf ("\n\n");
|
|
||||||
|
|
||||||
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),
|
|
||||||
_(cmd->description));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (argc == 0)
|
if (argc == 0)
|
||||||
{
|
{
|
||||||
grub_command_iterate (print_command_info);
|
grub_command_t cmd;
|
||||||
|
FOR_COMMANDS(cmd)
|
||||||
|
{
|
||||||
|
if ((cmd->prio & GRUB_PRIO_LIST_FLAG_ACTIVE) &&
|
||||||
|
(cmd->flags & GRUB_COMMAND_FLAG_CMDLINE))
|
||||||
|
{
|
||||||
|
struct grub_term_output *term;
|
||||||
|
const char *summary_translated = _(cmd->summary);
|
||||||
|
char *command_help;
|
||||||
|
grub_uint32_t *unicode_command_help;
|
||||||
|
grub_uint32_t *unicode_last_position;
|
||||||
|
|
||||||
|
command_help = grub_xasprintf ("%s %s", cmd->name, summary_translated);
|
||||||
|
if (!command_help)
|
||||||
|
break;
|
||||||
|
|
||||||
|
grub_utf8_to_ucs4_alloc (command_help, &unicode_command_help,
|
||||||
|
&unicode_last_position);
|
||||||
|
|
||||||
|
FOR_ACTIVE_TERM_OUTPUTS(term)
|
||||||
|
{
|
||||||
|
unsigned stringwidth;
|
||||||
|
grub_uint32_t *unicode_last_screen_position;
|
||||||
|
|
||||||
|
unicode_last_screen_position = unicode_command_help;
|
||||||
|
|
||||||
|
stringwidth = 0;
|
||||||
|
|
||||||
|
while (unicode_last_screen_position < unicode_last_position &&
|
||||||
|
stringwidth < ((grub_term_width (term) / 2) - 2))
|
||||||
|
{
|
||||||
|
stringwidth
|
||||||
|
+= grub_term_getcharwidth (term,
|
||||||
|
*unicode_last_screen_position);
|
||||||
|
unicode_last_screen_position++;
|
||||||
|
}
|
||||||
|
|
||||||
|
grub_print_ucs4 (unicode_command_help,
|
||||||
|
unicode_last_screen_position, term);
|
||||||
|
if (!(cnt % 2))
|
||||||
|
grub_print_spaces (term, grub_term_width (term) / 2
|
||||||
|
- stringwidth);
|
||||||
|
}
|
||||||
|
if (cnt % 2)
|
||||||
|
grub_printf ("\n");
|
||||||
|
cnt++;
|
||||||
|
|
||||||
|
grub_free (command_help);
|
||||||
|
grub_free (unicode_command_help);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (!(cnt % 2))
|
if (!(cnt % 2))
|
||||||
grub_printf ("\n");
|
grub_printf ("\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
grub_command_t cmd;
|
||||||
|
|
||||||
for (i = 0; i < argc; i++)
|
for (i = 0; i < argc; i++)
|
||||||
{
|
{
|
||||||
currarg = args[i];
|
currarg = args[i];
|
||||||
grub_command_iterate (print_command_help);
|
FOR_COMMANDS(cmd)
|
||||||
|
{
|
||||||
|
if (cmd->prio & GRUB_PRIO_LIST_FLAG_ACTIVE)
|
||||||
|
{
|
||||||
|
if (! grub_strncmp (cmd->name, currarg, grub_strlen (currarg)))
|
||||||
|
{
|
||||||
|
if (cnt++ > 0)
|
||||||
|
grub_printf ("\n\n");
|
||||||
|
|
||||||
|
if (cmd->flags & GRUB_COMMAND_FLAG_EXTCMD)
|
||||||
|
grub_arg_show_help ((grub_extcmd_t) cmd->data);
|
||||||
|
else
|
||||||
|
grub_printf ("%s %s %s\n%s\b", _("Usage:"), cmd->name, _(cmd->summary),
|
||||||
|
_(cmd->description));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
59
commands/i386/cmostest.c
Normal file
59
commands/i386/cmostest.c
Normal file
|
@ -0,0 +1,59 @@
|
||||||
|
/*
|
||||||
|
* 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/command.h>
|
||||||
|
#include <grub/misc.h>
|
||||||
|
#include <grub/cmos.h>
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
grub_cmd_cmostest (struct grub_command *cmd __attribute__ ((unused)),
|
||||||
|
int argc, char *argv[])
|
||||||
|
{
|
||||||
|
int byte, bit;
|
||||||
|
char *rest;
|
||||||
|
|
||||||
|
if (argc != 1)
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Address required.");
|
||||||
|
|
||||||
|
byte = grub_strtoul (argv[0], &rest, 0);
|
||||||
|
if (*rest != ':')
|
||||||
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "Address required.");
|
||||||
|
|
||||||
|
bit = grub_strtoul (rest + 1, 0, 0);
|
||||||
|
|
||||||
|
if (grub_cmos_read (byte) & (1 << bit))
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
|
||||||
|
return grub_error (GRUB_ERR_TEST_FAILURE, "false");
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_command_t cmd;
|
||||||
|
|
||||||
|
|
||||||
|
GRUB_MOD_INIT(cmostest)
|
||||||
|
{
|
||||||
|
cmd = grub_register_command ("cmostest", grub_cmd_cmostest,
|
||||||
|
"cmostest BYTE:BIT",
|
||||||
|
"Test bit at BYTE:BIT in CMOS.");
|
||||||
|
}
|
||||||
|
|
||||||
|
GRUB_MOD_FINI(cmostest)
|
||||||
|
{
|
||||||
|
grub_unregister_command (cmd);
|
||||||
|
}
|
|
@ -301,27 +301,23 @@ grub_mini_cmd_lsmod (struct grub_command *cmd __attribute__ ((unused)),
|
||||||
int argc __attribute__ ((unused)),
|
int argc __attribute__ ((unused)),
|
||||||
char *argv[] __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_dl_dep_t dep;
|
|
||||||
|
|
||||||
grub_printf ("%s\t%d\t\t", mod->name, mod->ref_count);
|
|
||||||
for (dep = mod->dep; dep; dep = dep->next)
|
|
||||||
{
|
|
||||||
if (dep != mod->dep)
|
|
||||||
grub_putchar (',');
|
|
||||||
|
|
||||||
grub_printf ("%s", dep->mod->name);
|
|
||||||
}
|
|
||||||
grub_putchar ('\n');
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_printf ("Name\tRef Count\tDependencies\n");
|
grub_printf ("Name\tRef Count\tDependencies\n");
|
||||||
grub_dl_iterate (print_module);
|
FOR_DL_MODULES (mod)
|
||||||
|
{
|
||||||
|
grub_dl_dep_t dep;
|
||||||
|
|
||||||
|
grub_printf ("%s\t%d\t\t", mod->name, mod->ref_count);
|
||||||
|
for (dep = mod->dep; dep; dep = dep->next)
|
||||||
|
{
|
||||||
|
if (dep != mod->dep)
|
||||||
|
grub_putchar (',');
|
||||||
|
|
||||||
|
grub_printf ("%s", dep->mod->name);
|
||||||
|
}
|
||||||
|
grub_putchar ('\n');
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
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)
|
if (check_device && grub_pci_get_device (dev) != device)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if (check_function && grub_pci_get_function (dev) != device)
|
if (check_function && grub_pci_get_function (dev) != function)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
addr = grub_pci_make_address (dev, regaddr);
|
addr = grub_pci_make_address (dev, regaddr);
|
||||||
|
|
|
@ -83,15 +83,24 @@ grub_usb_get_string (grub_usb_device_t dev, grub_uint8_t index, int langid,
|
||||||
0x06, (3 << 8) | index,
|
0x06, (3 << 8) | index,
|
||||||
langid, descstr.length, (char *) descstrp);
|
langid, descstr.length, (char *) descstrp);
|
||||||
|
|
||||||
*string = grub_malloc (descstr.length / 2);
|
if (descstrp->length == 0)
|
||||||
|
{
|
||||||
|
grub_free (descstrp);
|
||||||
|
*string = grub_strdup ("");
|
||||||
|
if (! *string)
|
||||||
|
return GRUB_USB_ERR_INTERNAL;
|
||||||
|
return GRUB_USB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
*string = grub_malloc (descstr.length * 2 + 1);
|
||||||
if (! *string)
|
if (! *string)
|
||||||
{
|
{
|
||||||
grub_free (descstrp);
|
grub_free (descstrp);
|
||||||
return GRUB_USB_ERR_INTERNAL;
|
return GRUB_USB_ERR_INTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_utf16_to_utf8 ((grub_uint8_t *) *string, descstrp->str, descstrp->length / 2 - 1);
|
*grub_utf16_to_utf8 ((grub_uint8_t *) *string, descstrp->str,
|
||||||
(*string)[descstr.length / 2 - 1] = '\0';
|
descstrp->length / 2 - 1) = 0;
|
||||||
grub_free (descstrp);
|
grub_free (descstrp);
|
||||||
|
|
||||||
return GRUB_USB_ERR_NONE;
|
return GRUB_USB_ERR_NONE;
|
||||||
|
|
|
@ -1,34 +1,33 @@
|
||||||
# -*- makefile -*-
|
# -*- makefile -*-
|
||||||
|
|
||||||
COMMON_CFLAGS += -nostdinc -isystem $(shell $(TARGET_CC) -print-file-name=include)
|
|
||||||
|
|
||||||
kernel_img_RELOCATABLE = yes
|
kernel_img_RELOCATABLE = yes
|
||||||
pkglib_PROGRAMS = kernel.img
|
pkglib_PROGRAMS = kernel.img
|
||||||
kernel_img_SOURCES = kern/device.c kern/disk.c kern/dl.c kern/env.c \
|
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/corecmd.c kern/file.c kern/fs.c kern/main.c kern/misc.c \
|
||||||
kern/parser.c kern/partition.c kern/term.c \
|
kern/parser.c kern/partition.c kern/term.c \
|
||||||
kern/rescue_reader.c kern/rescue_parser.c \
|
kern/rescue_reader.c kern/rescue_parser.c \
|
||||||
\
|
\
|
||||||
util/console.c util/grub-emu.c util/misc.c \
|
kern/emu/main.c kern/emu/mm.c kern/emu/misc.c \
|
||||||
util/hostdisk.c util/getroot.c util/mm.c util/time.c \
|
kern/emu/getroot.c kern/emu/time.c kern/emu/hostdisk.c \
|
||||||
\
|
kern/emu/hostfs.c kern/emu/console.c \
|
||||||
gnulib/progname.c util/hostfs.c disk/host.c
|
\
|
||||||
kernel_img_HEADERS += datetime.h util/misc.h
|
gnulib/progname.c disk/host.c
|
||||||
kernel_img_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Wno-undef -I$(srcdir)/gnulib
|
kernel_img_HEADERS += datetime.h emu/misc.h
|
||||||
|
kernel_img_CFLAGS = $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Wno-char-subscripts -Wno-unused -Wno-deprecated-declarations -Wno-undef -I$(srcdir)/gnulib
|
||||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS)
|
kernel_img_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
TARGET_NO_STRIP = yes
|
TARGET_NO_STRIP = yes
|
||||||
|
|
||||||
ifneq ($(TARGET_NO_MODULES), yes)
|
ifneq ($(TARGET_NO_MODULES), yes)
|
||||||
kernel_img_SOURCES += symlist.c kern/$(target_cpu)/dl.c
|
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), i386)
|
||||||
ifneq ($(target_cpu), x86_64)
|
ifneq ($(target_cpu), x86_64)
|
||||||
kernel_img_SOURCES += kern/$(target_cpu)/cache.S
|
kernel_img_SOURCES += kern/$(target_cpu)/cache.S
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
else
|
|
||||||
kernel_img_SOURCES += grub_emu_init.c
|
|
||||||
endif
|
|
||||||
|
|
||||||
# For halt.mod.
|
# For halt.mod.
|
||||||
pkglib_MODULES += halt.mod
|
pkglib_MODULES += halt.mod
|
||||||
|
@ -49,7 +48,7 @@ ifeq ($(enable_grub_emu_usb), yes)
|
||||||
kernel_img_HEADERS += libusb.h
|
kernel_img_HEADERS += libusb.h
|
||||||
|
|
||||||
pkglib_MODULES += libusb.mod
|
pkglib_MODULES += libusb.mod
|
||||||
libusb_mod_SOURCES = util/usb.c
|
libusb_mod_SOURCES = bus/usb/emu/usb.c
|
||||||
libusb_mod_CFLAGS =
|
libusb_mod_CFLAGS =
|
||||||
libusb_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
libusb_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
@ -76,7 +75,7 @@ endif
|
||||||
|
|
||||||
ifeq ($(enable_grub_emu_sdl), yes)
|
ifeq ($(enable_grub_emu_sdl), yes)
|
||||||
pkglib_MODULES += sdl.mod
|
pkglib_MODULES += sdl.mod
|
||||||
sdl_mod_SOURCES = util/sdl.c
|
sdl_mod_SOURCES = video/emu/sdl.c
|
||||||
sdl_mod_CFLAGS =
|
sdl_mod_CFLAGS =
|
||||||
sdl_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
sdl_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
grub_emu_LDFLAGS += $(LIBSDL)
|
grub_emu_LDFLAGS += $(LIBSDL)
|
||||||
|
@ -85,7 +84,7 @@ endif
|
||||||
|
|
||||||
ifeq ($(enable_grub_emu_pci), yes)
|
ifeq ($(enable_grub_emu_pci), yes)
|
||||||
pkglib_MODULES += pci.mod
|
pkglib_MODULES += pci.mod
|
||||||
pci_mod_SOURCES = util/pci.c commands/lspci.c
|
pci_mod_SOURCES = bus/emu/pci.c commands/lspci.c
|
||||||
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
grub_emu_LDFLAGS += $(LIBPCIACCESS)
|
grub_emu_LDFLAGS += $(LIBPCIACCESS)
|
||||||
kernel_img_HEADERS += libpciaccess.h
|
kernel_img_HEADERS += libpciaccess.h
|
||||||
|
@ -104,10 +103,10 @@ DISTCLEANFILES += grub_emu_init.c
|
||||||
CLEANFILES += grub-emu
|
CLEANFILES += grub-emu
|
||||||
ifneq ($(TARGET_NO_MODULES), yes)
|
ifneq ($(TARGET_NO_MODULES), yes)
|
||||||
grub-emu: $(pkglib_PROGRAMS)
|
grub-emu: $(pkglib_PROGRAMS)
|
||||||
$(CC) -o $@ $(pkglib_PROGRAMS) $(grub_emu_LDFLAGS) $(LDFLAGS)
|
$(CC) -o $@ $^ $(grub_emu_LDFLAGS) $(LDFLAGS)
|
||||||
else
|
else
|
||||||
grub-emu: $(pkglib_MODULES) $(pkglib_PROGRAMS)
|
grub-emu: $(pkglib_MODULES) $(pkglib_PROGRAMS)
|
||||||
$(CC) -o $@ $(pkglib_MODULES) $(pkglib_PROGRAMS) $(grub_emu_LDFLAGS) $(LDFLAGS)
|
$(CC) -o $@ $^ $(grub_emu_LDFLAGS) $(LDFLAGS)
|
||||||
endif
|
endif
|
||||||
GRUB_EMU=grub-emu
|
GRUB_EMU=grub-emu
|
||||||
|
|
||||||
|
|
|
@ -1,12 +1,13 @@
|
||||||
# -*- makefile -*-
|
# -*- makefile -*-
|
||||||
|
|
||||||
# Used by various components. These rules need to precede them.
|
# 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
|
sbin_UTILITIES += grub-mkdevicemap
|
||||||
grub_mkdevicemap_SOURCES = gnulib/progname.c util/grub-mkdevicemap.c \
|
grub_mkdevicemap_SOURCES = gnulib/progname.c util/grub-mkdevicemap.c \
|
||||||
util/deviceiter.c \
|
util/deviceiter.c \
|
||||||
util/misc.c
|
util/misc.c kern/emu/misc.c \
|
||||||
|
kern/env.c kern/err.c kern/list.c kern/misc.c kern/emu/mm.c
|
||||||
|
|
||||||
ifeq ($(target_cpu)-$(platform), sparc64-ieee1275)
|
ifeq ($(target_cpu)-$(platform), sparc64-ieee1275)
|
||||||
grub_mkdevicemap_SOURCES += util/ieee1275/ofpath.c util/ieee1275/devicemap.c
|
grub_mkdevicemap_SOURCES += util/ieee1275/ofpath.c util/ieee1275/devicemap.c
|
||||||
|
@ -14,20 +15,19 @@ else
|
||||||
grub_mkdevicemap_SOURCES += util/devicemap.c
|
grub_mkdevicemap_SOURCES += util/devicemap.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# For grub-mkelfimage.
|
# For grub-mkimage.
|
||||||
bin_UTILITIES += grub-mkelfimage
|
bin_UTILITIES += grub-mkimage
|
||||||
grub_mkelfimage_SOURCES = gnulib/progname.c \
|
grub_mkimage_SOURCES = gnulib/progname.c util/grub-mkimage.c util/misc.c \
|
||||||
util/elf/grub-mkimage.c util/misc.c \
|
util/resolve.c kern/emu/misc.c lib/LzmaEnc.c lib/LzFind.c
|
||||||
util/resolve.c
|
util/grub-mkimage.c_DEPENDENCIES = Makefile
|
||||||
util/elf/grub-mkimage.c_DEPENDENCIES = Makefile
|
|
||||||
|
|
||||||
# For grub-probe.
|
# For grub-probe.
|
||||||
sbin_UTILITIES += grub-probe
|
sbin_UTILITIES += grub-probe
|
||||||
util/grub-probe.c_DEPENDENCIES = grub_probe_init.h
|
util/grub-probe.c_DEPENDENCIES = grub_probe_init.h
|
||||||
grub_probe_SOURCES = gnulib/progname.c util/grub-probe.c \
|
grub_probe_SOURCES = gnulib/progname.c util/grub-probe.c \
|
||||||
util/hostdisk.c util/misc.c util/getroot.c util/mm.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/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/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 \
|
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
||||||
|
@ -44,24 +44,10 @@ ifeq ($(enable_grub_fstest), yes)
|
||||||
bin_UTILITIES += grub-fstest
|
bin_UTILITIES += grub-fstest
|
||||||
endif
|
endif
|
||||||
|
|
||||||
bin_UTILITIES += grub-mkisofs
|
|
||||||
grub_mkisofs_SOURCES = util/mkisofs/eltorito.c \
|
|
||||||
util/mkisofs/hash.c util/mkisofs/joliet.c \
|
|
||||||
util/mkisofs/match.c util/mkisofs/mkisofs.c \
|
|
||||||
util/mkisofs/multi.c util/mkisofs/name.c \
|
|
||||||
util/mkisofs/rock.c util/mkisofs/tree.c \
|
|
||||||
util/mkisofs/write.c \
|
|
||||||
\
|
|
||||||
gnulib/fnmatch.c gnulib/getopt1.c gnulib/getopt.c \
|
|
||||||
gnulib/error.c gnulib/progname.c
|
|
||||||
grub_mkisofs_CFLAGS = -D_FILE_OFFSET_BITS=64 \
|
|
||||||
-I$(srcdir)/util/mkisofs/include \
|
|
||||||
-Wno-all -Werror $(GNULIB_UTIL_CFLAGS)
|
|
||||||
|
|
||||||
# For grub-fstest.
|
# For grub-fstest.
|
||||||
util/grub-fstest.c_DEPENDENCIES = grub_fstest_init.h
|
util/grub-fstest.c_DEPENDENCIES = grub_fstest_init.h
|
||||||
grub_fstest_SOURCES = gnulib/progname.c util/grub-fstest.c util/hostfs.c \
|
grub_fstest_SOURCES = gnulib/progname.c util/grub-fstest.c kern/emu/hostfs.c \
|
||||||
util/misc.c util/mm.c \
|
util/misc.c kern/emu/misc.c kern/emu/mm.c \
|
||||||
kern/file.c kern/device.c kern/disk.c kern/err.c kern/misc.c \
|
kern/file.c kern/device.c kern/disk.c kern/err.c kern/misc.c \
|
||||||
disk/host.c disk/loopback.c kern/list.c kern/command.c \
|
disk/host.c disk/loopback.c kern/list.c kern/command.c \
|
||||||
lib/arg.c commands/extcmd.c normal/datetime.c normal/misc.c \
|
lib/arg.c commands/extcmd.c normal/datetime.c normal/misc.c \
|
||||||
|
@ -83,14 +69,14 @@ grub_fstest_SOURCES = gnulib/progname.c util/grub-fstest.c util/hostfs.c \
|
||||||
# For grub-mkfont.
|
# For grub-mkfont.
|
||||||
ifeq ($(enable_grub_mkfont), yes)
|
ifeq ($(enable_grub_mkfont), yes)
|
||||||
bin_UTILITIES += grub-mkfont
|
bin_UTILITIES += grub-mkfont
|
||||||
grub_mkfont_SOURCES = gnulib/progname.c util/grub-mkfont.c util/misc.c
|
grub_mkfont_SOURCES = gnulib/progname.c util/grub-mkfont.c util/misc.c kern/emu/misc.c
|
||||||
grub_mkfont_CFLAGS = $(freetype_cflags)
|
grub_mkfont_CFLAGS = $(freetype_cflags)
|
||||||
grub_mkfont_LDFLAGS = $(freetype_libs)
|
grub_mkfont_LDFLAGS = $(freetype_libs)
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# For grub-mkrelpath.
|
# For grub-mkrelpath.
|
||||||
bin_UTILITIES += grub-mkrelpath
|
bin_UTILITIES += grub-mkrelpath
|
||||||
grub_mkrelpath_SOURCES = gnulib/progname.c util/grub-mkrelpath.c util/misc.c
|
grub_mkrelpath_SOURCES = gnulib/progname.c util/grub-mkrelpath.c util/misc.c kern/emu/misc.c
|
||||||
|
|
||||||
bin_UTILITIES += grub-bin2h
|
bin_UTILITIES += grub-bin2h
|
||||||
grub_bin2h_SOURCES = gnulib/progname.c util/bin2h.c
|
grub_bin2h_SOURCES = gnulib/progname.c util/bin2h.c
|
||||||
|
@ -102,12 +88,11 @@ DISTCLEANFILES += grub_script.yy.c grub_script.yy.h
|
||||||
|
|
||||||
# For grub-script-check.
|
# For grub-script-check.
|
||||||
bin_UTILITIES += 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 \
|
grub_script_check_SOURCES = gnulib/progname.c gnulib/getdelim.c gnulib/getline.c \
|
||||||
util/grub-script-check.c util/misc.c util/mm.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 \
|
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/err.c kern/list.c \
|
||||||
kern/misc.c kern/env.c grub_script_check_init.c grub_script.tab.c \
|
kern/misc.c kern/env.c grub_script.tab.c \
|
||||||
grub_script.yy.c
|
grub_script.yy.c
|
||||||
grub_script_check_CFLAGS = $(GNULIB_UTIL_CFLAGS)
|
grub_script_check_CFLAGS = $(GNULIB_UTIL_CFLAGS)
|
||||||
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
MOSTLYCLEANFILES += symlist.c kernel_syms.lst
|
||||||
|
@ -116,10 +101,10 @@ DEFSYMFILES += kernel_syms.lst
|
||||||
kernel_img_HEADERS += boot.h cache.h device.h disk.h dl.h elf.h elfload.h \
|
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 \
|
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 \
|
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)
|
ifneq ($(platform), emu)
|
||||||
kernel_img_HEADERS += machine/memory.h machine/loader.h machine/kernel.h
|
kernel_img_HEADERS += machine/memory.h machine/loader.h
|
||||||
endif
|
endif
|
||||||
|
|
||||||
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
|
symlist.c: $(addprefix include/grub/,$(kernel_img_HEADERS)) config.h gensymlist.sh
|
||||||
|
@ -133,19 +118,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
|
$(YACC) -d -p grub_script_yy -b grub_script $(srcdir)/script/parser.y
|
||||||
DISTCLEANFILES += grub_script.tab.c grub_script.tab.h
|
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.
|
# For grub-probe.
|
||||||
grub_probe_init.lst: geninit.sh $(filter-out grub_probe_init.c,$(grub_probe_SOURCES))
|
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 > $@
|
rm -f $@; grep GRUB_MOD_INIT $(filter %.c,$^) /dev/null > $@
|
||||||
|
@ -187,7 +159,7 @@ DISTCLEANFILES += grub_fstest_init.c
|
||||||
|
|
||||||
# for grub-editenv
|
# for grub-editenv
|
||||||
bin_UTILITIES += grub-editenv
|
bin_UTILITIES += grub-editenv
|
||||||
grub_editenv_SOURCES = gnulib/progname.c util/grub-editenv.c lib/envblk.c util/misc.c util/mm.c kern/misc.c kern/err.c
|
grub_editenv_SOURCES = gnulib/progname.c util/grub-editenv.c lib/envblk.c util/misc.c kern/emu/misc.c kern/emu/mm.c kern/misc.c kern/err.c
|
||||||
CLEANFILES += grub-editenv
|
CLEANFILES += grub-editenv
|
||||||
|
|
||||||
# Needed for genmk.rb to work
|
# Needed for genmk.rb to work
|
||||||
|
@ -195,7 +167,7 @@ ifeq (0,1)
|
||||||
bin_UTILITIES += grub-macho2img grub-pe2elf
|
bin_UTILITIES += grub-macho2img grub-pe2elf
|
||||||
endif
|
endif
|
||||||
|
|
||||||
grub_pe2elf_SOURCES = gnulib/progname.c util/grub-pe2elf.c util/misc.c
|
grub_pe2elf_SOURCES = gnulib/progname.c util/grub-pe2elf.c util/misc.c kern/emu/misc.c
|
||||||
CLEANFILES += grub-pe2elf
|
CLEANFILES += grub-pe2elf
|
||||||
|
|
||||||
grub_macho2img_SOURCES = util/grub-macho2img.c
|
grub_macho2img_SOURCES = util/grub-macho2img.c
|
||||||
|
@ -462,12 +434,12 @@ scsi_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
scsi_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
scsi_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# Commands.
|
# 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 \
|
ls.mod cmp.mod cat.mod help.mod search.mod loopback.mod \
|
||||||
configfile.mod echo.mod \
|
configfile.mod echo.mod \
|
||||||
terminfo.mod test.mod blocklist.mod hexdump.mod \
|
terminfo.mod test.mod blocklist.mod hexdump.mod \
|
||||||
read.mod sleep.mod loadenv.mod crc.mod parttool.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 \
|
gptsync.mod true.mod probe.mod password.mod \
|
||||||
keystatus.mod
|
keystatus.mod
|
||||||
|
|
||||||
|
@ -528,11 +500,6 @@ msdospart_mod_SOURCES = parttool/msdospart.c
|
||||||
msdospart_mod_CFLAGS = $(COMMON_CFLAGS)
|
msdospart_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
msdospart_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
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.
|
# For ls.mod.
|
||||||
ls_mod_SOURCES = commands/ls.c
|
ls_mod_SOURCES = commands/ls.c
|
||||||
ls_mod_CFLAGS = $(COMMON_CFLAGS)
|
ls_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
@ -652,18 +619,14 @@ keystatus_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For normal.mod.
|
# For normal.mod.
|
||||||
normal_mod_SOURCES = normal/main.c normal/cmdline.c normal/dyncmd.c \
|
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/color.c normal/completion.c normal/datetime.c normal/menu.c \
|
||||||
normal/menu_entry.c normal/menu_text.c \
|
normal/menu_entry.c normal/menu_text.c \
|
||||||
normal/misc.c normal/crypto.c normal/term.c normal/context.c
|
normal/misc.c normal/crypto.c normal/term.c normal/context.c \
|
||||||
normal_mod_CFLAGS = $(COMMON_CFLAGS)
|
script/main.c script/script.c script/execute.c \
|
||||||
normal_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
||||||
|
|
||||||
# For sh.mod.
|
|
||||||
sh_mod_SOURCES = script/main.c script/script.c script/execute.c \
|
|
||||||
script/function.c script/lexer.c grub_script.tab.c grub_script.yy.c
|
script/function.c script/lexer.c grub_script.tab.c grub_script.yy.c
|
||||||
sh_mod_CFLAGS = $(COMMON_CFLAGS) $(POSIX_CFLAGS) -Wno-error
|
normal_mod_CFLAGS = $(COMMON_CFLAGS) $(POSIX_CFLAGS) -Wno-error
|
||||||
sh_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
normal_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
ifneq (, $(FONT_SOURCE))
|
ifneq (, $(FONT_SOURCE))
|
||||||
font/font.c_DEPENDENCIES = ascii.h
|
font/font.c_DEPENDENCIES = ascii.h
|
||||||
|
@ -861,7 +824,7 @@ boot_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
boot_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
bin_UTILITIES += grub-mkpasswd-pbkdf2
|
bin_UTILITIES += grub-mkpasswd-pbkdf2
|
||||||
grub_mkpasswd_pbkdf2_SOURCES = gnulib/progname.c gnulib/getdelim.c gnulib/getline.c util/grub-mkpasswd-pbkdf2.c lib/crypto.c lib/libgcrypt-grub/cipher/sha512.c lib/pbkdf2.c util/misc.c util/mm.c kern/err.c
|
grub_mkpasswd_pbkdf2_SOURCES = gnulib/progname.c gnulib/getdelim.c gnulib/getline.c util/grub-mkpasswd-pbkdf2.c lib/crypto.c lib/libgcrypt-grub/cipher/sha512.c lib/pbkdf2.c util/misc.c kern/emu/misc.c kern/emu/mm.c kern/err.c
|
||||||
grub_mkpasswd_pbkdf2_CFLAGS += -Wno-missing-field-initializers -Wno-error -I$(srcdir)/lib/libgcrypt_wrap -DGRUB_MKPASSWD=1
|
grub_mkpasswd_pbkdf2_CFLAGS += -Wno-missing-field-initializers -Wno-error -I$(srcdir)/lib/libgcrypt_wrap -DGRUB_MKPASSWD=1
|
||||||
|
|
||||||
include $(srcdir)/conf/gcry.mk
|
include $(srcdir)/conf/gcry.mk
|
||||||
|
|
|
@ -4,8 +4,6 @@ COMMON_CFLAGS = -mrtd -mregparm=3
|
||||||
|
|
||||||
# Images.
|
# Images.
|
||||||
|
|
||||||
GRUB_KERNEL_MACHINE_LINK_ADDR = 0x8200
|
|
||||||
|
|
||||||
pkglib_PROGRAMS += kernel.img
|
pkglib_PROGRAMS += kernel.img
|
||||||
kernel_img_SOURCES = kern/i386/coreboot/startup.S \
|
kernel_img_SOURCES = kern/i386/coreboot/startup.S \
|
||||||
kern/i386/misc.S \
|
kern/i386/misc.S \
|
||||||
|
@ -16,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/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \
|
||||||
kern/misc.c kern/mm.c kern/term.c \
|
kern/misc.c kern/mm.c kern/term.c \
|
||||||
kern/rescue_parser.c kern/rescue_reader.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/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
|
||||||
kern/i386/tsc.c kern/i386/pit.c \
|
kern/i386/tsc.c kern/i386/pit.c \
|
||||||
kern/generic/rtc_get_time_ms.c \
|
kern/generic/rtc_get_time_ms.c \
|
||||||
|
@ -26,7 +24,7 @@ kernel_img_SOURCES = kern/i386/coreboot/startup.S \
|
||||||
symlist.c
|
symlist.c
|
||||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
||||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
kernel_img_LDFLAGS += $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,$(GRUB_KERNEL_MACHINE_LINK_ADDR),-Bstatic
|
kernel_img_LDFLAGS += $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,0x8200,-Bstatic
|
||||||
|
|
||||||
sbin_SCRIPTS += grub-install
|
sbin_SCRIPTS += grub-install
|
||||||
grub_install_SOURCES = util/grub-install.in
|
grub_install_SOURCES = util/grub-install.in
|
||||||
|
@ -70,5 +68,11 @@ datetime_mod_SOURCES = lib/cmos_datetime.c
|
||||||
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
datetime_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
datetime_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For cmostest.mod
|
||||||
|
pkglib_MODULES += cmostest.mod
|
||||||
|
cmostest_mod_SOURCES = commands/i386/cmostest.c
|
||||||
|
cmostest_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
cmostest_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
include $(srcdir)/conf/i386.mk
|
include $(srcdir)/conf/i386.mk
|
||||||
include $(srcdir)/conf/common.mk
|
include $(srcdir)/conf/common.mk
|
||||||
|
|
|
@ -18,7 +18,7 @@ kernel_img_SOURCES = kern/i386/ieee1275/startup.S \
|
||||||
kern/rescue_parser.c kern/rescue_reader.c \
|
kern/rescue_parser.c kern/rescue_reader.c \
|
||||||
kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
|
kern/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
|
||||||
kern/env.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/generic/millisleep.c \
|
||||||
kern/ieee1275/ieee1275.c \
|
kern/ieee1275/ieee1275.c \
|
||||||
term/ieee1275/ofconsole.c \
|
term/ieee1275/ofconsole.c \
|
||||||
|
|
|
@ -1,12 +1,9 @@
|
||||||
# -*- makefile -*-
|
# -*- makefile -*-
|
||||||
|
|
||||||
GRUB_KERNEL_MACHINE_LINK_ADDR = 0x8200
|
|
||||||
|
|
||||||
COMMON_CFLAGS = -mrtd -mregparm=3
|
COMMON_CFLAGS = -mrtd -mregparm=3
|
||||||
|
|
||||||
# Images.
|
# Images.
|
||||||
pkglib_IMAGES = boot.img cdboot.img diskboot.img kernel.img lnxboot.img \
|
pkglib_IMAGES = boot.img cdboot.img diskboot.img lnxboot.img pxeboot.img
|
||||||
pxeboot.img
|
|
||||||
|
|
||||||
# For boot.img.
|
# For boot.img.
|
||||||
boot_img_SOURCES = boot/i386/pc/boot.S
|
boot_img_SOURCES = boot/i386/pc/boot.S
|
||||||
|
@ -39,13 +36,14 @@ cdboot_img_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)0x7C00
|
||||||
cdboot_img_FORMAT = binary
|
cdboot_img_FORMAT = binary
|
||||||
|
|
||||||
# For kernel.img.
|
# For kernel.img.
|
||||||
|
pkglib_PROGRAMS = kernel.img
|
||||||
kernel_img_SOURCES = kern/i386/pc/startup.S \
|
kernel_img_SOURCES = kern/i386/pc/startup.S \
|
||||||
kern/i386/misc.S \
|
kern/i386/misc.S \
|
||||||
kern/main.c kern/device.c \
|
kern/main.c kern/device.c \
|
||||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.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/misc.c kern/mm.c kern/term.c \
|
||||||
kern/rescue_parser.c kern/rescue_reader.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/$(target_cpu)/dl.c kern/i386/pc/init.c kern/i386/pc/mmap.c \
|
||||||
kern/parser.c kern/partition.c \
|
kern/parser.c kern/partition.c \
|
||||||
kern/i386/tsc.c kern/i386/pit.c \
|
kern/i386/tsc.c kern/i386/pit.c \
|
||||||
|
@ -55,42 +53,33 @@ kernel_img_SOURCES = kern/i386/pc/startup.S \
|
||||||
term/i386/pc/console.c term/i386/vga_common.c \
|
term/i386/pc/console.c term/i386/vga_common.c \
|
||||||
symlist.c
|
symlist.c
|
||||||
kernel_img_HEADERS += machine/biosdisk.h machine/vga.h machine/vbe.h \
|
kernel_img_HEADERS += machine/biosdisk.h machine/vga.h machine/vbe.h \
|
||||||
machine/pxe.h i386/pit.h
|
machine/pxe.h i386/pit.h machine/kernel.h
|
||||||
kernel_img_CFLAGS = $(COMMON_CFLAGS) $(TARGET_IMG_CFLAGS)
|
kernel_img_CFLAGS = $(COMMON_CFLAGS) $(TARGET_IMG_CFLAGS)
|
||||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
kernel_img_LDFLAGS += $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_KERNEL_MACHINE_LINK_ADDR) $(COMMON_CFLAGS)
|
kernel_img_LDFLAGS += $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)0x8200 $(COMMON_CFLAGS)
|
||||||
kernel_img_FORMAT = binary
|
|
||||||
|
|
||||||
# Utilities.
|
# Utilities.
|
||||||
bin_UTILITIES = grub-mkimage
|
|
||||||
sbin_UTILITIES = grub-setup
|
sbin_UTILITIES = grub-setup
|
||||||
|
|
||||||
# For grub-mkimage.
|
|
||||||
grub_mkimage_SOURCES = gnulib/progname.c util/grub-mkrawimage.c util/misc.c \
|
|
||||||
util/resolve.c lib/LzmaEnc.c lib/LzFind.c
|
|
||||||
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
|
|
||||||
util/grub-mkrawimage.c_DEPENDENCIES = Makefile
|
|
||||||
|
|
||||||
# For grub-setup.
|
# For grub-setup.
|
||||||
util/i386/pc/grub-setup.c_DEPENDENCIES = grub_setup_init.h
|
util/i386/pc/grub-setup.c_DEPENDENCIES = grub_setup_init.h
|
||||||
grub_setup_SOURCES = gnulib/progname.c \
|
grub_setup_SOURCES = gnulib/progname.c util/i386/pc/grub-setup.c \
|
||||||
util/i386/pc/grub-setup.c util/hostdisk.c \
|
util/misc.c kern/emu/misc.c kern/emu/getroot.c \
|
||||||
util/misc.c util/getroot.c kern/device.c kern/disk.c \
|
kern/emu/hostdisk.c kern/device.c kern/disk.c kern/err.c \
|
||||||
kern/err.c kern/misc.c kern/parser.c kern/partition.c \
|
kern/misc.c kern/partition.c kern/file.c \
|
||||||
kern/file.c kern/fs.c kern/env.c kern/list.c \
|
kern/emu/mm.c kern/fs.c kern/env.c kern/list.c fs/fshelp.c \
|
||||||
fs/fshelp.c \
|
\
|
||||||
\
|
fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \
|
||||||
fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \
|
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
||||||
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
fs/nilfs2.c fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c \
|
||||||
fs/nilfs2.c fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c \
|
fs/sfs.c fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c \
|
||||||
fs/sfs.c fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c \
|
fs/afs_be.c fs/befs.c fs/befs_be.c fs/tar.c \
|
||||||
fs/afs_be.c fs/befs.c fs/befs_be.c fs/tar.c \
|
\
|
||||||
\
|
partmap/msdos.c partmap/bsdlabel.c partmap/sunpc.c \
|
||||||
partmap/msdos.c partmap/bsdlabel.c partmap/sunpc.c \
|
partmap/gpt.c \
|
||||||
partmap/gpt.c \
|
\
|
||||||
\
|
disk/raid.c disk/mdraid_linux.c disk/lvm.c \
|
||||||
disk/raid.c disk/mdraid_linux.c disk/lvm.c \
|
util/raid.c util/lvm.c \
|
||||||
util/raid.c util/lvm.c util/mm.c \
|
|
||||||
grub_setup_init.c
|
grub_setup_init.c
|
||||||
|
|
||||||
sbin_SCRIPTS += grub-install
|
sbin_SCRIPTS += grub-install
|
||||||
|
@ -255,6 +244,12 @@ hdparm_mod_SOURCES = commands/hdparm.c lib/hexdump.c
|
||||||
hdparm_mod_CFLAGS = $(COMMON_CFLAGS)
|
hdparm_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
hdparm_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
hdparm_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For cmostest.mod
|
||||||
|
pkglib_MODULES += cmostest.mod
|
||||||
|
cmostest_mod_SOURCES = commands/i386/cmostest.c
|
||||||
|
cmostest_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
cmostest_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
ifeq ($(enable_efiemu), yes)
|
ifeq ($(enable_efiemu), yes)
|
||||||
|
|
||||||
efiemu32.o: efiemu/runtime/efiemu.c $(TARGET_OBJ2ELF)
|
efiemu32.o: efiemu/runtime/efiemu.c $(TARGET_OBJ2ELF)
|
||||||
|
|
|
@ -13,13 +13,7 @@ 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_LDFLAGS = $(COMMON_LDFLAGS) $(TARGET_IMG_LDFLAGS)$(GRUB_BOOT_MACHINE_LINK_ADDR)
|
||||||
boot_img_FORMAT = binary
|
boot_img_FORMAT = binary
|
||||||
|
|
||||||
bin_UTILITIES += grub-mkimage
|
pkglib_PROGRAMS += kernel.img
|
||||||
grub_mkimage_SOURCES = util/grub-mkrawimage.c util/misc.c \
|
|
||||||
util/resolve.c gnulib/progname.c
|
|
||||||
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(GRUB_KERNEL_MACHINE_LINK_ADDR)
|
|
||||||
util/grub-mkrawimage.c_DEPENDENCIES = Makefile
|
|
||||||
|
|
||||||
pkglib_IMAGES += kernel.img
|
|
||||||
kernel_img_SOURCES = kern/i386/qemu/startup.S \
|
kernel_img_SOURCES = kern/i386/qemu/startup.S \
|
||||||
kern/i386/misc.S \
|
kern/i386/misc.S \
|
||||||
kern/i386/coreboot/init.c \
|
kern/i386/coreboot/init.c \
|
||||||
|
@ -29,7 +23,7 @@ kernel_img_SOURCES = kern/i386/qemu/startup.S \
|
||||||
kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.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/misc.c kern/mm.c kern/term.c \
|
||||||
kern/rescue_parser.c kern/rescue_reader.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/$(target_cpu)/dl.c kern/parser.c kern/partition.c \
|
||||||
kern/i386/tsc.c kern/i386/pit.c \
|
kern/i386/tsc.c kern/i386/pit.c \
|
||||||
kern/generic/rtc_get_time_ms.c \
|
kern/generic/rtc_get_time_ms.c \
|
||||||
|
|
|
@ -56,6 +56,12 @@ pci_mod_SOURCES = bus/pci.c
|
||||||
pci_mod_CFLAGS = $(COMMON_CFLAGS)
|
pci_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
pci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For cs5536.mod
|
||||||
|
pkglib_MODULES += cs5536.mod
|
||||||
|
cs5536_mod_SOURCES = bus/cs5536.c
|
||||||
|
cs5536_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
cs5536_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
# For lspci.mod
|
# For lspci.mod
|
||||||
pkglib_MODULES += lspci.mod
|
pkglib_MODULES += lspci.mod
|
||||||
lspci_mod_SOURCES = commands/lspci.c
|
lspci_mod_SOURCES = commands/lspci.c
|
||||||
|
|
|
@ -5,14 +5,14 @@ COMMON_CFLAGS += -march=mips3
|
||||||
COMMON_ASFLAGS += -march=mips3
|
COMMON_ASFLAGS += -march=mips3
|
||||||
include $(srcdir)/conf/mips.mk
|
include $(srcdir)/conf/mips.mk
|
||||||
|
|
||||||
pkglib_IMAGES = kernel.img
|
pkglib_PROGRAMS = kernel.img
|
||||||
kernel_img_SOURCES = kern/$(target_cpu)/startup.S \
|
kernel_img_SOURCES = kern/$(target_cpu)/startup.S \
|
||||||
kern/main.c kern/device.c kern/$(target_cpu)/init.c \
|
kern/main.c kern/device.c kern/$(target_cpu)/init.c \
|
||||||
kern/$(target_cpu)/$(target_machine)/init.c \
|
kern/$(target_cpu)/$(target_machine)/init.c \
|
||||||
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.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/misc.c kern/mm.c kern/term.c \
|
||||||
kern/rescue_parser.c kern/rescue_reader.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/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/generic/millisleep.c kern/generic/rtc_get_time_ms.c kern/time.c \
|
||||||
symlist.c kern/$(target_cpu)/cache.S
|
symlist.c kern/$(target_cpu)/cache.S
|
||||||
|
|
|
@ -4,18 +4,19 @@ target_machine=yeeloong
|
||||||
COMMON_CFLAGS += -march=mips3
|
COMMON_CFLAGS += -march=mips3
|
||||||
COMMON_ASFLAGS += -march=mips3
|
COMMON_ASFLAGS += -march=mips3
|
||||||
|
|
||||||
kernel_img_HEADERS += pci.h bitmap.h video.h gfxterm.h font.h bitmap_scale.h bufio.h
|
kernel_img_HEADERS += pci.h bitmap.h video.h gfxterm.h font.h \
|
||||||
|
bitmap_scale.h bufio.h cs5536.h machine/pci.h
|
||||||
|
|
||||||
include $(srcdir)/conf/mips.mk
|
include $(srcdir)/conf/mips.mk
|
||||||
|
|
||||||
pkglib_IMAGES = kernel.img
|
pkglib_PROGRAMS = kernel.img
|
||||||
kernel_img_SOURCES = kern/$(target_cpu)/startup.S \
|
kernel_img_SOURCES = kern/$(target_cpu)/startup.S \
|
||||||
kern/main.c kern/device.c kern/$(target_cpu)/init.c \
|
kern/main.c kern/device.c kern/$(target_cpu)/init.c \
|
||||||
kern/$(target_cpu)/$(target_machine)/init.c \
|
kern/$(target_cpu)/$(target_machine)/init.c \
|
||||||
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.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/misc.c kern/mm.c kern/term.c \
|
||||||
kern/rescue_parser.c kern/rescue_reader.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/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/generic/millisleep.c kern/generic/rtc_get_time_ms.c kern/time.c \
|
||||||
kern/$(target_cpu)/cache.S \
|
kern/$(target_cpu)/cache.S \
|
||||||
|
@ -26,6 +27,7 @@ kernel_img_SOURCES = kern/$(target_cpu)/startup.S \
|
||||||
video/fb/fbfill.c video/fb/fbutil.c video/bitmap.c \
|
video/fb/fbfill.c video/fb/fbutil.c video/bitmap.c \
|
||||||
video/bitmap_scale.c video/sm712.c bus/pci.c bus/bonito.c \
|
video/bitmap_scale.c video/sm712.c bus/pci.c bus/bonito.c \
|
||||||
term/gfxterm.c commands/extcmd.c lib/arg.c \
|
term/gfxterm.c commands/extcmd.c lib/arg.c \
|
||||||
|
bus/cs5536.c \
|
||||||
symlist.c
|
symlist.c
|
||||||
kernel_img_CFLAGS = $(COMMON_CFLAGS) -DUSE_ASCII_FAILBACK
|
kernel_img_CFLAGS = $(COMMON_CFLAGS) -DUSE_ASCII_FAILBACK
|
||||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
|
@ -69,5 +71,35 @@ linux_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
linux_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
linux_mod_ASFLAGS = $(COMMON_ASFLAGS)
|
||||||
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
linux_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For usb.mod
|
||||||
|
pkglib_MODULES += usb.mod
|
||||||
|
usb_mod_SOURCES = bus/usb/usb.c bus/usb/usbtrans.c bus/usb/usbhub.c
|
||||||
|
usb_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
usb_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For usbtest.mod
|
||||||
|
pkglib_MODULES += usbtest.mod
|
||||||
|
usbtest_mod_SOURCES = commands/usbtest.c
|
||||||
|
usbtest_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
usbtest_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For ohci.mod
|
||||||
|
pkglib_MODULES += ohci.mod
|
||||||
|
ohci_mod_SOURCES = bus/usb/ohci.c
|
||||||
|
ohci_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
ohci_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For usbms.mod
|
||||||
|
pkglib_MODULES += usbms.mod
|
||||||
|
usbms_mod_SOURCES = disk/usbms.c
|
||||||
|
usbms_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
usbms_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
|
# For usb_keyboard.mod
|
||||||
|
pkglib_MODULES += usb_keyboard.mod
|
||||||
|
usb_keyboard_mod_SOURCES = term/usb_keyboard.c
|
||||||
|
usb_keyboard_mod_CFLAGS = $(COMMON_CFLAGS)
|
||||||
|
usb_keyboard_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
||||||
|
|
||||||
sbin_SCRIPTS += grub-install
|
sbin_SCRIPTS += grub-install
|
||||||
grub_install_SOURCES = util/grub-install.in
|
grub_install_SOURCES = util/grub-install.in
|
||||||
|
|
|
@ -10,13 +10,6 @@ kernel_img_HEADERS += cpu/cache.h
|
||||||
sbin_SCRIPTS =
|
sbin_SCRIPTS =
|
||||||
bin_SCRIPTS =
|
bin_SCRIPTS =
|
||||||
|
|
||||||
# For grub-mkimage.
|
|
||||||
bin_UTILITIES += grub-mkimage
|
|
||||||
grub_mkimage_SOURCES = gnulib/progname.c util/grub-mkrawimage.c util/misc.c \
|
|
||||||
util/resolve.c lib/LzmaEnc.c lib/LzFind.c
|
|
||||||
grub_mkimage_CFLAGS = -DGRUB_KERNEL_MACHINE_LINK_ADDR=$(LINK_BASE)
|
|
||||||
util/grub-mkrawimage.c_DEPENDENCIES = Makefile
|
|
||||||
|
|
||||||
# For serial.mod.
|
# For serial.mod.
|
||||||
pkglib_MODULES += serial.mod
|
pkglib_MODULES += serial.mod
|
||||||
serial_mod_SOURCES = term/serial.c
|
serial_mod_SOURCES = term/serial.c
|
||||||
|
|
|
@ -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/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
|
||||||
kern/misc.c kern/mm.c kern/term.c \
|
kern/misc.c kern/mm.c kern/term.c \
|
||||||
kern/rescue_parser.c kern/rescue_reader.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/init.c \
|
||||||
kern/ieee1275/mmap.c \
|
kern/ieee1275/mmap.c \
|
||||||
term/ieee1275/ofconsole.c \
|
term/ieee1275/ofconsole.c \
|
||||||
|
|
|
@ -5,7 +5,8 @@ COMMON_CFLAGS = -mno-app-regs
|
||||||
COMMON_LDFLAGS = -melf64_sparc -mno-relax
|
COMMON_LDFLAGS = -melf64_sparc -mno-relax
|
||||||
|
|
||||||
# Images.
|
# Images.
|
||||||
pkglib_IMAGES = boot.img diskboot.img kernel.img
|
pkglib_IMAGES = boot.img diskboot.img
|
||||||
|
pkglib_PROGRAMS = kernel.img
|
||||||
|
|
||||||
# For boot.img.
|
# For boot.img.
|
||||||
boot_img_SOURCES = boot/sparc64/ieee1275/boot.S
|
boot_img_SOURCES = boot/sparc64/ieee1275/boot.S
|
||||||
|
@ -25,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/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
|
||||||
kern/misc.c kern/mm.c kern/term.c \
|
kern/misc.c kern/mm.c kern/term.c \
|
||||||
kern/rescue_parser.c kern/rescue_reader.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/ieee1275.c \
|
||||||
kern/sparc64/ieee1275/init.c \
|
kern/sparc64/ieee1275/init.c \
|
||||||
kern/ieee1275/mmap.c \
|
kern/ieee1275/mmap.c \
|
||||||
|
@ -40,38 +41,33 @@ kernel_img_LDFLAGS += -nostdlib -Wl,-N,-Ttext,0x4400,-Bstatic,-melf64_sparc
|
||||||
kernel_img_FORMAT = binary
|
kernel_img_FORMAT = binary
|
||||||
|
|
||||||
# Utilities.
|
# Utilities.
|
||||||
bin_UTILITIES = grub-mkimage
|
|
||||||
sbin_UTILITIES = grub-setup grub-ofpathname
|
sbin_UTILITIES = grub-setup grub-ofpathname
|
||||||
|
|
||||||
# For grub-mkimage.
|
|
||||||
grub_mkimage_SOURCES = util/grub-mkrawimage.c util/misc.c \
|
|
||||||
util/resolve.c gnulib/progname.c
|
|
||||||
|
|
||||||
# For grub-setup.
|
# For grub-setup.
|
||||||
util/sparc64/ieee1275/grub-setup.c_DEPENDENCIES = grub_setup_init.h
|
util/sparc64/ieee1275/grub-setup.c_DEPENDENCIES = grub_setup_init.h
|
||||||
grub_setup_SOURCES = util/sparc64/ieee1275/grub-setup.c util/hostdisk.c \
|
grub_setup_SOURCES = util/sparc64/ieee1275/grub-setup.c \
|
||||||
util/ieee1275/ofpath.c \
|
util/ieee1275/ofpath.c util/misc.c kern/emu/hostdisk.c \
|
||||||
util/misc.c util/getroot.c kern/device.c kern/disk.c \
|
kern/emu/misc.c kern/emu/getroot.c kern/emu/mm.c kern/device.c \
|
||||||
kern/err.c kern/misc.c kern/parser.c kern/partition.c \
|
kern/disk.c kern/err.c kern/misc.c \
|
||||||
kern/file.c kern/fs.c kern/env.c kern/list.c \
|
kern/partition.c kern/file.c kern/fs.c kern/env.c kern/list.c \
|
||||||
fs/fshelp.c \
|
fs/fshelp.c \
|
||||||
\
|
\
|
||||||
fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \
|
fs/affs.c fs/cpio.c fs/ext2.c fs/fat.c fs/hfs.c \
|
||||||
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
fs/hfsplus.c fs/iso9660.c fs/udf.c fs/jfs.c fs/minix.c \
|
||||||
fs/nilfs2.c fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c \
|
fs/nilfs2.c fs/ntfs.c fs/ntfscomp.c fs/reiserfs.c \
|
||||||
fs/sfs.c fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c \
|
fs/sfs.c fs/ufs.c fs/ufs2.c fs/xfs.c fs/afs.c \
|
||||||
fs/afs_be.c fs/befs.c fs/befs_be.c fs/tar.c \
|
fs/afs_be.c fs/befs.c fs/befs_be.c fs/tar.c \
|
||||||
\
|
\
|
||||||
partmap/amiga.c partmap/apple.c partmap/msdos.c \
|
partmap/amiga.c partmap/apple.c partmap/msdos.c \
|
||||||
partmap/bsdlabel.c partmap/sun.c partmap/acorn.c \
|
partmap/bsdlabel.c partmap/sun.c partmap/acorn.c \
|
||||||
\
|
\
|
||||||
disk/raid.c disk/mdraid_linux.c disk/lvm.c \
|
disk/raid.c disk/mdraid_linux.c disk/lvm.c util/raid.c \
|
||||||
util/raid.c util/lvm.c util/mm.c gnulib/progname.c \
|
util/lvm.c gnulib/progname.c grub_setup_init.c
|
||||||
grub_setup_init.c
|
|
||||||
|
|
||||||
# For grub-ofpathname.
|
# For grub-ofpathname.
|
||||||
grub_ofpathname_SOURCES = util/ieee1275/grub-ofpathname.c \
|
grub_ofpathname_SOURCES = util/ieee1275/grub-ofpathname.c \
|
||||||
util/ieee1275/ofpath.c util/misc.c gnulib/progname.c
|
util/ieee1275/ofpath.c util/misc.c kern/emu/misc.c \
|
||||||
|
gnulib/progname.c
|
||||||
|
|
||||||
# Scripts.
|
# Scripts.
|
||||||
sbin_SCRIPTS = grub-install
|
sbin_SCRIPTS = grub-install
|
||||||
|
|
|
@ -1,19 +1,14 @@
|
||||||
# -*- makefile -*-
|
# -*- makefile -*-
|
||||||
|
|
||||||
# Utilities.
|
|
||||||
bin_UTILITIES = grub-mkimage
|
|
||||||
|
|
||||||
# For grub-mkimage.
|
|
||||||
grub_mkimage_SOURCES = gnulib/progname.c util/i386/efi/grub-mkimage.c \
|
|
||||||
util/misc.c util/resolve.c
|
|
||||||
util/i386/efi/grub-mkimage.c_DEPENDENCIES = Makefile
|
|
||||||
|
|
||||||
# Scripts.
|
# Scripts.
|
||||||
sbin_SCRIPTS = grub-install
|
sbin_SCRIPTS = grub-install
|
||||||
|
|
||||||
# For grub-install.
|
# For grub-install.
|
||||||
grub_install_SOURCES = util/i386/efi/grub-install.in
|
grub_install_SOURCES = util/i386/efi/grub-install.in
|
||||||
|
|
||||||
|
bin_SCRIPTS += grub-mkrescue
|
||||||
|
grub_mkrescue_SOURCES = util/grub-mkrescue.in
|
||||||
|
|
||||||
# Modules.
|
# Modules.
|
||||||
pkglib_PROGRAMS = kernel.img
|
pkglib_PROGRAMS = kernel.img
|
||||||
pkglib_MODULES = chain.mod appleldr.mod \
|
pkglib_MODULES = chain.mod appleldr.mod \
|
||||||
|
@ -30,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/$(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 \
|
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 \
|
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/i386/tsc.c kern/i386/pit.c \
|
||||||
kern/generic/rtc_get_time_ms.c \
|
kern/generic/rtc_get_time_ms.c \
|
||||||
kern/generic/millisleep.c
|
kern/generic/millisleep.c
|
||||||
|
|
31
configure.ac
31
configure.ac
|
@ -150,6 +150,7 @@ case "$target_cpu" in
|
||||||
mips) machine_CFLAGS="$machine_CFLAGS -DGRUB_MACHINE_MIPS=1" ;;
|
mips) machine_CFLAGS="$machine_CFLAGS -DGRUB_MACHINE_MIPS=1" ;;
|
||||||
sparc64) machine_CFLAGS="$machine_CFLAGS -DGRUB_MACHINE_SPARC64=1" ;;
|
sparc64) machine_CFLAGS="$machine_CFLAGS -DGRUB_MACHINE_SPARC64=1" ;;
|
||||||
esac
|
esac
|
||||||
|
machine_CFLAGS="$machine_CFLAGS -DMACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
|
||||||
|
|
||||||
CFLAGS="$CFLAGS $machine_CFLAGS"
|
CFLAGS="$CFLAGS $machine_CFLAGS"
|
||||||
TARGET_ASFLAGS="$TARGET_ASFLAGS $machine_CFLAGS"
|
TARGET_ASFLAGS="$TARGET_ASFLAGS $machine_CFLAGS"
|
||||||
|
@ -178,11 +179,13 @@ if test "x$YACC" = x; then
|
||||||
AC_MSG_ERROR([bison is not found])
|
AC_MSG_ERROR([bison is not found])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for file in /usr/src/unifont.bdf /usr/share/fonts/X11/misc/unifont.pcf.gz /usr/share/fonts/unifont/unifont.pcf.gz; do
|
for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
|
||||||
if test -e $file ; then
|
for dir in . /usr/src /usr/share/fonts/X11/misc /usr/share/fonts/unifont; do
|
||||||
AC_SUBST([FONT_SOURCE], [$file])
|
if test -f "$dir/unifont.$ext"; then
|
||||||
break
|
AC_SUBST([FONT_SOURCE], [$dir/unifont.$ext])
|
||||||
fi
|
break 2
|
||||||
|
fi
|
||||||
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
|
@ -191,7 +194,7 @@ AC_PROG_LEX
|
||||||
AC_PROG_MAKE_SET
|
AC_PROG_MAKE_SET
|
||||||
AC_PROG_MKDIR_P
|
AC_PROG_MKDIR_P
|
||||||
|
|
||||||
if test "x$LEX" = x; then
|
if test "x$LEX" = "x:"; then
|
||||||
AC_MSG_ERROR([flex is not found])
|
AC_MSG_ERROR([flex is not found])
|
||||||
else
|
else
|
||||||
version=`$LEX --version | $AWK '{ split($NF,x,"."); print x[[1]]*10000+x[[2]]*100+x[[3]]; }'`
|
version=`$LEX --version | $AWK '{ split($NF,x,"."); print x[[1]]*10000+x[[2]]*100+x[[3]]; }'`
|
||||||
|
@ -779,6 +782,22 @@ AC_SUBST([enable_grub_mkfont])
|
||||||
AC_SUBST([freetype_cflags])
|
AC_SUBST([freetype_cflags])
|
||||||
AC_SUBST([freetype_libs])
|
AC_SUBST([freetype_libs])
|
||||||
|
|
||||||
|
AC_ARG_ENABLE([device-mapper],
|
||||||
|
[AS_HELP_STRING([--enable-device-mapper],
|
||||||
|
[enable Linux device-mapper support (default=guessed)])])
|
||||||
|
if test x"$enable_device_mapper" = xno ; then
|
||||||
|
device_mapper_excuse="explicitly disabled"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test x"$device_mapper_excuse" = x ; then
|
||||||
|
# Check for device-mapper library.
|
||||||
|
AC_CHECK_LIB([devmapper], [dm_task_create],
|
||||||
|
[LDFLAGS="$LDFLAGS -ldevmapper"
|
||||||
|
AC_DEFINE([HAVE_DEVICE_MAPPER], [1],
|
||||||
|
[Define to 1 if you have the devmapper library.])],
|
||||||
|
[device_mapper_excuse="need devmapper library"])
|
||||||
|
fi
|
||||||
|
|
||||||
AC_SUBST(ASFLAGS)
|
AC_SUBST(ASFLAGS)
|
||||||
|
|
||||||
# Output files.
|
# Output files.
|
||||||
|
|
|
@ -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->flags = GRUB_BIOSDISK_FLAG_LBA | GRUB_BIOSDISK_FLAG_CDROM;
|
||||||
data->sectors = 32;
|
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)
|
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
|
/* XXX: There is no property to read the number of blocks. There
|
||||||
should be a property `#blocks', but it is not there. Perhaps it
|
should be a property `#blocks', but it is not there. Perhaps it
|
||||||
is possible to use seek for this. */
|
is possible to use seek for this. */
|
||||||
disk->total_sectors = 0xFFFFFFFFUL;
|
disk->total_sectors = GRUB_DISK_SIZE_UNKNOWN;
|
||||||
|
|
||||||
disk->id = (unsigned long) op;
|
disk->id = (unsigned long) op;
|
||||||
|
|
||||||
|
|
|
@ -25,7 +25,7 @@
|
||||||
#include <grub/lvm.h>
|
#include <grub/lvm.h>
|
||||||
|
|
||||||
#ifdef GRUB_UTIL
|
#ifdef GRUB_UTIL
|
||||||
#include <grub/util/misc.h>
|
#include <grub/emu/misc.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static struct grub_lvm_vg *vg_list;
|
static struct grub_lvm_vg *vg_list;
|
||||||
|
|
214
disk/scsi.c
214
disk/scsi.c
|
@ -25,6 +25,7 @@
|
||||||
#include <grub/types.h>
|
#include <grub/types.h>
|
||||||
#include <grub/scsi.h>
|
#include <grub/scsi.h>
|
||||||
#include <grub/scsicmd.h>
|
#include <grub/scsicmd.h>
|
||||||
|
#include <grub/time.h>
|
||||||
|
|
||||||
|
|
||||||
static grub_scsi_dev_t grub_scsi_dev_list;
|
static grub_scsi_dev_t grub_scsi_dev_list;
|
||||||
|
@ -50,7 +51,62 @@ grub_scsi_dev_unregister (grub_scsi_dev_t dev)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Determine the the device is removable and the type of the device
|
/* Check result of previous operation. */
|
||||||
|
static grub_err_t
|
||||||
|
grub_scsi_request_sense (grub_scsi_t scsi)
|
||||||
|
{
|
||||||
|
struct grub_scsi_request_sense rs;
|
||||||
|
struct grub_scsi_request_sense_data rsd;
|
||||||
|
grub_err_t err;
|
||||||
|
|
||||||
|
rs.opcode = grub_scsi_cmd_request_sense;
|
||||||
|
rs.lun = scsi->lun << GRUB_SCSI_LUN_SHIFT;
|
||||||
|
rs.reserved1 = 0;
|
||||||
|
rs.reserved2 = 0;
|
||||||
|
rs.alloc_length = 0x12; /* XXX: Hardcoded for now */
|
||||||
|
rs.control = 0;
|
||||||
|
grub_memset (rs.pad, 0, sizeof(rs.pad));
|
||||||
|
|
||||||
|
err = scsi->dev->read (scsi, sizeof (rs), (char *) &rs,
|
||||||
|
sizeof (rsd), (char *) &rsd);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
/* Self commenting... */
|
||||||
|
static grub_err_t
|
||||||
|
grub_scsi_test_unit_ready (grub_scsi_t scsi)
|
||||||
|
{
|
||||||
|
struct grub_scsi_test_unit_ready tur;
|
||||||
|
grub_err_t err;
|
||||||
|
grub_err_t err_sense;
|
||||||
|
|
||||||
|
tur.opcode = grub_scsi_cmd_test_unit_ready;
|
||||||
|
tur.lun = scsi->lun << GRUB_SCSI_LUN_SHIFT;
|
||||||
|
tur.reserved1 = 0;
|
||||||
|
tur.reserved2 = 0;
|
||||||
|
tur.reserved3 = 0;
|
||||||
|
tur.control = 0;
|
||||||
|
grub_memset (tur.pad, 0, sizeof(tur.pad));
|
||||||
|
|
||||||
|
err = scsi->dev->read (scsi, sizeof (tur), (char *) &tur,
|
||||||
|
0, NULL);
|
||||||
|
|
||||||
|
/* Each SCSI command should be followed by Request Sense.
|
||||||
|
If not so, many devices STALLs or definitely freezes. */
|
||||||
|
err_sense = grub_scsi_request_sense (scsi);
|
||||||
|
if (err_sense != GRUB_ERR_NONE)
|
||||||
|
grub_errno = err;
|
||||||
|
/* err_sense is ignored for now and Request Sense Data also... */
|
||||||
|
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Determine if the device is removable and the type of the device
|
||||||
SCSI. */
|
SCSI. */
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_scsi_inquiry (grub_scsi_t scsi)
|
grub_scsi_inquiry (grub_scsi_t scsi)
|
||||||
|
@ -58,15 +114,26 @@ grub_scsi_inquiry (grub_scsi_t scsi)
|
||||||
struct grub_scsi_inquiry iq;
|
struct grub_scsi_inquiry iq;
|
||||||
struct grub_scsi_inquiry_data iqd;
|
struct grub_scsi_inquiry_data iqd;
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
|
grub_err_t err_sense;
|
||||||
|
|
||||||
iq.opcode = grub_scsi_cmd_inquiry;
|
iq.opcode = grub_scsi_cmd_inquiry;
|
||||||
iq.lun = scsi->lun << GRUB_SCSI_LUN_SHIFT;
|
iq.lun = scsi->lun << GRUB_SCSI_LUN_SHIFT;
|
||||||
|
iq.page = 0;
|
||||||
iq.reserved = 0;
|
iq.reserved = 0;
|
||||||
iq.alloc_length = 0x24; /* XXX: Hardcoded for now */
|
iq.alloc_length = 0x24; /* XXX: Hardcoded for now */
|
||||||
iq.reserved2 = 0;
|
iq.control = 0;
|
||||||
|
grub_memset (iq.pad, 0, sizeof(iq.pad));
|
||||||
|
|
||||||
err = scsi->dev->read (scsi, sizeof (iq), (char *) &iq,
|
err = scsi->dev->read (scsi, sizeof (iq), (char *) &iq,
|
||||||
sizeof (iqd), (char *) &iqd);
|
sizeof (iqd), (char *) &iqd);
|
||||||
|
|
||||||
|
/* Each SCSI command should be followed by Request Sense.
|
||||||
|
If not so, many devices STALLs or definitely freezes. */
|
||||||
|
err_sense = grub_scsi_request_sense (scsi);
|
||||||
|
if (err_sense != GRUB_ERR_NONE)
|
||||||
|
grub_errno = err;
|
||||||
|
/* err_sense is ignored for now and Request Sense Data also... */
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
@ -83,13 +150,27 @@ grub_scsi_read_capacity (grub_scsi_t scsi)
|
||||||
struct grub_scsi_read_capacity rc;
|
struct grub_scsi_read_capacity rc;
|
||||||
struct grub_scsi_read_capacity_data rcd;
|
struct grub_scsi_read_capacity_data rcd;
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
|
grub_err_t err_sense;
|
||||||
|
|
||||||
rc.opcode = grub_scsi_cmd_read_capacity;
|
rc.opcode = grub_scsi_cmd_read_capacity;
|
||||||
rc.lun = scsi->lun << GRUB_SCSI_LUN_SHIFT;
|
rc.lun = scsi->lun << GRUB_SCSI_LUN_SHIFT;
|
||||||
grub_memset (rc.reserved, 0, sizeof (rc.reserved));
|
rc.logical_block_addr = 0;
|
||||||
|
rc.reserved1 = 0;
|
||||||
|
rc.reserved2 = 0;
|
||||||
|
rc.PMI = 0;
|
||||||
|
rc.control = 0;
|
||||||
|
rc.pad = 0;
|
||||||
|
|
||||||
err = scsi->dev->read (scsi, sizeof (rc), (char *) &rc,
|
err = scsi->dev->read (scsi, sizeof (rc), (char *) &rc,
|
||||||
sizeof (rcd), (char *) &rcd);
|
sizeof (rcd), (char *) &rcd);
|
||||||
|
|
||||||
|
/* Each SCSI command should be followed by Request Sense.
|
||||||
|
If not so, many devices STALLs or definitely freezes. */
|
||||||
|
err_sense = grub_scsi_request_sense (scsi);
|
||||||
|
if (err_sense != GRUB_ERR_NONE)
|
||||||
|
grub_errno = err;
|
||||||
|
/* err_sense is ignored for now and Request Sense Data also... */
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
|
@ -107,6 +188,8 @@ grub_scsi_read10 (grub_disk_t disk, grub_disk_addr_t sector,
|
||||||
{
|
{
|
||||||
grub_scsi_t scsi;
|
grub_scsi_t scsi;
|
||||||
struct grub_scsi_read10 rd;
|
struct grub_scsi_read10 rd;
|
||||||
|
grub_err_t err;
|
||||||
|
grub_err_t err_sense;
|
||||||
|
|
||||||
scsi = disk->data;
|
scsi = disk->data;
|
||||||
|
|
||||||
|
@ -118,7 +201,16 @@ grub_scsi_read10 (grub_disk_t disk, grub_disk_addr_t sector,
|
||||||
rd.reserved2 = 0;
|
rd.reserved2 = 0;
|
||||||
rd.pad = 0;
|
rd.pad = 0;
|
||||||
|
|
||||||
return scsi->dev->read (scsi, sizeof (rd), (char *) &rd, size * scsi->blocksize, buf);
|
err = scsi->dev->read (scsi, sizeof (rd), (char *) &rd, size * scsi->blocksize, buf);
|
||||||
|
|
||||||
|
/* Each SCSI command should be followed by Request Sense.
|
||||||
|
If not so, many devices STALLs or definitely freezes. */
|
||||||
|
err_sense = grub_scsi_request_sense (scsi);
|
||||||
|
if (err_sense != GRUB_ERR_NONE)
|
||||||
|
grub_errno = err;
|
||||||
|
/* err_sense is ignored for now and Request Sense Data also... */
|
||||||
|
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send a SCSI request for DISK: read SIZE sectors starting with
|
/* Send a SCSI request for DISK: read SIZE sectors starting with
|
||||||
|
@ -129,6 +221,8 @@ grub_scsi_read12 (grub_disk_t disk, grub_disk_addr_t sector,
|
||||||
{
|
{
|
||||||
grub_scsi_t scsi;
|
grub_scsi_t scsi;
|
||||||
struct grub_scsi_read12 rd;
|
struct grub_scsi_read12 rd;
|
||||||
|
grub_err_t err;
|
||||||
|
grub_err_t err_sense;
|
||||||
|
|
||||||
scsi = disk->data;
|
scsi = disk->data;
|
||||||
|
|
||||||
|
@ -139,7 +233,16 @@ grub_scsi_read12 (grub_disk_t disk, grub_disk_addr_t sector,
|
||||||
rd.reserved = 0;
|
rd.reserved = 0;
|
||||||
rd.control = 0;
|
rd.control = 0;
|
||||||
|
|
||||||
return scsi->dev->read (scsi, sizeof (rd), (char *) &rd, size * scsi->blocksize, buf);
|
err = scsi->dev->read (scsi, sizeof (rd), (char *) &rd, size * scsi->blocksize, buf);
|
||||||
|
|
||||||
|
/* Each SCSI command should be followed by Request Sense.
|
||||||
|
If not so, many devices STALLs or definitely freezes. */
|
||||||
|
err_sense = grub_scsi_request_sense (scsi);
|
||||||
|
if (err_sense != GRUB_ERR_NONE)
|
||||||
|
grub_errno = err;
|
||||||
|
/* err_sense is ignored for now and Request Sense Data also... */
|
||||||
|
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
|
@ -151,6 +254,8 @@ grub_scsi_write10 (grub_disk_t disk, grub_disk_addr_t sector,
|
||||||
{
|
{
|
||||||
grub_scsi_t scsi;
|
grub_scsi_t scsi;
|
||||||
struct grub_scsi_write10 wr;
|
struct grub_scsi_write10 wr;
|
||||||
|
grub_err_t err;
|
||||||
|
grub_err_t err_sense;
|
||||||
|
|
||||||
scsi = disk->data;
|
scsi = disk->data;
|
||||||
|
|
||||||
|
@ -162,7 +267,16 @@ grub_scsi_write10 (grub_disk_t disk, grub_disk_addr_t sector,
|
||||||
wr.reserved2 = 0;
|
wr.reserved2 = 0;
|
||||||
wr.pad = 0;
|
wr.pad = 0;
|
||||||
|
|
||||||
return scsi->dev->write (scsi, sizeof (wr), (char *) &wr, size * scsi->blocksize, buf);
|
err = scsi->dev->write (scsi, sizeof (wr), (char *) &wr, size * scsi->blocksize, buf);
|
||||||
|
|
||||||
|
/* Each SCSI command should be followed by Request Sense.
|
||||||
|
If not so, many devices STALLs or definitely freezes. */
|
||||||
|
err_sense = grub_scsi_request_sense (scsi);
|
||||||
|
if (err_sense != GRUB_ERR_NONE)
|
||||||
|
grub_errno = err;
|
||||||
|
/* err_sense is ignored for now and Request Sense Data also... */
|
||||||
|
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Send a SCSI request for DISK: write the data stored in BUF to SIZE
|
/* Send a SCSI request for DISK: write the data stored in BUF to SIZE
|
||||||
|
@ -172,7 +286,9 @@ grub_scsi_write12 (grub_disk_t disk, grub_disk_addr_t sector,
|
||||||
grub_size_t size, char *buf)
|
grub_size_t size, char *buf)
|
||||||
{
|
{
|
||||||
grub_scsi_t scsi;
|
grub_scsi_t scsi;
|
||||||
struct grub_scsi_write10 wr;
|
struct grub_scsi_write12 wr;
|
||||||
|
grub_err_t err;
|
||||||
|
grub_err_t err_sense;
|
||||||
|
|
||||||
scsi = disk->data;
|
scsi = disk->data;
|
||||||
|
|
||||||
|
@ -181,9 +297,18 @@ grub_scsi_write12 (grub_disk_t disk, grub_disk_addr_t sector,
|
||||||
wr.lba = grub_cpu_to_be32 (sector);
|
wr.lba = grub_cpu_to_be32 (sector);
|
||||||
wr.size = grub_cpu_to_be32 (size);
|
wr.size = grub_cpu_to_be32 (size);
|
||||||
wr.reserved = 0;
|
wr.reserved = 0;
|
||||||
wr.pad = 0;
|
wr.control = 0;
|
||||||
|
|
||||||
return scsi->dev->write (scsi, sizeof (wr), (char *) &wr, size * scsi->blocksize, buf);
|
err = scsi->dev->write (scsi, sizeof (wr), (char *) &wr, size * scsi->blocksize, buf);
|
||||||
|
|
||||||
|
/* Each SCSI command should be followed by Request Sense.
|
||||||
|
If not so, many devices STALLs or definitely freezes. */
|
||||||
|
err_sense = grub_scsi_request_sense (scsi);
|
||||||
|
if (err_sense != GRUB_ERR_NONE)
|
||||||
|
grub_errno = err;
|
||||||
|
/* err_sense is ignored for now and Request Sense Data also... */
|
||||||
|
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -235,6 +360,7 @@ grub_scsi_open (const char *name, grub_disk_t disk)
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
int len;
|
int len;
|
||||||
int lun;
|
int lun;
|
||||||
|
grub_uint64_t maxtime;
|
||||||
|
|
||||||
scsi = grub_malloc (sizeof (*scsi));
|
scsi = grub_malloc (sizeof (*scsi));
|
||||||
if (! scsi)
|
if (! scsi)
|
||||||
|
@ -292,6 +418,31 @@ grub_scsi_open (const char *name, grub_disk_t disk)
|
||||||
else
|
else
|
||||||
disk->has_partitions = 1;
|
disk->has_partitions = 1;
|
||||||
|
|
||||||
|
|
||||||
|
/* According to USB MS tests specification, issue Test Unit Ready
|
||||||
|
* until OK */
|
||||||
|
maxtime = grub_get_time_ms () + 5000; /* It is safer value */
|
||||||
|
do
|
||||||
|
{
|
||||||
|
/* Timeout is necessary - for example in case when we have
|
||||||
|
* universal card reader with more LUNs and we have only
|
||||||
|
* one card inserted (or none), so only one LUN (or none)
|
||||||
|
* will be ready - and we want not to hang... */
|
||||||
|
if (grub_get_time_ms () > maxtime)
|
||||||
|
{
|
||||||
|
err = GRUB_ERR_READ_ERROR;
|
||||||
|
grub_free (scsi);
|
||||||
|
grub_dprintf ("scsi", "LUN is not ready - timeout\n");
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
err = grub_scsi_test_unit_ready (scsi);
|
||||||
|
}
|
||||||
|
while (err == GRUB_ERR_READ_ERROR);
|
||||||
|
/* Reset grub_errno !
|
||||||
|
* It is set to some error code in loop before... */
|
||||||
|
grub_errno = GRUB_ERR_NONE;
|
||||||
|
|
||||||
|
/* Read capacity of media */
|
||||||
err = grub_scsi_read_capacity (scsi);
|
err = grub_scsi_read_capacity (scsi);
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
|
@ -302,12 +453,14 @@ grub_scsi_open (const char *name, grub_disk_t disk)
|
||||||
|
|
||||||
/* SCSI blocks can be something else than 512, although GRUB
|
/* SCSI blocks can be something else than 512, although GRUB
|
||||||
wants 512 byte blocks. */
|
wants 512 byte blocks. */
|
||||||
disk->total_sectors = ((scsi->size * scsi->blocksize)
|
disk->total_sectors = ((grub_uint64_t)scsi->size
|
||||||
<< GRUB_DISK_SECTOR_BITS);
|
* (grub_uint64_t)scsi->blocksize)
|
||||||
|
>> GRUB_DISK_SECTOR_BITS;
|
||||||
|
|
||||||
grub_dprintf ("scsi", "capacity=%llu, blksize=%d\n",
|
grub_dprintf ("scsi", "blocks=%u, blocksize=%u\n",
|
||||||
(unsigned long long) disk->total_sectors,
|
scsi->size, scsi->blocksize);
|
||||||
scsi->blocksize);
|
grub_dprintf ("scsi", "Disk total 512 sectors = %llu\n",
|
||||||
|
(unsigned long long) disk->total_sectors);
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
@ -366,6 +519,37 @@ grub_scsi_read (grub_disk_t disk, grub_disk_addr_t sector,
|
||||||
|
|
||||||
/* XXX: Never reached. */
|
/* XXX: Never reached. */
|
||||||
return GRUB_ERR_NONE;
|
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
|
static grub_err_t
|
||||||
|
|
190
disk/usbms.c
190
disk/usbms.c
|
@ -84,7 +84,8 @@ grub_usbms_finddevs (void)
|
||||||
struct grub_usb_desc_device *descdev = &usbdev->descdev;
|
struct grub_usb_desc_device *descdev = &usbdev->descdev;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (descdev->class != 0 || descdev->subclass || descdev->protocol != 0)
|
if (descdev->class != 0 || descdev->subclass || descdev->protocol != 0
|
||||||
|
|| descdev->configcnt == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* XXX: Just check configuration 0 for now. */
|
/* XXX: Just check configuration 0 for now. */
|
||||||
|
@ -93,19 +94,31 @@ grub_usbms_finddevs (void)
|
||||||
struct grub_usbms_dev *usbms;
|
struct grub_usbms_dev *usbms;
|
||||||
struct grub_usb_desc_if *interf;
|
struct grub_usb_desc_if *interf;
|
||||||
int j;
|
int j;
|
||||||
grub_uint8_t luns;
|
grub_uint8_t luns = 0;
|
||||||
|
|
||||||
|
grub_dprintf ("usbms", "alive\n");
|
||||||
|
|
||||||
interf = usbdev->config[0].interf[i].descif;
|
interf = usbdev->config[0].interf[i].descif;
|
||||||
|
|
||||||
/* If this is not a USB Mass Storage device with a supported
|
/* If this is not a USB Mass Storage device with a supported
|
||||||
protocol, just skip it. */
|
protocol, just skip it. */
|
||||||
|
grub_dprintf ("usbms", "iterate: interf=%d, class=%d, subclass=%d, protocol=%d\n",
|
||||||
|
i, interf->class, interf->subclass, interf->protocol);
|
||||||
|
|
||||||
if (interf->class != GRUB_USB_CLASS_MASS_STORAGE
|
if (interf->class != GRUB_USB_CLASS_MASS_STORAGE
|
||||||
|| interf->subclass != GRUB_USBMS_SUBCLASS_BULK
|
|| ( interf->subclass != GRUB_USBMS_SUBCLASS_BULK &&
|
||||||
|
/* Experimental support of RBC, MMC-2, UFI, SFF-8070i devices */
|
||||||
|
interf->subclass != GRUB_USBMS_SUBCLASS_RBC &&
|
||||||
|
interf->subclass != GRUB_USBMS_SUBCLASS_MMC2 &&
|
||||||
|
interf->subclass != GRUB_USBMS_SUBCLASS_UFI &&
|
||||||
|
interf->subclass != GRUB_USBMS_SUBCLASS_SFF8070 )
|
||||||
|| interf->protocol != GRUB_USBMS_PROTOCOL_BULK)
|
|| interf->protocol != GRUB_USBMS_PROTOCOL_BULK)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
grub_dprintf ("usbms", "alive\n");
|
||||||
|
|
||||||
devcnt++;
|
devcnt++;
|
||||||
usbms = grub_zalloc (sizeof (struct grub_usbms_dev));
|
usbms = grub_zalloc (sizeof (struct grub_usbms_dev));
|
||||||
if (! usbms)
|
if (! usbms)
|
||||||
|
@ -114,6 +127,8 @@ grub_usbms_finddevs (void)
|
||||||
usbms->dev = usbdev;
|
usbms->dev = usbdev;
|
||||||
usbms->interface = i;
|
usbms->interface = i;
|
||||||
|
|
||||||
|
grub_dprintf ("usbms", "alive\n");
|
||||||
|
|
||||||
/* Iterate over all endpoints of this interface, at least a
|
/* Iterate over all endpoints of this interface, at least a
|
||||||
IN and OUT bulk endpoint are required. */
|
IN and OUT bulk endpoint are required. */
|
||||||
for (j = 0; j < interf->endpointcnt; j++)
|
for (j = 0; j < interf->endpointcnt; j++)
|
||||||
|
@ -125,14 +140,16 @@ grub_usbms_finddevs (void)
|
||||||
{
|
{
|
||||||
/* Bulk IN endpoint. */
|
/* Bulk IN endpoint. */
|
||||||
usbms->in = endp;
|
usbms->in = endp;
|
||||||
grub_usb_clear_halt (usbdev, endp->endp_addr & 128);
|
/* Clear Halt is not possible yet! */
|
||||||
|
/* grub_usb_clear_halt (usbdev, endp->endp_addr); */
|
||||||
usbms->in_maxsz = endp->maxpacket;
|
usbms->in_maxsz = endp->maxpacket;
|
||||||
}
|
}
|
||||||
else if (!(endp->endp_addr & 128) && (endp->attrib & 3) == 2)
|
else if (!(endp->endp_addr & 128) && (endp->attrib & 3) == 2)
|
||||||
{
|
{
|
||||||
/* Bulk OUT endpoint. */
|
/* Bulk OUT endpoint. */
|
||||||
usbms->out = endp;
|
usbms->out = endp;
|
||||||
grub_usb_clear_halt (usbdev, endp->endp_addr & 128);
|
/* Clear Halt is not possible yet! */
|
||||||
|
/* grub_usb_clear_halt (usbdev, endp->endp_addr); */
|
||||||
usbms->out_maxsz = endp->maxpacket;
|
usbms->out_maxsz = endp->maxpacket;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -143,51 +160,63 @@ grub_usbms_finddevs (void)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
grub_dprintf ("usbms", "alive\n");
|
||||||
|
|
||||||
|
/* XXX: Activate the first configuration. */
|
||||||
|
grub_usb_set_configuration (usbdev, 1);
|
||||||
|
|
||||||
/* Query the amount of LUNs. */
|
/* Query the amount of LUNs. */
|
||||||
err = grub_usb_control_msg (usbdev, 0xA1, 254,
|
err = grub_usb_control_msg (usbdev, 0xA1, 254,
|
||||||
0, i, 1, (char *) &luns);
|
0, i, 1, (char *) &luns);
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
/* In case of a stall, clear the stall. */
|
/* In case of a stall, clear the stall. */
|
||||||
if (err == GRUB_USB_ERR_STALL)
|
if (err == GRUB_USB_ERR_STALL)
|
||||||
{
|
{
|
||||||
grub_usb_clear_halt (usbdev, usbms->in->endp_addr & 3);
|
grub_usb_clear_halt (usbdev, usbms->in->endp_addr);
|
||||||
grub_usb_clear_halt (usbdev, usbms->out->endp_addr & 3);
|
grub_usb_clear_halt (usbdev, usbms->out->endp_addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Just set the amount of LUNs to one. */
|
/* Just set the amount of LUNs to one. */
|
||||||
grub_errno = GRUB_ERR_NONE;
|
grub_errno = GRUB_ERR_NONE;
|
||||||
usbms->luns = 1;
|
usbms->luns = 1;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
usbms->luns = luns;
|
/* luns = 0 means one LUN with ID 0 present ! */
|
||||||
|
/* We get from device not number of LUNs but highest
|
||||||
|
* LUN number. LUNs are numbered from 0,
|
||||||
|
* i.e. number of LUNs is luns+1 ! */
|
||||||
|
usbms->luns = luns + 1;
|
||||||
|
|
||||||
/* XXX: Check the magic values, does this really make
|
grub_dprintf ("usbms", "alive\n");
|
||||||
sense? */
|
|
||||||
grub_usb_control_msg (usbdev, (1 << 6) | 1, 255,
|
|
||||||
0, i, 0, 0);
|
|
||||||
|
|
||||||
/* XXX: To make Qemu work? */
|
|
||||||
if (usbms->luns == 0)
|
|
||||||
usbms->luns = 1;
|
|
||||||
|
|
||||||
usbms->next = grub_usbms_dev_list;
|
usbms->next = grub_usbms_dev_list;
|
||||||
grub_usbms_dev_list = usbms;
|
grub_usbms_dev_list = usbms;
|
||||||
|
|
||||||
/* XXX: Activate the first configuration. */
|
#if 0 /* All this part should be probably deleted.
|
||||||
grub_usb_set_configuration (usbdev, 1);
|
* This make trouble on some devices if they are not in
|
||||||
|
* Phase Error state - and there they should be not in such state...
|
||||||
|
* Bulk only mass storage reset procedure should be used only
|
||||||
|
* on place and in time when it is really necessary. */
|
||||||
|
/* Reset recovery procedure */
|
||||||
/* Bulk-Only Mass Storage Reset, after the reset commands
|
/* Bulk-Only Mass Storage Reset, after the reset commands
|
||||||
will be accepted. */
|
will be accepted. */
|
||||||
grub_usbms_reset (usbdev, i);
|
grub_usbms_reset (usbdev, i);
|
||||||
|
grub_usb_clear_halt (usbdev, usbms->in->endp_addr);
|
||||||
|
grub_usb_clear_halt (usbdev, usbms->out->endp_addr);
|
||||||
|
#endif
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
grub_dprintf ("usbms", "alive\n");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
grub_dprintf ("usbms", "alive\n");
|
||||||
|
|
||||||
grub_usb_iterate (usb_iterate);
|
grub_usb_iterate (usb_iterate);
|
||||||
|
grub_dprintf ("usbms", "alive\n");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -224,7 +253,9 @@ grub_usbms_transfer (struct grub_scsi *scsi, grub_size_t cmdsize, char *cmd,
|
||||||
struct grub_usbms_csw status;
|
struct grub_usbms_csw status;
|
||||||
static grub_uint32_t tag = 0;
|
static grub_uint32_t tag = 0;
|
||||||
grub_usb_err_t err = GRUB_USB_ERR_NONE;
|
grub_usb_err_t err = GRUB_USB_ERR_NONE;
|
||||||
|
grub_usb_err_t errCSW = GRUB_USB_ERR_NONE;
|
||||||
int retrycnt = 3 + 1;
|
int retrycnt = 3 + 1;
|
||||||
|
grub_size_t i;
|
||||||
|
|
||||||
retry:
|
retry:
|
||||||
retrycnt--;
|
retrycnt--;
|
||||||
|
@ -237,73 +268,102 @@ grub_usbms_transfer (struct grub_scsi *scsi, grub_size_t cmdsize, char *cmd,
|
||||||
cbw.tag = tag++;
|
cbw.tag = tag++;
|
||||||
cbw.transfer_length = grub_cpu_to_le32 (size);
|
cbw.transfer_length = grub_cpu_to_le32 (size);
|
||||||
cbw.flags = (!read_write) << GRUB_USBMS_DIRECTION_BIT;
|
cbw.flags = (!read_write) << GRUB_USBMS_DIRECTION_BIT;
|
||||||
cbw.lun = scsi->lun << GRUB_SCSI_LUN_SHIFT;
|
cbw.lun = scsi->lun; /* In USB MS CBW are LUN bits on another place than in SCSI CDB, both should be set correctly. */
|
||||||
cbw.length = cmdsize;
|
cbw.length = cmdsize;
|
||||||
grub_memcpy (cbw.cbwcb, cmd, cmdsize);
|
grub_memcpy (cbw.cbwcb, cmd, cmdsize);
|
||||||
|
|
||||||
|
/* Debug print of CBW content. */
|
||||||
|
grub_dprintf ("usb", "CBW: sign=0x%08x tag=0x%08x len=0x%08x\n",
|
||||||
|
cbw.signature, cbw.tag, cbw.transfer_length);
|
||||||
|
grub_dprintf ("usb", "CBW: flags=0x%02x lun=0x%02x CB_len=0x%02x\n",
|
||||||
|
cbw.flags, cbw.lun, cbw.length);
|
||||||
|
grub_dprintf ("usb", "CBW: cmd:\n %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x %02x\n",
|
||||||
|
cbw.cbwcb[ 0], cbw.cbwcb[ 1], cbw.cbwcb[ 2], cbw.cbwcb[ 3],
|
||||||
|
cbw.cbwcb[ 4], cbw.cbwcb[ 5], cbw.cbwcb[ 6], cbw.cbwcb[ 7],
|
||||||
|
cbw.cbwcb[ 8], cbw.cbwcb[ 9], cbw.cbwcb[10], cbw.cbwcb[11],
|
||||||
|
cbw.cbwcb[12], cbw.cbwcb[13], cbw.cbwcb[14], cbw.cbwcb[15]);
|
||||||
|
|
||||||
/* Write the request. */
|
/* Write the request.
|
||||||
err = grub_usb_bulk_write (dev->dev, dev->out->endp_addr & 15,
|
* XXX: Error recovery is maybe still not fully correct. */
|
||||||
|
err = grub_usb_bulk_write (dev->dev, dev->out->endp_addr,
|
||||||
sizeof (cbw), (char *) &cbw);
|
sizeof (cbw), (char *) &cbw);
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
if (err == GRUB_USB_ERR_STALL)
|
if (err == GRUB_USB_ERR_STALL)
|
||||||
{
|
{
|
||||||
grub_usb_clear_halt (dev->dev, dev->out->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");
|
return grub_error (GRUB_ERR_IO, "USB Mass Storage request failed");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read/write the data. */
|
/* Read/write the data, (maybe) according to specification. */
|
||||||
if (read_write == 0)
|
if (size && (read_write == 0))
|
||||||
{
|
{
|
||||||
err = grub_usb_bulk_read (dev->dev, dev->in->endp_addr & 15, size, buf);
|
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);
|
grub_dprintf ("usb", "read: %d %d\n", err, GRUB_USB_ERR_STALL);
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
if (err == GRUB_USB_ERR_STALL)
|
if (err == GRUB_USB_ERR_STALL)
|
||||||
{
|
grub_usb_clear_halt (dev->dev, dev->in->endp_addr);
|
||||||
grub_usb_clear_halt (dev->dev, dev->in->endp_addr);
|
goto CheckCSW;
|
||||||
goto retry;
|
}
|
||||||
}
|
/* Debug print of received data. */
|
||||||
return grub_error (GRUB_ERR_READ_ERROR,
|
grub_dprintf ("usb", "buf:\n");
|
||||||
"can't read from USB Mass Storage device");
|
if (size <= 64)
|
||||||
}
|
for (i=0; i<size; i++)
|
||||||
|
grub_dprintf ("usb", "0x%02x: 0x%02x\n", i, buf[i]);
|
||||||
|
else
|
||||||
|
grub_dprintf ("usb", "Too much data for debug print...\n");
|
||||||
}
|
}
|
||||||
else
|
else if (size)
|
||||||
{
|
{
|
||||||
err = grub_usb_bulk_write (dev->dev, dev->in->endp_addr & 15, size, buf);
|
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", "write: %d %d\n", err, GRUB_USB_ERR_STALL);
|
||||||
|
grub_dprintf ("usb", "buf:\n");
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
if (err == GRUB_USB_ERR_STALL)
|
if (err == GRUB_USB_ERR_STALL)
|
||||||
{
|
grub_usb_clear_halt (dev->dev, dev->out->endp_addr);
|
||||||
grub_usb_clear_halt (dev->dev, dev->out->endp_addr);
|
goto CheckCSW;
|
||||||
goto retry;
|
}
|
||||||
}
|
/* Debug print of sent data. */
|
||||||
return grub_error (GRUB_ERR_WRITE_ERROR,
|
if (size <= 256)
|
||||||
"can't write to USB Mass Storage device");
|
for (i=0; i<size; i++)
|
||||||
}
|
grub_dprintf ("usb", "0x%02x: 0x%02x\n", i, buf[i]);
|
||||||
|
else
|
||||||
|
grub_dprintf ("usb", "Too much data for debug print...\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Read the status. */
|
/* Read the status - (maybe) according to specification. */
|
||||||
err = grub_usb_bulk_read (dev->dev, dev->in->endp_addr & 15,
|
CheckCSW:
|
||||||
sizeof (status), (char *) &status);
|
errCSW = grub_usb_bulk_read (dev->dev, dev->in->endp_addr,
|
||||||
if (err)
|
sizeof (status), (char *) &status);
|
||||||
|
if (errCSW)
|
||||||
{
|
{
|
||||||
if (err == GRUB_USB_ERR_STALL)
|
grub_usb_clear_halt (dev->dev, dev->in->endp_addr);
|
||||||
{
|
errCSW = grub_usb_bulk_read (dev->dev, dev->in->endp_addr,
|
||||||
grub_usb_clear_halt (dev->dev, dev->in->endp_addr);
|
sizeof (status), (char *) &status);
|
||||||
|
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);
|
||||||
goto retry;
|
goto retry;
|
||||||
}
|
}
|
||||||
return grub_error (GRUB_ERR_READ_ERROR,
|
|
||||||
"can't read status from USB Mass Storage device");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* XXX: Magic and check this code. */
|
/* Debug print of CSW content. */
|
||||||
if (status.status == 2)
|
grub_dprintf ("usb", "CSW: sign=0x%08x tag=0x%08x resid=0x%08x\n",
|
||||||
{
|
status.signature, status.tag, status.residue);
|
||||||
/* XXX: Phase error, reset device. */
|
grub_dprintf ("usb", "CSW: status=0x%02x\n", status.status);
|
||||||
|
|
||||||
|
/* 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_usbms_reset (dev->dev, dev->interface);
|
||||||
grub_usb_clear_halt (dev->dev, dev->in->endp_addr);
|
grub_usb_clear_halt (dev->dev, dev->in->endp_addr);
|
||||||
grub_usb_clear_halt (dev->dev, dev->out->endp_addr);
|
grub_usb_clear_halt (dev->dev, dev->out->endp_addr);
|
||||||
|
@ -311,9 +371,13 @@ grub_usbms_transfer (struct grub_scsi *scsi, grub_size_t cmdsize, char *cmd,
|
||||||
goto retry;
|
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,
|
return grub_error (GRUB_ERR_READ_ERROR,
|
||||||
"error communication with USB Mass Storage device");
|
"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;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
980
docs/grub.texi
980
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-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;
|
return err;
|
||||||
if (*ptr == ':')
|
if (*ptr == ':')
|
||||||
{
|
{
|
||||||
err = parse_ip (ptr + 1, &(data->server_ip), 0);
|
err = parse_ip (ptr + 1, &(data->gateway_ip), 0);
|
||||||
if (err)
|
if (err)
|
||||||
return 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_NODE_MIN (NILFS_BTREE_LEVEL_DATA + 1)
|
||||||
#define NILFS_BTREE_LEVEL_MAX 14
|
#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
|
struct grub_nilfs2_inode
|
||||||
{
|
{
|
||||||
grub_uint64_t i_blocks;
|
grub_uint64_t i_blocks;
|
||||||
|
@ -703,6 +710,52 @@ grub_nilfs2_valid_sb (struct grub_nilfs2_super_block *sbp)
|
||||||
return 1;
|
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 *
|
static struct grub_nilfs2_data *
|
||||||
grub_nilfs2_mount (grub_disk_t disk)
|
grub_nilfs2_mount (grub_disk_t disk)
|
||||||
{
|
{
|
||||||
|
@ -717,19 +770,13 @@ grub_nilfs2_mount (grub_disk_t disk)
|
||||||
if (!data)
|
if (!data)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
data->disk = disk;
|
||||||
|
|
||||||
/* Read the superblock. */
|
/* Read the superblock. */
|
||||||
grub_disk_read (disk, 1 * 2, 0, sizeof (struct grub_nilfs2_super_block),
|
grub_nilfs2_load_sb (data);
|
||||||
&data->sblock);
|
|
||||||
if (grub_errno)
|
if (grub_errno)
|
||||||
goto fail;
|
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));
|
nilfs2_block_count = (1 << LOG2_NILFS2_BLOCK_SIZE (data));
|
||||||
|
|
||||||
/* Read the last segment summary. */
|
/* Read the last segment summary. */
|
||||||
|
@ -748,8 +795,6 @@ grub_nilfs2_mount (grub_disk_t disk)
|
||||||
if (grub_errno)
|
if (grub_errno)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
data->disk = disk;
|
|
||||||
|
|
||||||
grub_nilfs2_read_last_checkpoint (data, &last_checkpoint);
|
grub_nilfs2_read_last_checkpoint (data, &last_checkpoint);
|
||||||
|
|
||||||
if (grub_errno)
|
if (grub_errno)
|
||||||
|
|
|
@ -309,14 +309,10 @@ grub_gettext_init_ext (const char *lang)
|
||||||
static void
|
static void
|
||||||
grub_gettext_delete_list (void)
|
grub_gettext_delete_list (void)
|
||||||
{
|
{
|
||||||
struct grub_gettext_msg *item;
|
while (grub_gettext_msg_list)
|
||||||
|
|
||||||
while ((item =
|
|
||||||
grub_list_pop (GRUB_AS_LIST_P (&grub_gettext_msg_list))) != 0)
|
|
||||||
{
|
{
|
||||||
char *original = (char *) ((struct grub_gettext_msg *) item)->name;
|
grub_free ((char *) grub_gettext_msg_list->name);
|
||||||
grub_free (original);
|
grub_gettext_msg_list = grub_gettext_msg_list->next;
|
||||||
|
|
||||||
/* Don't delete the translated message because could be in use. */
|
/* Don't delete the translated message because could be in use. */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -110,6 +110,13 @@ grub_gfxmenu_try (int entry, grub_menu_t menu, int nested)
|
||||||
view->nested = nested;
|
view->nested = nested;
|
||||||
view->first_timeout = -1;
|
view->first_timeout = -1;
|
||||||
|
|
||||||
|
grub_video_set_viewport (0, 0, mode_info.width, mode_info.height);
|
||||||
|
if (view->double_repaint)
|
||||||
|
{
|
||||||
|
grub_video_swap_buffers ();
|
||||||
|
grub_video_set_viewport (0, 0, mode_info.width, mode_info.height);
|
||||||
|
}
|
||||||
|
|
||||||
grub_gfxmenu_view_draw (view);
|
grub_gfxmenu_view_draw (view);
|
||||||
|
|
||||||
instance->data = view;
|
instance->data = view;
|
||||||
|
|
|
@ -54,6 +54,7 @@ static void
|
||||||
circprog_destroy (void *vself)
|
circprog_destroy (void *vself)
|
||||||
{
|
{
|
||||||
circular_progress_t self = vself;
|
circular_progress_t self = vself;
|
||||||
|
grub_gfxmenu_timeout_unregister ((grub_gui_component_t) self);
|
||||||
grub_free (self);
|
grub_free (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -211,6 +212,17 @@ circprog_get_bounds (void *vself, grub_video_rect_t *bounds)
|
||||||
*bounds = self->bounds;
|
*bounds = self->bounds;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
circprog_set_state (void *vself, int visible, int start,
|
||||||
|
int current, int end)
|
||||||
|
{
|
||||||
|
circular_progress_t self = vself;
|
||||||
|
self->visible = visible;
|
||||||
|
self->start = start;
|
||||||
|
self->value = current;
|
||||||
|
self->end = end;
|
||||||
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
circprog_set_property (void *vself, const char *name, const char *value)
|
circprog_set_property (void *vself, const char *name, const char *value)
|
||||||
{
|
{
|
||||||
|
@ -247,26 +259,20 @@ circprog_set_property (void *vself, const char *name, const char *value)
|
||||||
}
|
}
|
||||||
else if (grub_strcmp (name, "id") == 0)
|
else if (grub_strcmp (name, "id") == 0)
|
||||||
{
|
{
|
||||||
|
grub_gfxmenu_timeout_unregister ((grub_gui_component_t) self);
|
||||||
grub_free (self->id);
|
grub_free (self->id);
|
||||||
if (value)
|
if (value)
|
||||||
self->id = grub_strdup (value);
|
self->id = grub_strdup (value);
|
||||||
else
|
else
|
||||||
self->id = 0;
|
self->id = 0;
|
||||||
|
if (self->id && grub_strcmp (self->id, GRUB_GFXMENU_TIMEOUT_COMPONENT_ID)
|
||||||
|
== 0)
|
||||||
|
grub_gfxmenu_timeout_register ((grub_gui_component_t) self,
|
||||||
|
circprog_set_state);
|
||||||
}
|
}
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
|
||||||
circprog_set_state (void *vself, int visible, int start,
|
|
||||||
int current, int end)
|
|
||||||
{
|
|
||||||
circular_progress_t self = vself;
|
|
||||||
self->visible = visible;
|
|
||||||
self->start = start;
|
|
||||||
self->value = current;
|
|
||||||
self->end = end;
|
|
||||||
}
|
|
||||||
|
|
||||||
static struct grub_gui_component_ops circprog_ops =
|
static struct grub_gui_component_ops circprog_ops =
|
||||||
{
|
{
|
||||||
.destroy = circprog_destroy,
|
.destroy = circprog_destroy,
|
||||||
|
|
|
@ -46,8 +46,10 @@ struct grub_gui_label
|
||||||
char *id;
|
char *id;
|
||||||
int visible;
|
int visible;
|
||||||
char *text;
|
char *text;
|
||||||
|
char *template;
|
||||||
grub_font_t font;
|
grub_font_t font;
|
||||||
grub_gui_color_t color;
|
grub_gui_color_t color;
|
||||||
|
int value;
|
||||||
enum align_mode align;
|
enum align_mode align;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -57,7 +59,9 @@ static void
|
||||||
label_destroy (void *vself)
|
label_destroy (void *vself)
|
||||||
{
|
{
|
||||||
grub_gui_label_t self = vself;
|
grub_gui_label_t self = vself;
|
||||||
|
grub_gfxmenu_timeout_unregister ((grub_gui_component_t) self);
|
||||||
grub_free (self->text);
|
grub_free (self->text);
|
||||||
|
grub_free (self->template);
|
||||||
grub_free (self);
|
grub_free (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,6 +150,17 @@ label_get_minimal_size (void *vself, unsigned *width, unsigned *height)
|
||||||
+ grub_font_get_descent (self->font));
|
+ grub_font_get_descent (self->font));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
label_set_state (void *vself, int visible, int start __attribute__ ((unused)),
|
||||||
|
int current, int end __attribute__ ((unused)))
|
||||||
|
{
|
||||||
|
grub_gui_label_t self = vself;
|
||||||
|
self->value = -current;
|
||||||
|
self->visible = visible;
|
||||||
|
grub_free (self->text);
|
||||||
|
self->text = grub_xasprintf (self->template ? : "%d", self->value);
|
||||||
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
label_set_property (void *vself, const char *name, const char *value)
|
label_set_property (void *vself, const char *name, const char *value)
|
||||||
{
|
{
|
||||||
|
@ -153,9 +168,17 @@ label_set_property (void *vself, const char *name, const char *value)
|
||||||
if (grub_strcmp (name, "text") == 0)
|
if (grub_strcmp (name, "text") == 0)
|
||||||
{
|
{
|
||||||
grub_free (self->text);
|
grub_free (self->text);
|
||||||
|
grub_free (self->template);
|
||||||
if (! value)
|
if (! value)
|
||||||
value = "";
|
{
|
||||||
self->text = grub_strdup (value);
|
self->template = NULL;
|
||||||
|
self->text = grub_strdup ("");
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
self->template = grub_strdup (value);
|
||||||
|
self->text = grub_xasprintf (value, self->value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else if (grub_strcmp (name, "font") == 0)
|
else if (grub_strcmp (name, "font") == 0)
|
||||||
{
|
{
|
||||||
|
@ -183,11 +206,16 @@ label_set_property (void *vself, const char *name, const char *value)
|
||||||
}
|
}
|
||||||
else if (grub_strcmp (name, "id") == 0)
|
else if (grub_strcmp (name, "id") == 0)
|
||||||
{
|
{
|
||||||
|
grub_gfxmenu_timeout_unregister ((grub_gui_component_t) self);
|
||||||
grub_free (self->id);
|
grub_free (self->id);
|
||||||
if (value)
|
if (value)
|
||||||
self->id = grub_strdup (value);
|
self->id = grub_strdup (value);
|
||||||
else
|
else
|
||||||
self->id = 0;
|
self->id = 0;
|
||||||
|
if (self->id && grub_strcmp (self->id, GRUB_GFXMENU_TIMEOUT_COMPONENT_ID)
|
||||||
|
== 0)
|
||||||
|
grub_gfxmenu_timeout_register ((grub_gui_component_t) self,
|
||||||
|
label_set_state);
|
||||||
}
|
}
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -210,8 +210,7 @@ draw_scrollbar (list_impl_t self,
|
||||||
|
|
||||||
/* Draw the list of items. */
|
/* Draw the list of items. */
|
||||||
static void
|
static void
|
||||||
draw_menu (list_impl_t self, int width, int drawing_scrollbar,
|
draw_menu (list_impl_t self, int width, int num_shown_items)
|
||||||
int num_shown_items)
|
|
||||||
{
|
{
|
||||||
if (! self->menu_box || ! self->selected_item_box)
|
if (! self->menu_box || ! self->selected_item_box)
|
||||||
return;
|
return;
|
||||||
|
@ -226,8 +225,6 @@ draw_menu (list_impl_t self, int width, int drawing_scrollbar,
|
||||||
|
|
||||||
make_selected_item_visible (self);
|
make_selected_item_visible (self);
|
||||||
|
|
||||||
int scrollbar_h_space = drawing_scrollbar ? self->scrollbar_width : 0;
|
|
||||||
|
|
||||||
grub_gfxmenu_box_t selbox = self->selected_item_box;
|
grub_gfxmenu_box_t selbox = self->selected_item_box;
|
||||||
int sel_leftpad = selbox->get_left_pad (selbox);
|
int sel_leftpad = selbox->get_left_pad (selbox);
|
||||||
int item_top = boxpad;
|
int item_top = boxpad;
|
||||||
|
@ -244,12 +241,8 @@ draw_menu (list_impl_t self, int width, int drawing_scrollbar,
|
||||||
if (is_selected)
|
if (is_selected)
|
||||||
{
|
{
|
||||||
int sel_toppad = selbox->get_top_pad (selbox);
|
int sel_toppad = selbox->get_top_pad (selbox);
|
||||||
selbox->set_content_size (selbox,
|
selbox->set_content_size (selbox, (width - 2 * boxpad), item_height);
|
||||||
(width - 2 * boxpad
|
selbox->draw (selbox, item_left - sel_leftpad,
|
||||||
- scrollbar_h_space),
|
|
||||||
item_height);
|
|
||||||
selbox->draw (selbox,
|
|
||||||
item_left - sel_leftpad,
|
|
||||||
item_top - sel_toppad);
|
item_top - sel_toppad);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -320,7 +313,7 @@ list_paint (void *vself, const grub_video_rect_t *region)
|
||||||
box->draw (box, 0, 0);
|
box->draw (box, 0, 0);
|
||||||
|
|
||||||
grub_gui_set_viewport (&content_rect, &vpsave2);
|
grub_gui_set_viewport (&content_rect, &vpsave2);
|
||||||
draw_menu (self, content_rect.width, drawing_scrollbar, num_shown_items);
|
draw_menu (self, content_rect.width, num_shown_items);
|
||||||
grub_gui_restore_viewport (&vpsave2);
|
grub_gui_restore_viewport (&vpsave2);
|
||||||
|
|
||||||
if (drawing_scrollbar)
|
if (drawing_scrollbar)
|
||||||
|
|
|
@ -60,6 +60,7 @@ static void
|
||||||
progress_bar_destroy (void *vself)
|
progress_bar_destroy (void *vself)
|
||||||
{
|
{
|
||||||
grub_gui_progress_bar_t self = vself;
|
grub_gui_progress_bar_t self = vself;
|
||||||
|
grub_gfxmenu_timeout_unregister ((grub_gui_component_t) self);
|
||||||
grub_free (self);
|
grub_free (self);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -333,11 +334,16 @@ progress_bar_set_property (void *vself, const char *name, const char *value)
|
||||||
}
|
}
|
||||||
else if (grub_strcmp (name, "id") == 0)
|
else if (grub_strcmp (name, "id") == 0)
|
||||||
{
|
{
|
||||||
|
grub_gfxmenu_timeout_unregister ((grub_gui_component_t) self);
|
||||||
grub_free (self->id);
|
grub_free (self->id);
|
||||||
if (value)
|
if (value)
|
||||||
self->id = grub_strdup (value);
|
self->id = grub_strdup (value);
|
||||||
else
|
else
|
||||||
self->id = 0;
|
self->id = 0;
|
||||||
|
/* if (self->id && grub_strcmp (self->id, GRUB_GFXMENU_TIMEOUT_COMPONENT_ID)
|
||||||
|
== 0)*/
|
||||||
|
grub_gfxmenu_timeout_register ((grub_gui_component_t) self,
|
||||||
|
progress_bar_set_state);
|
||||||
}
|
}
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
}
|
}
|
||||||
|
@ -368,6 +374,7 @@ grub_gui_progress_bar_new (void)
|
||||||
self = grub_zalloc (sizeof (*self));
|
self = grub_zalloc (sizeof (*self));
|
||||||
if (! self)
|
if (! self)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
self->progress.ops = &progress_bar_pb_ops;
|
self->progress.ops = &progress_bar_pb_ops;
|
||||||
self->progress.component.ops = &progress_bar_ops;
|
self->progress.component.ops = &progress_bar_ops;
|
||||||
self->visible = 1;
|
self->visible = 1;
|
||||||
|
|
|
@ -37,10 +37,6 @@
|
||||||
#include <grub/gui_string_util.h>
|
#include <grub/gui_string_util.h>
|
||||||
#include <grub/icon_manager.h>
|
#include <grub/icon_manager.h>
|
||||||
|
|
||||||
/* The component ID identifying GUI components to be updated as the timeout
|
|
||||||
status changes. */
|
|
||||||
#define TIMEOUT_COMPONENT_ID "__timeout__"
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
init_terminal (grub_gfxmenu_view_t view);
|
init_terminal (grub_gfxmenu_view_t view);
|
||||||
static grub_video_rect_t term_rect;
|
static grub_video_rect_t term_rect;
|
||||||
|
@ -166,16 +162,28 @@ struct progress_value_data
|
||||||
int value;
|
int value;
|
||||||
};
|
};
|
||||||
|
|
||||||
static void
|
struct grub_gfxmenu_timeout_notify *grub_gfxmenu_timeout_notifications;
|
||||||
update_timeout_visit (grub_gui_component_t component,
|
|
||||||
void *userdata)
|
|
||||||
{
|
|
||||||
struct progress_value_data *pv;
|
|
||||||
pv = (struct progress_value_data *) userdata;
|
|
||||||
|
|
||||||
((struct grub_gui_progress *) component)->ops
|
static void
|
||||||
->set_state ((struct grub_gui_progress *) component,
|
update_timeouts (int visible, int start, int value, int end)
|
||||||
pv->visible, pv->start, pv->value, pv->end);
|
{
|
||||||
|
struct grub_gfxmenu_timeout_notify *cur;
|
||||||
|
|
||||||
|
for (cur = grub_gfxmenu_timeout_notifications; cur; cur = cur->next)
|
||||||
|
cur->set_state (cur->self, visible, start, value, end);
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
redraw_timeouts (struct grub_gfxmenu_view *view)
|
||||||
|
{
|
||||||
|
struct grub_gfxmenu_timeout_notify *cur;
|
||||||
|
|
||||||
|
for (cur = grub_gfxmenu_timeout_notifications; cur; cur = cur->next)
|
||||||
|
{
|
||||||
|
grub_video_rect_t bounds;
|
||||||
|
cur->self->ops->get_bounds (cur->self, &bounds);
|
||||||
|
grub_gfxmenu_view_redraw (view, &bounds);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -183,67 +191,26 @@ grub_gfxmenu_print_timeout (int timeout, void *data)
|
||||||
{
|
{
|
||||||
struct grub_gfxmenu_view *view = data;
|
struct grub_gfxmenu_view *view = data;
|
||||||
|
|
||||||
struct progress_value_data pv;
|
|
||||||
|
|
||||||
auto void redraw_timeout_visit (grub_gui_component_t component,
|
|
||||||
void *userdata __attribute__ ((unused)));
|
|
||||||
|
|
||||||
auto void redraw_timeout_visit (grub_gui_component_t component,
|
|
||||||
void *userdata __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
grub_video_rect_t bounds;
|
|
||||||
component->ops->get_bounds (component, &bounds);
|
|
||||||
grub_gfxmenu_view_redraw (view, &bounds);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (view->first_timeout == -1)
|
if (view->first_timeout == -1)
|
||||||
view->first_timeout = timeout;
|
view->first_timeout = timeout;
|
||||||
|
|
||||||
pv.visible = 1;
|
update_timeouts (1, -(view->first_timeout + 1), -timeout, 0);
|
||||||
pv.start = -(view->first_timeout + 1);
|
redraw_timeouts (view);
|
||||||
pv.end = 0;
|
|
||||||
pv.value = -timeout;
|
|
||||||
|
|
||||||
grub_gui_find_by_id ((grub_gui_component_t) view->canvas,
|
|
||||||
TIMEOUT_COMPONENT_ID, update_timeout_visit, &pv);
|
|
||||||
grub_gui_find_by_id ((grub_gui_component_t) view->canvas,
|
|
||||||
TIMEOUT_COMPONENT_ID, redraw_timeout_visit, &pv);
|
|
||||||
grub_video_swap_buffers ();
|
grub_video_swap_buffers ();
|
||||||
if (view->double_repaint)
|
if (view->double_repaint)
|
||||||
grub_gui_find_by_id ((grub_gui_component_t) view->canvas,
|
redraw_timeouts (view);
|
||||||
TIMEOUT_COMPONENT_ID, redraw_timeout_visit, &pv);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
grub_gfxmenu_clear_timeout (void *data)
|
grub_gfxmenu_clear_timeout (void *data)
|
||||||
{
|
{
|
||||||
struct progress_value_data pv;
|
|
||||||
struct grub_gfxmenu_view *view = data;
|
struct grub_gfxmenu_view *view = data;
|
||||||
|
|
||||||
auto void redraw_timeout_visit (grub_gui_component_t component,
|
update_timeouts (0, 1, 0, 0);
|
||||||
void *userdata __attribute__ ((unused)));
|
redraw_timeouts (view);
|
||||||
|
|
||||||
auto void redraw_timeout_visit (grub_gui_component_t component,
|
|
||||||
void *userdata __attribute__ ((unused)))
|
|
||||||
{
|
|
||||||
grub_video_rect_t bounds;
|
|
||||||
component->ops->get_bounds (component, &bounds);
|
|
||||||
grub_gfxmenu_view_redraw (view, &bounds);
|
|
||||||
}
|
|
||||||
|
|
||||||
pv.visible = 0;
|
|
||||||
pv.start = 1;
|
|
||||||
pv.end = 0;
|
|
||||||
pv.value = 0;
|
|
||||||
|
|
||||||
grub_gui_find_by_id ((grub_gui_component_t) view->canvas,
|
|
||||||
TIMEOUT_COMPONENT_ID, update_timeout_visit, &pv);
|
|
||||||
grub_gui_find_by_id ((grub_gui_component_t) view->canvas,
|
|
||||||
TIMEOUT_COMPONENT_ID, redraw_timeout_visit, &pv);
|
|
||||||
grub_video_swap_buffers ();
|
grub_video_swap_buffers ();
|
||||||
if (view->double_repaint)
|
if (view->double_repaint)
|
||||||
grub_gui_find_by_id ((grub_gui_component_t) view->canvas,
|
redraw_timeouts (view);
|
||||||
TIMEOUT_COMPONENT_ID, redraw_timeout_visit, &pv);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -390,11 +357,6 @@ grub_gfxmenu_draw_terminal_box (void)
|
||||||
term_box->draw (term_box,
|
term_box->draw (term_box,
|
||||||
term_rect.x - term_box->get_left_pad (term_box),
|
term_rect.x - term_box->get_left_pad (term_box),
|
||||||
term_rect.y - term_box->get_top_pad (term_box));
|
term_rect.y - term_box->get_top_pad (term_box));
|
||||||
grub_video_swap_buffers ();
|
|
||||||
if (term_view->double_repaint)
|
|
||||||
term_box->draw (term_box,
|
|
||||||
term_rect.x - term_box->get_left_pad (term_box),
|
|
||||||
term_rect.y - term_box->get_top_pad (term_box));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
|
|
@ -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;
|
return (cmd) ? cmd->func (cmd, argc, argv) : GRUB_ERR_FILE_NOT_FOUND;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
#define FOR_COMMANDS(var) FOR_LIST_ELEMENTS((var), grub_command_list)
|
||||||
grub_command_iterate (int (*func) (grub_command_t))
|
|
||||||
{
|
|
||||||
return grub_list_iterate (GRUB_AS_LIST (grub_command_list),
|
|
||||||
(grub_list_hook_t) func);
|
|
||||||
}
|
|
||||||
|
|
||||||
void grub_register_core_commands (void);
|
void grub_register_core_commands (void);
|
||||||
|
|
||||||
|
|
190
include/grub/cs5536.h
Normal file
190
include/grub/cs5536.h
Normal file
|
@ -0,0 +1,190 @@
|
||||||
|
/*
|
||||||
|
* 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_CS5536_HEADER
|
||||||
|
#define GRUB_CS5536_HEADER 1
|
||||||
|
|
||||||
|
#ifndef ASM_FILE
|
||||||
|
#include <grub/pci.h>
|
||||||
|
#include <grub/err.h>
|
||||||
|
#include <grub/smbus.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define GRUB_CS5536_PCIID 0x208f1022
|
||||||
|
#define GRUB_CS5536_MSR_MAILBOX_ADDR 0xf4
|
||||||
|
#define GRUB_CS5536_MSR_MAILBOX_DATA0 0xf8
|
||||||
|
#define GRUB_CS5536_MSR_MAILBOX_DATA1 0xfc
|
||||||
|
#define GRUB_CS5536_MSR_IRQ_MAP_BAR 0x80000008
|
||||||
|
#define GRUB_CS5536_MSR_SMB_BAR 0x8000000b
|
||||||
|
|
||||||
|
#define GRUB_CS5536_SMBUS_REGS_SIZE 8
|
||||||
|
#define GRUB_CS5536_GPIO_REGS_SIZE 256
|
||||||
|
#define GRUB_CS5536_MFGPT_REGS_SIZE 64
|
||||||
|
#define GRUB_CS5536_IRQ_MAP_REGS_SIZE 32
|
||||||
|
#define GRUB_CS5536_PM_REGS_SIZE 128
|
||||||
|
#define GRUB_CS5536_ACPI_REGS_SIZE 32
|
||||||
|
|
||||||
|
#define GRUB_CS5536_USB_OPTION_REGS_SIZE 0x1c
|
||||||
|
#define GRUB_CS5536_USB_OPTION_REG_UOCMUX 1
|
||||||
|
#define GRUB_CS5536_USB_OPTION_REG_UOCMUX_PMUX_MASK 0x03
|
||||||
|
#define GRUB_CS5536_USB_OPTION_REG_UOCMUX_PMUX_HC 0x02
|
||||||
|
|
||||||
|
#define GRUB_CS5536_DESTINATION_GLIU 0
|
||||||
|
#define GRUB_CS5536_DESTINATION_GLPCI_SB 1
|
||||||
|
#define GRUB_CS5536_DESTINATION_USB 2
|
||||||
|
#define GRUB_CS5536_DESTINATION_IDE 3
|
||||||
|
#define GRUB_CS5536_DESTINATION_DD 4
|
||||||
|
#define GRUB_CS5536_DESTINATION_ACC 5
|
||||||
|
#define GRUB_CS5536_DESTINATION_GLCP 7
|
||||||
|
|
||||||
|
#define GRUB_CS5536_P2D_DEST_SHIFT 61
|
||||||
|
#define GRUB_CS5536_P2D_LOG_ALIGN 12
|
||||||
|
#define GRUB_CS5536_P2D_ALIGN (1 << GRUB_CS5536_P2D_LOG_ALIGN)
|
||||||
|
#define GRUB_CS5536_P2D_BASE_SHIFT 20
|
||||||
|
#define GRUB_CS5536_P2D_MASK_SHIFT 0
|
||||||
|
|
||||||
|
#define GRUB_CS5536_MSR_GL_IOD_START 0x000100e0
|
||||||
|
#define GRUB_CS5536_IOD_DEST_SHIFT 61
|
||||||
|
#define GRUB_CS5536_IOD_BASE_SHIFT 20
|
||||||
|
#define GRUB_CS5536_IOD_MASK_SHIFT 0
|
||||||
|
#define GRUB_CS5536_IOD_ADDR_MASK 0xfffff
|
||||||
|
|
||||||
|
#define GRUB_CS5536_MSR_GPIO_BAR 0x8000000c
|
||||||
|
#define GRUB_CS5536_MSR_MFGPT_BAR 0x8000000d
|
||||||
|
#define GRUB_CS5536_MSR_ACPI_BAR 0x8000000e
|
||||||
|
#define GRUB_CS5536_MSR_PM_BAR 0x8000000f
|
||||||
|
#define GRUB_CS5536_MSR_DIVIL_LEG_IO 0x80000014
|
||||||
|
#define GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE0 0x00000001
|
||||||
|
#define GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE1 0x00000002
|
||||||
|
#define GRUB_CS5536_MSR_DIVIL_LEG_IO_MODE_X86 0x10000000
|
||||||
|
#define GRUB_CS5536_MSR_DIVIL_LEG_IO_F_REMAP 0x04000000
|
||||||
|
#define GRUB_CS5536_MSR_DIVIL_IRQ_MAPPER_PRIMARY_MASK 0x80000024
|
||||||
|
#define GRUB_CS5536_MSR_DIVIL_IRQ_MAPPER_LPC_MASK 0x80000025
|
||||||
|
#define GRUB_CS5536_DIVIL_LPC_INTERRUPTS 0x1002
|
||||||
|
#define GRUB_CS5536_MSR_DIVIL_LPC_SERIAL_IRQ_CONTROL 0x8000004e
|
||||||
|
#define GRUB_CS5536_MSR_DIVIL_LPC_SERIAL_IRQ_CONTROL_ENABLE 0x80
|
||||||
|
|
||||||
|
#define GRUB_CS5536_MSR_USB_OHCI_BASE 0x40000008
|
||||||
|
#define GRUB_CS5536_MSR_USB_EHCI_BASE 0x40000009
|
||||||
|
#define GRUB_CS5536_MSR_USB_CONTROLLER_BASE 0x4000000a
|
||||||
|
#define GRUB_CS5536_MSR_USB_OPTION_CONTROLLER_BASE 0x4000000b
|
||||||
|
#define GRUB_CS5536_MSR_USB_BASE_ADDR_MASK 0x00ffffff00ULL
|
||||||
|
#define GRUB_CS5536_MSR_USB_BASE_BUS_MASTER 0x0400000000ULL
|
||||||
|
#define GRUB_CS5536_MSR_USB_BASE_MEMORY_ENABLE 0x0200000000ULL
|
||||||
|
#define GRUB_CS5536_MSR_USB_BASE_PME_ENABLED 0x0800000000ULL
|
||||||
|
#define GRUB_CS5536_MSR_USB_BASE_PME_STATUS 0x1000000000ULL
|
||||||
|
#define GRUB_CS5536_MSR_USB_EHCI_BASE_FLDJ_SHIFT 40
|
||||||
|
|
||||||
|
#define GRUB_CS5536_MSR_IDE_IO_BAR 0x60000008
|
||||||
|
#define GRUB_CS5536_MSR_IDE_IO_BAR_UNITS 1
|
||||||
|
#define GRUB_CS5536_MSR_IDE_IO_BAR_ADDR_MASK 0xfffffff0
|
||||||
|
#define GRUB_CS5536_MSR_IDE_CFG 0x60000010
|
||||||
|
#define GRUB_CS5536_MSR_IDE_CFG_CHANNEL_ENABLE 2
|
||||||
|
#define GRUB_CS5536_MSR_IDE_TIMING 0x60000012
|
||||||
|
#define GRUB_CS5536_MSR_IDE_TIMING_PIO0 0x98
|
||||||
|
#define GRUB_CS5536_MSR_IDE_TIMING_DRIVE0_SHIFT 24
|
||||||
|
#define GRUB_CS5536_MSR_IDE_TIMING_DRIVE1_SHIFT 16
|
||||||
|
#define GRUB_CS5536_MSR_IDE_CAS_TIMING 0x60000013
|
||||||
|
#define GRUB_CS5536_MSR_IDE_CAS_TIMING_CMD_PIO0 0x99
|
||||||
|
#define GRUB_CS5536_MSR_IDE_CAS_TIMING_CMD_SHIFT 24
|
||||||
|
#define GRUB_CS5536_MSR_IDE_CAS_TIMING_DRIVE0_SHIFT 6
|
||||||
|
#define GRUB_CS5536_MSR_IDE_CAS_TIMING_DRIVE1_SHIFT 4
|
||||||
|
#define GRUB_CS5536_MSR_IDE_CAS_TIMING_PIO0 2
|
||||||
|
|
||||||
|
#define GRUB_CS5536_MSR_GL_PCI_CTRL 0x00000010
|
||||||
|
#define GRUB_CS5536_MSR_GL_PCI_CTRL_MEMORY_ENABLE 1
|
||||||
|
#define GRUB_CS5536_MSR_GL_PCI_CTRL_IO_ENABLE 2
|
||||||
|
#define GRUB_CS5536_MSR_GL_PCI_CTRL_LATENCY_SHIFT 35
|
||||||
|
#define GRUB_CS5536_MSR_GL_PCI_CTRL_OUT_THR_SHIFT 60
|
||||||
|
#define GRUB_CS5536_MSR_GL_PCI_CTRL_IN_THR_SHIFT 56
|
||||||
|
|
||||||
|
#define GRUB_CS5536_MSR_GL_REGIONS_START 0x00000020
|
||||||
|
#define GRUB_CS5536_MSR_GL_REGIONS_NUM 16
|
||||||
|
#define GRUB_CS5536_MSR_GL_REGION_ENABLE 1
|
||||||
|
#define GRUB_CS5536_MSR_GL_REGION_IO 0x100000000ULL
|
||||||
|
#define GRUB_CS5536_MSR_GL_REGION_BASE_MASK 0xfffff000ULL
|
||||||
|
#define GRUB_CS5536_MSR_GL_REGION_IO_BASE_SHIFT 12
|
||||||
|
#define GRUB_CS5536_MSR_GL_REGION_TOP_MASK 0xfffff00000000000ULL
|
||||||
|
#define GRUB_CS5536_MSR_GL_REGION_IO_TOP_SHIFT 44
|
||||||
|
|
||||||
|
#define GRUB_CS5536_MSR_GL_P2D_START 0x00010020
|
||||||
|
|
||||||
|
#define GRUB_CS5536_SMB_REG_DATA 0x0
|
||||||
|
#define GRUB_CS5536_SMB_REG_STATUS 0x1
|
||||||
|
#define GRUB_CS5536_SMB_REG_STATUS_SDAST (1 << 6)
|
||||||
|
#define GRUB_CS5536_SMB_REG_STATUS_BER (1 << 5)
|
||||||
|
#define GRUB_CS5536_SMB_REG_STATUS_NACK (1 << 4)
|
||||||
|
#define GRUB_CS5536_SMB_REG_CTRL1 0x3
|
||||||
|
#define GRUB_CS5536_SMB_REG_CTRL1_START 0x01
|
||||||
|
#define GRUB_CS5536_SMB_REG_CTRL1_STOP 0x02
|
||||||
|
#define GRUB_CS5536_SMB_REG_CTRL1_ACK 0x10
|
||||||
|
#define GRUB_CS5536_SMB_REG_ADDR 0x4
|
||||||
|
#define GRUB_CS5536_SMB_REG_ADDR_MASTER 0x0
|
||||||
|
#define GRUB_CS5536_SMB_REG_CTRL2 0x5
|
||||||
|
#define GRUB_CS5536_SMB_REG_CTRL2_ENABLE 0x1
|
||||||
|
#define GRUB_CS5536_SMB_REG_CTRL3 0x6
|
||||||
|
|
||||||
|
#ifdef ASM_FILE
|
||||||
|
#define GRUB_ULL(x) x
|
||||||
|
#else
|
||||||
|
#define GRUB_ULL(x) x ## ULL
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define GRUB_CS5536_LBAR_ADDR_MASK GRUB_ULL (0x000000000000fff8)
|
||||||
|
#define GRUB_CS5536_LBAR_ENABLE GRUB_ULL (0x0000000100000000)
|
||||||
|
#define GRUB_CS5536_LBAR_MASK_MASK GRUB_ULL (0x0000f00000000000)
|
||||||
|
#define GRUB_CS5536_LBAR_TURN_ON (GRUB_CS5536_LBAR_ENABLE | GRUB_CS5536_LBAR_MASK_MASK)
|
||||||
|
|
||||||
|
/* PMON-compatible LBARs. */
|
||||||
|
#define GRUB_CS5536_LBAR_GPIO 0xb000
|
||||||
|
#define GRUB_CS5536_LBAR_ACC 0xb200
|
||||||
|
#define GRUB_CS5536_LBAR_PM 0xb280
|
||||||
|
#define GRUB_CS5536_LBAR_MFGPT 0xb300
|
||||||
|
#define GRUB_CS5536_LBAR_ACPI 0xb340
|
||||||
|
#define GRUB_CS5536_LBAR_IRQ_MAP 0xb360
|
||||||
|
#define GRUB_CS5536_LBAR_IDE 0xb380
|
||||||
|
#define GRUB_CS5536_LBAR_SMBUS 0xb390
|
||||||
|
|
||||||
|
#define GRUB_GPIO_SMBUS_PINS ((1 << 14) | (1 << 15))
|
||||||
|
#define GRUB_GPIO_REG_OUT_EN 0x4
|
||||||
|
#define GRUB_GPIO_REG_OUT_AUX1 0x10
|
||||||
|
#define GRUB_GPIO_REG_IN_EN 0x20
|
||||||
|
#define GRUB_GPIO_REG_IN_AUX1 0x34
|
||||||
|
|
||||||
|
#ifndef ASM_FILE
|
||||||
|
int EXPORT_FUNC (grub_cs5536_find) (grub_pci_device_t *devp);
|
||||||
|
|
||||||
|
grub_uint64_t EXPORT_FUNC (grub_cs5536_read_msr) (grub_pci_device_t dev,
|
||||||
|
grub_uint32_t addr);
|
||||||
|
void EXPORT_FUNC (grub_cs5536_write_msr) (grub_pci_device_t dev,
|
||||||
|
grub_uint32_t addr,
|
||||||
|
grub_uint64_t val);
|
||||||
|
grub_err_t grub_cs5536_read_spd_byte (grub_port_t smbbase, grub_uint8_t dev,
|
||||||
|
grub_uint8_t addr, grub_uint8_t *res);
|
||||||
|
grub_err_t EXPORT_FUNC (grub_cs5536_read_spd) (grub_port_t smbbase,
|
||||||
|
grub_uint8_t dev,
|
||||||
|
struct grub_smbus_spd *res);
|
||||||
|
grub_err_t grub_cs5536_smbus_wait (grub_port_t smbbase);
|
||||||
|
grub_err_t EXPORT_FUNC (grub_cs5536_init_smbus) (grub_pci_device_t dev,
|
||||||
|
grub_uint16_t divisor,
|
||||||
|
grub_port_t *smbbase);
|
||||||
|
|
||||||
|
void grub_cs5536_init_geode (grub_pci_device_t dev);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
|
@ -138,6 +138,9 @@ typedef struct grub_disk_memberlist *grub_disk_memberlist_t;
|
||||||
#define GRUB_DISK_CACHE_SIZE 8
|
#define GRUB_DISK_CACHE_SIZE 8
|
||||||
#define GRUB_DISK_CACHE_BITS 3
|
#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. */
|
/* This is called from the memory manager. */
|
||||||
void grub_disk_cache_invalidate_all (void);
|
void grub_disk_cache_invalidate_all (void);
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,7 @@ struct grub_dl
|
||||||
Elf_Sym *symtab;
|
Elf_Sym *symtab;
|
||||||
void (*init) (struct grub_dl *mod);
|
void (*init) (struct grub_dl *mod);
|
||||||
void (*fini) (void);
|
void (*fini) (void);
|
||||||
|
struct grub_dl *next;
|
||||||
};
|
};
|
||||||
typedef struct grub_dl *grub_dl_t;
|
typedef struct grub_dl *grub_dl_t;
|
||||||
|
|
||||||
|
@ -96,24 +97,12 @@ void grub_dl_unload_all (void);
|
||||||
#else
|
#else
|
||||||
#define GRUB_NO_MODULES 0
|
#define GRUB_NO_MODULES 0
|
||||||
#endif
|
#endif
|
||||||
#if GRUB_NO_MODULES
|
|
||||||
static inline int
|
|
||||||
grub_dl_ref (grub_dl_t mod)
|
|
||||||
{
|
|
||||||
(void) mod;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
static inline int
|
|
||||||
grub_dl_unref (grub_dl_t mod)
|
|
||||||
{
|
|
||||||
(void) mod;
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
#else
|
|
||||||
int EXPORT_FUNC(grub_dl_ref) (grub_dl_t mod);
|
int EXPORT_FUNC(grub_dl_ref) (grub_dl_t mod);
|
||||||
int EXPORT_FUNC(grub_dl_unref) (grub_dl_t mod);
|
int EXPORT_FUNC(grub_dl_unref) (grub_dl_t mod);
|
||||||
#endif
|
extern grub_dl_t EXPORT_VAR(grub_dl_head);
|
||||||
void EXPORT_FUNC(grub_dl_iterate) (int (*hook) (grub_dl_t mod));
|
|
||||||
|
#define FOR_DL_MODULES(var) FOR_LIST_ELEMENTS ((var), (grub_dl_head))
|
||||||
|
|
||||||
grub_dl_t EXPORT_FUNC(grub_dl_get) (const char *name);
|
grub_dl_t EXPORT_FUNC(grub_dl_get) (const char *name);
|
||||||
grub_err_t grub_dl_register_symbol (const char *name, void *addr,
|
grub_err_t grub_dl_register_symbol (const char *name, void *addr,
|
||||||
grub_dl_t mod);
|
grub_dl_t mod);
|
||||||
|
|
|
@ -99,12 +99,8 @@ struct grub_pe32_optional_header
|
||||||
grub_uint32_t entry_addr;
|
grub_uint32_t entry_addr;
|
||||||
grub_uint32_t code_base;
|
grub_uint32_t code_base;
|
||||||
|
|
||||||
#if GRUB_TARGET_SIZEOF_VOID_P == 4
|
|
||||||
grub_uint32_t data_base;
|
grub_uint32_t data_base;
|
||||||
grub_uint32_t image_base;
|
grub_uint32_t image_base;
|
||||||
#else
|
|
||||||
grub_uint64_t image_base;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
grub_uint32_t section_alignment;
|
grub_uint32_t section_alignment;
|
||||||
grub_uint32_t file_alignment;
|
grub_uint32_t file_alignment;
|
||||||
|
@ -121,22 +117,11 @@ struct grub_pe32_optional_header
|
||||||
grub_uint16_t subsystem;
|
grub_uint16_t subsystem;
|
||||||
grub_uint16_t dll_characteristics;
|
grub_uint16_t dll_characteristics;
|
||||||
|
|
||||||
#if GRUB_TARGET_SIZEOF_VOID_P == 4
|
|
||||||
|
|
||||||
grub_uint32_t stack_reserve_size;
|
grub_uint32_t stack_reserve_size;
|
||||||
grub_uint32_t stack_commit_size;
|
grub_uint32_t stack_commit_size;
|
||||||
grub_uint32_t heap_reserve_size;
|
grub_uint32_t heap_reserve_size;
|
||||||
grub_uint32_t heap_commit_size;
|
grub_uint32_t heap_commit_size;
|
||||||
|
|
||||||
#else
|
|
||||||
|
|
||||||
grub_uint64_t stack_reserve_size;
|
|
||||||
grub_uint64_t stack_commit_size;
|
|
||||||
grub_uint64_t heap_reserve_size;
|
|
||||||
grub_uint64_t heap_commit_size;
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
grub_uint32_t loader_flags;
|
grub_uint32_t loader_flags;
|
||||||
grub_uint32_t num_data_directories;
|
grub_uint32_t num_data_directories;
|
||||||
|
|
||||||
|
@ -159,15 +144,63 @@ struct grub_pe32_optional_header
|
||||||
struct grub_pe32_data_directory reserved_entry;
|
struct grub_pe32_data_directory reserved_entry;
|
||||||
};
|
};
|
||||||
|
|
||||||
#if GRUB_TARGET_SIZEOF_VOID_P == 4
|
struct grub_pe64_optional_header
|
||||||
|
{
|
||||||
|
grub_uint16_t magic;
|
||||||
|
grub_uint8_t major_linker_version;
|
||||||
|
grub_uint8_t minor_linker_version;
|
||||||
|
grub_uint32_t code_size;
|
||||||
|
grub_uint32_t data_size;
|
||||||
|
grub_uint32_t bss_size;
|
||||||
|
grub_uint32_t entry_addr;
|
||||||
|
grub_uint32_t code_base;
|
||||||
|
|
||||||
|
grub_uint64_t image_base;
|
||||||
|
|
||||||
|
grub_uint32_t section_alignment;
|
||||||
|
grub_uint32_t file_alignment;
|
||||||
|
grub_uint16_t major_os_version;
|
||||||
|
grub_uint16_t minor_os_version;
|
||||||
|
grub_uint16_t major_image_version;
|
||||||
|
grub_uint16_t minor_image_version;
|
||||||
|
grub_uint16_t major_subsystem_version;
|
||||||
|
grub_uint16_t minor_subsystem_version;
|
||||||
|
grub_uint32_t reserved;
|
||||||
|
grub_uint32_t image_size;
|
||||||
|
grub_uint32_t header_size;
|
||||||
|
grub_uint32_t checksum;
|
||||||
|
grub_uint16_t subsystem;
|
||||||
|
grub_uint16_t dll_characteristics;
|
||||||
|
|
||||||
|
grub_uint64_t stack_reserve_size;
|
||||||
|
grub_uint64_t stack_commit_size;
|
||||||
|
grub_uint64_t heap_reserve_size;
|
||||||
|
grub_uint64_t heap_commit_size;
|
||||||
|
|
||||||
|
grub_uint32_t loader_flags;
|
||||||
|
grub_uint32_t num_data_directories;
|
||||||
|
|
||||||
|
/* Data directories. */
|
||||||
|
struct grub_pe32_data_directory export_table;
|
||||||
|
struct grub_pe32_data_directory import_table;
|
||||||
|
struct grub_pe32_data_directory resource_table;
|
||||||
|
struct grub_pe32_data_directory exception_table;
|
||||||
|
struct grub_pe32_data_directory certificate_table;
|
||||||
|
struct grub_pe32_data_directory base_relocation_table;
|
||||||
|
struct grub_pe32_data_directory debug;
|
||||||
|
struct grub_pe32_data_directory architecture;
|
||||||
|
struct grub_pe32_data_directory global_ptr;
|
||||||
|
struct grub_pe32_data_directory tls_table;
|
||||||
|
struct grub_pe32_data_directory load_config_table;
|
||||||
|
struct grub_pe32_data_directory bound_import;
|
||||||
|
struct grub_pe32_data_directory iat;
|
||||||
|
struct grub_pe32_data_directory delay_import_descriptor;
|
||||||
|
struct grub_pe32_data_directory com_runtime_header;
|
||||||
|
struct grub_pe32_data_directory reserved_entry;
|
||||||
|
};
|
||||||
|
|
||||||
#define GRUB_PE32_PE32_MAGIC 0x10b
|
#define GRUB_PE32_PE32_MAGIC 0x10b
|
||||||
|
#define GRUB_PE32_PE64_MAGIC 0x20b
|
||||||
#else
|
|
||||||
|
|
||||||
#define GRUB_PE32_PE32_MAGIC 0x20b
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#define GRUB_PE32_SUBSYSTEM_EFI_APPLICATION 10
|
#define GRUB_PE32_SUBSYSTEM_EFI_APPLICATION 10
|
||||||
|
|
||||||
|
@ -205,6 +238,7 @@ struct grub_pe32_section_table
|
||||||
#define GRUB_PE32_SCN_ALIGN_SHIFT 20
|
#define GRUB_PE32_SCN_ALIGN_SHIFT 20
|
||||||
#define GRUB_PE32_SCN_ALIGN_MASK 7
|
#define GRUB_PE32_SCN_ALIGN_MASK 7
|
||||||
|
|
||||||
|
#define GRUB_PE32_SIGNATURE_SIZE 4
|
||||||
|
|
||||||
struct grub_pe32_header
|
struct grub_pe32_header
|
||||||
{
|
{
|
||||||
|
@ -212,13 +246,18 @@ struct grub_pe32_header
|
||||||
grub_uint8_t msdos_stub[GRUB_PE32_MSDOS_STUB_SIZE];
|
grub_uint8_t msdos_stub[GRUB_PE32_MSDOS_STUB_SIZE];
|
||||||
|
|
||||||
/* This is always PE\0\0. */
|
/* This is always PE\0\0. */
|
||||||
char signature[4];
|
char signature[GRUB_PE32_SIGNATURE_SIZE];
|
||||||
|
|
||||||
/* The COFF file header. */
|
/* The COFF file header. */
|
||||||
struct grub_pe32_coff_header coff_header;
|
struct grub_pe32_coff_header coff_header;
|
||||||
|
|
||||||
|
#if GRUB_TARGET_SIZEOF_VOID_P == 8
|
||||||
|
/* The Optional header. */
|
||||||
|
struct grub_pe64_optional_header optional_header;
|
||||||
|
#else
|
||||||
/* The Optional header. */
|
/* The Optional header. */
|
||||||
struct grub_pe32_optional_header optional_header;
|
struct grub_pe32_optional_header optional_header;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
struct grub_pe32_fixup_block
|
struct grub_pe32_fixup_block
|
||||||
|
|
|
@ -32,7 +32,7 @@ enum grub_efi_uga_blt_operation
|
||||||
GRUB_EFI_UGA_VIDEO_TO_BLT,
|
GRUB_EFI_UGA_VIDEO_TO_BLT,
|
||||||
GRUB_EFI_UGA_BLT_TO_VIDEO,
|
GRUB_EFI_UGA_BLT_TO_VIDEO,
|
||||||
GRUB_EFI_UGA_VIDEO_TO_VIDEO,
|
GRUB_EFI_UGA_VIDEO_TO_VIDEO,
|
||||||
GRUB_EFI_UGA_GLT_MAX
|
GRUB_EFI_UGA_BLT_MAX
|
||||||
};
|
};
|
||||||
|
|
||||||
struct grub_efi_uga_pixel
|
struct grub_efi_uga_pixel
|
||||||
|
|
|
@ -555,6 +555,7 @@ typedef struct
|
||||||
#define PT_NUM 8 /* Number of defined types */
|
#define PT_NUM 8 /* Number of defined types */
|
||||||
#define PT_LOOS 0x60000000 /* Start of OS-specific */
|
#define PT_LOOS 0x60000000 /* Start of OS-specific */
|
||||||
#define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */
|
#define PT_GNU_EH_FRAME 0x6474e550 /* GCC .eh_frame_hdr segment */
|
||||||
|
#define PT_GNU_STACK 0x6474e551 /* GCC stack segment */
|
||||||
#define PT_LOSUNW 0x6ffffffa
|
#define PT_LOSUNW 0x6ffffffa
|
||||||
#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */
|
#define PT_SUNWBSS 0x6ffffffa /* Sun Specific segment */
|
||||||
#define PT_SUNWSTACK 0x6ffffffb /* Stack segment */
|
#define PT_SUNWSTACK 0x6ffffffb /* Stack segment */
|
||||||
|
|
55
include/grub/emu/misc.h
Normal file
55
include/grub/emu/misc.h
Normal file
|
@ -0,0 +1,55 @@
|
||||||
|
#ifndef GRUB_EMU_MISC_H
|
||||||
|
#define GRUB_EMU_MISC_H 1
|
||||||
|
|
||||||
|
#include <grub/symbol.h>
|
||||||
|
#include <grub/types.h>
|
||||||
|
|
||||||
|
#ifdef __CYGWIN__
|
||||||
|
# include <sys/fcntl.h>
|
||||||
|
# include <sys/cygwin.h>
|
||||||
|
# include <limits.h>
|
||||||
|
# define DEV_CYGDRIVE_MAJOR 98
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef __NetBSD__
|
||||||
|
/* NetBSD uses /boot for its boot block. */
|
||||||
|
# define DEFAULT_DIRECTORY "/grub"
|
||||||
|
#else
|
||||||
|
# define DEFAULT_DIRECTORY "/boot/grub"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define DEFAULT_DEVICE_MAP DEFAULT_DIRECTORY "/device.map"
|
||||||
|
|
||||||
|
extern int verbosity;
|
||||||
|
extern const char *program_name;
|
||||||
|
|
||||||
|
void grub_init_all (void);
|
||||||
|
void grub_fini_all (void);
|
||||||
|
|
||||||
|
char *grub_make_system_path_relative_to_its_root (const char *path);
|
||||||
|
|
||||||
|
void * EXPORT_FUNC(xmalloc) (grub_size_t size);
|
||||||
|
void * EXPORT_FUNC(xrealloc) (void *ptr, grub_size_t size);
|
||||||
|
char * EXPORT_FUNC(xstrdup) (const char *str);
|
||||||
|
char * EXPORT_FUNC(xasprintf) (const char *fmt, ...);
|
||||||
|
|
||||||
|
void EXPORT_FUNC(grub_util_warn) (const char *fmt, ...);
|
||||||
|
void EXPORT_FUNC(grub_util_info) (const char *fmt, ...);
|
||||||
|
void EXPORT_FUNC(grub_util_error) (const char *fmt, ...) __attribute__ ((noreturn));
|
||||||
|
|
||||||
|
#ifndef HAVE_VASPRINTF
|
||||||
|
int EXPORT_FUNC(vasprintf) (char **buf, const char *fmt, va_list ap);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef HAVE_ASPRINTF
|
||||||
|
int EXPORT_FUNC(asprintf) (char **buf, const char *fmt, ...);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
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/symbol.h>
|
||||||
#include <grub/types.h>
|
#include <grub/types.h>
|
||||||
|
|
||||||
|
#include <grub/list.h>
|
||||||
|
|
||||||
/* Forward declaration is required, because of mutual reference. */
|
/* Forward declaration is required, because of mutual reference. */
|
||||||
struct grub_file;
|
struct grub_file;
|
||||||
|
|
||||||
|
@ -38,6 +40,9 @@ struct grub_dirhook_info
|
||||||
/* Filesystem descriptor. */
|
/* Filesystem descriptor. */
|
||||||
struct grub_fs
|
struct grub_fs
|
||||||
{
|
{
|
||||||
|
/* The next filesystem. */
|
||||||
|
struct grub_fs *next;
|
||||||
|
|
||||||
/* My name. */
|
/* My name. */
|
||||||
const char *name;
|
const char *name;
|
||||||
|
|
||||||
|
@ -72,9 +77,6 @@ struct grub_fs
|
||||||
/* Whether this filesystem reserves first sector for DOS-style boot. */
|
/* Whether this filesystem reserves first sector for DOS-style boot. */
|
||||||
int reserved_first_sector;
|
int reserved_first_sector;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The next filesystem. */
|
|
||||||
struct grub_fs *next;
|
|
||||||
};
|
};
|
||||||
typedef struct grub_fs *grub_fs_t;
|
typedef struct grub_fs *grub_fs_t;
|
||||||
|
|
||||||
|
@ -87,10 +89,22 @@ extern struct grub_fs grub_fs_blocklist;
|
||||||
the linked list GRUB_FS_LIST through the function grub_fs_register. */
|
the linked list GRUB_FS_LIST through the function grub_fs_register. */
|
||||||
typedef int (*grub_fs_autoload_hook_t) (void);
|
typedef int (*grub_fs_autoload_hook_t) (void);
|
||||||
extern grub_fs_autoload_hook_t EXPORT_VAR(grub_fs_autoload_hook);
|
extern grub_fs_autoload_hook_t EXPORT_VAR(grub_fs_autoload_hook);
|
||||||
|
extern grub_fs_t EXPORT_VAR (grub_fs_list);
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
grub_fs_register (grub_fs_t fs)
|
||||||
|
{
|
||||||
|
grub_list_push (GRUB_AS_LIST_P (&grub_fs_list), GRUB_AS_LIST (fs));
|
||||||
|
}
|
||||||
|
|
||||||
|
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);
|
grub_fs_t EXPORT_FUNC(grub_fs_probe) (grub_device_t device);
|
||||||
|
|
||||||
#endif /* ! GRUB_FS_HEADER */
|
#endif /* ! GRUB_FS_HEADER */
|
||||||
|
|
|
@ -22,10 +22,15 @@
|
||||||
#include <grub/video.h>
|
#include <grub/video.h>
|
||||||
#include <grub/bitmap.h>
|
#include <grub/bitmap.h>
|
||||||
#include <grub/gfxmenu_view.h>
|
#include <grub/gfxmenu_view.h>
|
||||||
|
#include <grub/mm.h>
|
||||||
|
|
||||||
#ifndef GRUB_GUI_H
|
#ifndef GRUB_GUI_H
|
||||||
#define GRUB_GUI_H 1
|
#define GRUB_GUI_H 1
|
||||||
|
|
||||||
|
/* The component ID identifying GUI components to be updated as the timeout
|
||||||
|
status changes. */
|
||||||
|
#define GRUB_GFXMENU_TIMEOUT_COMPONENT_ID "__timeout__"
|
||||||
|
|
||||||
/* A representation of a color. Unlike grub_video_color_t, this
|
/* A representation of a color. Unlike grub_video_color_t, this
|
||||||
representation is independent of any video mode specifics. */
|
representation is independent of any video mode specifics. */
|
||||||
typedef struct grub_gui_color
|
typedef struct grub_gui_color
|
||||||
|
@ -79,6 +84,46 @@ struct grub_gui_progress_ops
|
||||||
void (*set_state) (void *self, int visible, int start, int current, int end);
|
void (*set_state) (void *self, int visible, int start, int current, int end);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
typedef void (*grub_gfxmenu_set_state_t) (void *self, int visible, int start,
|
||||||
|
int current, int end);
|
||||||
|
|
||||||
|
struct grub_gfxmenu_timeout_notify
|
||||||
|
{
|
||||||
|
struct grub_gfxmenu_timeout_notify *next;
|
||||||
|
grub_gfxmenu_set_state_t set_state;
|
||||||
|
grub_gui_component_t self;
|
||||||
|
};
|
||||||
|
|
||||||
|
extern struct grub_gfxmenu_timeout_notify *grub_gfxmenu_timeout_notifications;
|
||||||
|
|
||||||
|
static inline grub_err_t
|
||||||
|
grub_gfxmenu_timeout_register (grub_gui_component_t self,
|
||||||
|
grub_gfxmenu_set_state_t set_state)
|
||||||
|
{
|
||||||
|
struct grub_gfxmenu_timeout_notify *ne = grub_malloc (sizeof (*ne));
|
||||||
|
if (!ne)
|
||||||
|
return grub_errno;
|
||||||
|
ne->set_state = set_state;
|
||||||
|
ne->self = self;
|
||||||
|
ne->next = grub_gfxmenu_timeout_notifications;
|
||||||
|
grub_gfxmenu_timeout_notifications = ne;
|
||||||
|
return GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static inline void
|
||||||
|
grub_gfxmenu_timeout_unregister (grub_gui_component_t self)
|
||||||
|
{
|
||||||
|
struct grub_gfxmenu_timeout_notify **p, *q;
|
||||||
|
|
||||||
|
for (p = &grub_gfxmenu_timeout_notifications, q = *p;
|
||||||
|
q; p = &(q->next), q = q->next)
|
||||||
|
if (q->self == self)
|
||||||
|
{
|
||||||
|
*p = q->next;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
typedef signed grub_fixed_signed_t;
|
typedef signed grub_fixed_signed_t;
|
||||||
#define GRUB_FIXED_1 0x10000
|
#define GRUB_FIXED_1 0x10000
|
||||||
|
|
||||||
|
|
|
@ -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 */
|
|
|
@ -22,10 +22,10 @@
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <grub/symbol.h>
|
#include <grub/symbol.h>
|
||||||
|
|
||||||
extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);
|
|
||||||
|
|
||||||
/* NLS can be disabled through the configure --disable-nls option. */
|
/* NLS can be disabled through the configure --disable-nls option. */
|
||||||
#if (defined(ENABLE_NLS) && ENABLE_NLS)
|
#if (defined(ENABLE_NLS) && ENABLE_NLS) || !defined (GRUB_UTIL)
|
||||||
|
|
||||||
|
extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);
|
||||||
|
|
||||||
# ifdef GRUB_UTIL
|
# ifdef GRUB_UTIL
|
||||||
|
|
||||||
|
@ -41,18 +41,26 @@ extern const char *(*EXPORT_VAR(grub_gettext)) (const char *s);
|
||||||
for invalid uses of the value returned from these functions.
|
for invalid uses of the value returned from these functions.
|
||||||
On pre-ANSI systems without 'const', the config.h file is supposed to
|
On pre-ANSI systems without 'const', the config.h file is supposed to
|
||||||
contain "#define const". */
|
contain "#define const". */
|
||||||
# ifdef GRUB_UTIL
|
static inline const char * __attribute__ ((always_inline))
|
||||||
# define gettext(Msgid) ((const char *) (Msgid))
|
gettext (const char *str)
|
||||||
# else
|
{
|
||||||
# define grub_gettext(str) ((const char *) (str))
|
return str;
|
||||||
# endif /* GRUB_UTIL */
|
}
|
||||||
|
|
||||||
#endif /* (defined(ENABLE_NLS) && ENABLE_NLS) */
|
#endif /* (defined(ENABLE_NLS) && ENABLE_NLS) */
|
||||||
|
|
||||||
#ifdef GRUB_UTIL
|
#ifdef GRUB_UTIL
|
||||||
# define _(str) gettext(str)
|
static inline const char * __attribute__ ((always_inline))
|
||||||
|
_ (const char *str)
|
||||||
|
{
|
||||||
|
return gettext(str);
|
||||||
|
}
|
||||||
#else
|
#else
|
||||||
# define _(str) grub_gettext(str)
|
static inline const char * __attribute__ ((always_inline))
|
||||||
|
_ (const char *str)
|
||||||
|
{
|
||||||
|
return grub_gettext(str);
|
||||||
|
}
|
||||||
#endif /* GRUB_UTIL */
|
#endif /* GRUB_UTIL */
|
||||||
|
|
||||||
#define N_(str) str
|
#define N_(str) str
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2005,2006,2007,2008 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_KERNEL_MACHINE_HEADER
|
|
||||||
#define GRUB_KERNEL_MACHINE_HEADER 1
|
|
||||||
|
|
||||||
#include <grub/symbol.h>
|
|
||||||
|
|
||||||
#ifndef ASM_FILE
|
|
||||||
extern char grub_prefix[];
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
|
|
|
@ -1,33 +0,0 @@
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2002,2003,2007 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#ifndef GRUB_MACHINE_KERNEL_HEADER
|
|
||||||
#define GRUB_MACHINE_KERNEL_HEADER 1
|
|
||||||
|
|
||||||
/* The prefix which points to the directory where GRUB modules and its
|
|
||||||
configuration file are located. */
|
|
||||||
extern char grub_prefix[];
|
|
||||||
|
|
||||||
/* The offset of GRUB_PREFIX. */
|
|
||||||
#define GRUB_KERNEL_MACHINE_PREFIX 0x8
|
|
||||||
|
|
||||||
/* End of the data section. */
|
|
||||||
#define GRUB_KERNEL_MACHINE_DATA_END 0x50
|
|
||||||
|
|
||||||
#endif /* ! GRUB_MACHINE_KERNEL_HEADER */
|
|
||||||
|
|
|
@ -1 +0,0 @@
|
||||||
#include <grub/powerpc/ieee1275/kernel.h>
|
|
|
@ -1,35 +0,0 @@
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2005,2006,2007,2008,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_KERNEL_CPU_HEADER
|
|
||||||
#define GRUB_KERNEL_CPU_HEADER 1
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef GRUB_MACHINE_IEEE1275
|
|
||||||
#define GRUB_MOD_ALIGN 0x1000
|
|
||||||
#else
|
|
||||||
#define GRUB_MOD_ALIGN 0x1
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Non-zero value is only needed for PowerMacs. */
|
|
||||||
#define GRUB_MOD_GAP 0x0
|
|
||||||
|
|
||||||
#define GRUB_KERNEL_CPU_PREFIX 0x2
|
|
||||||
#define GRUB_KERNEL_CPU_DATA_END 0x42
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -19,6 +19,8 @@
|
||||||
#ifndef GRUB_BOOT_MACHINE_HEADER
|
#ifndef GRUB_BOOT_MACHINE_HEADER
|
||||||
#define GRUB_BOOT_MACHINE_HEADER 1
|
#define GRUB_BOOT_MACHINE_HEADER 1
|
||||||
|
|
||||||
|
#include <grub/offsets.h>
|
||||||
|
|
||||||
/* The signature for bootloader. */
|
/* The signature for bootloader. */
|
||||||
#define GRUB_BOOT_MACHINE_SIGNATURE 0xaa55
|
#define GRUB_BOOT_MACHINE_SIGNATURE 0xaa55
|
||||||
|
|
||||||
|
@ -57,9 +59,6 @@
|
||||||
floppy. */
|
floppy. */
|
||||||
#define GRUB_BOOT_MACHINE_BIOS_HD_FLAG 0x80
|
#define GRUB_BOOT_MACHINE_BIOS_HD_FLAG 0x80
|
||||||
|
|
||||||
/* The segment where the kernel is loaded. */
|
|
||||||
#define GRUB_BOOT_MACHINE_KERNEL_SEG 0x800
|
|
||||||
|
|
||||||
/* The address where the kernel is loaded. */
|
/* The address where the kernel is loaded. */
|
||||||
#define GRUB_BOOT_MACHINE_KERNEL_ADDR (GRUB_BOOT_MACHINE_KERNEL_SEG << 4)
|
#define GRUB_BOOT_MACHINE_KERNEL_ADDR (GRUB_BOOT_MACHINE_KERNEL_SEG << 4)
|
||||||
|
|
||||||
|
@ -68,16 +67,7 @@
|
||||||
|
|
||||||
#define GRUB_BOOT_MACHINE_PXE_DL 0x7f
|
#define GRUB_BOOT_MACHINE_PXE_DL 0x7f
|
||||||
|
|
||||||
#ifndef ASM_FILE
|
|
||||||
|
|
||||||
/* This is the blocklist used in the diskboot image. */
|
/* This is the blocklist used in the diskboot image. */
|
||||||
struct grub_boot_blocklist
|
#define grub_boot_blocklist grub_pc_bios_boot_blocklist
|
||||||
{
|
|
||||||
grub_uint64_t start;
|
|
||||||
grub_uint16_t len;
|
|
||||||
grub_uint16_t segment;
|
|
||||||
} __attribute__ ((packed));
|
|
||||||
|
|
||||||
#endif /* ! ASM_FILE */
|
|
||||||
|
|
||||||
#endif /* ! BOOT_MACHINE_HEADER */
|
#endif /* ! BOOT_MACHINE_HEADER */
|
||||||
|
|
|
@ -19,29 +19,7 @@
|
||||||
#ifndef KERNEL_MACHINE_HEADER
|
#ifndef KERNEL_MACHINE_HEADER
|
||||||
#define KERNEL_MACHINE_HEADER 1
|
#define KERNEL_MACHINE_HEADER 1
|
||||||
|
|
||||||
/* The offset of GRUB_TOTAL_MODULE_SIZE. */
|
#include <grub/offsets.h>
|
||||||
#define GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE 0x8
|
|
||||||
|
|
||||||
/* The offset of GRUB_KERNEL_IMAGE_SIZE. */
|
|
||||||
#define GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE 0xc
|
|
||||||
|
|
||||||
/* The offset of GRUB_COMPRESSED_SIZE. */
|
|
||||||
#define GRUB_KERNEL_MACHINE_COMPRESSED_SIZE 0x10
|
|
||||||
|
|
||||||
/* The offset of GRUB_INSTALL_DOS_PART. */
|
|
||||||
#define GRUB_KERNEL_MACHINE_INSTALL_DOS_PART 0x14
|
|
||||||
|
|
||||||
/* The offset of GRUB_INSTALL_BSD_PART. */
|
|
||||||
#define GRUB_KERNEL_MACHINE_INSTALL_BSD_PART 0x18
|
|
||||||
|
|
||||||
/* The offset of GRUB_PREFIX. */
|
|
||||||
#define GRUB_KERNEL_MACHINE_PREFIX 0x1c
|
|
||||||
|
|
||||||
/* End of the data section. */
|
|
||||||
#define GRUB_KERNEL_MACHINE_DATA_END 0x5c
|
|
||||||
|
|
||||||
/* The size of the first region which won't be compressed. */
|
|
||||||
#define GRUB_KERNEL_MACHINE_RAW_SIZE (GRUB_KERNEL_MACHINE_DATA_END + 0x5F0)
|
|
||||||
|
|
||||||
/* Enable LZMA compression */
|
/* Enable LZMA compression */
|
||||||
#define ENABLE_LZMA 1
|
#define ENABLE_LZMA 1
|
||||||
|
@ -63,10 +41,6 @@ extern grub_int32_t grub_install_dos_part;
|
||||||
/* The BSD partition number of the installed partition. */
|
/* The BSD partition number of the installed partition. */
|
||||||
extern grub_int32_t grub_install_bsd_part;
|
extern grub_int32_t grub_install_bsd_part;
|
||||||
|
|
||||||
/* The prefix which points to the directory where GRUB modules and its
|
|
||||||
configuration file are located. */
|
|
||||||
extern char grub_prefix[];
|
|
||||||
|
|
||||||
/* The boot BIOS drive number. */
|
/* The boot BIOS drive number. */
|
||||||
extern grub_uint8_t EXPORT_VAR(grub_boot_drive);
|
extern grub_uint8_t EXPORT_VAR(grub_boot_drive);
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
|
|
||||||
#include <grub/i386/memory.h>
|
#include <grub/i386/memory.h>
|
||||||
|
|
||||||
|
#include <grub/offsets.h>
|
||||||
|
|
||||||
/* The scratch buffer used in real mode code. */
|
/* The scratch buffer used in real mode code. */
|
||||||
#define GRUB_MEMORY_MACHINE_SCRATCH_ADDR 0x68000
|
#define GRUB_MEMORY_MACHINE_SCRATCH_ADDR 0x68000
|
||||||
#define GRUB_MEMORY_MACHINE_SCRATCH_SEG (GRUB_MEMORY_MACHINE_SCRATCH_ADDR >> 4)
|
#define GRUB_MEMORY_MACHINE_SCRATCH_SEG (GRUB_MEMORY_MACHINE_SCRATCH_ADDR >> 4)
|
||||||
|
@ -40,9 +42,6 @@
|
||||||
/* The size of the protect mode stack. */
|
/* The size of the protect mode stack. */
|
||||||
#define GRUB_MEMORY_MACHINE_PROT_STACK_SIZE 0x8000
|
#define GRUB_MEMORY_MACHINE_PROT_STACK_SIZE 0x8000
|
||||||
|
|
||||||
/* The upper memory area (starting at 640 kiB). */
|
|
||||||
#define GRUB_MEMORY_MACHINE_UPPER 0xa0000
|
|
||||||
|
|
||||||
/* The protected mode stack. */
|
/* The protected mode stack. */
|
||||||
#define GRUB_MEMORY_MACHINE_PROT_STACK \
|
#define GRUB_MEMORY_MACHINE_PROT_STACK \
|
||||||
(GRUB_MEMORY_MACHINE_SCRATCH_ADDR + GRUB_MEMORY_MACHINE_SCRATCH_SIZE \
|
(GRUB_MEMORY_MACHINE_SCRATCH_ADDR + GRUB_MEMORY_MACHINE_SCRATCH_SIZE \
|
||||||
|
|
|
@ -80,7 +80,7 @@ grub_pci_device_map_range (grub_pci_device_t dev __attribute__ ((unused)),
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
grub_pci_device_unmap_range (grub_pci_device_t dev __attribute__ ((unused)),
|
grub_pci_device_unmap_range (grub_pci_device_t dev __attribute__ ((unused)),
|
||||||
void *mem __attribute__ ((unused)),
|
volatile void *mem __attribute__ ((unused)),
|
||||||
grub_size_t size __attribute__ ((unused)))
|
grub_size_t size __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,7 +22,4 @@
|
||||||
/* The size of boot.img. */
|
/* The size of boot.img. */
|
||||||
#define GRUB_BOOT_MACHINE_SIZE (0x100000 - GRUB_BOOT_MACHINE_LINK_ADDR)
|
#define GRUB_BOOT_MACHINE_SIZE (0x100000 - GRUB_BOOT_MACHINE_LINK_ADDR)
|
||||||
|
|
||||||
/* The offset of GRUB_CORE_ENTRY_ADDR. */
|
|
||||||
#define GRUB_BOOT_MACHINE_CORE_ENTRY_ADDR 0x4
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -19,17 +19,7 @@
|
||||||
#ifndef GRUB_KERNEL_MACHINE_HEADER
|
#ifndef GRUB_KERNEL_MACHINE_HEADER
|
||||||
#define GRUB_KERNEL_MACHINE_HEADER 1
|
#define GRUB_KERNEL_MACHINE_HEADER 1
|
||||||
|
|
||||||
/* The offset of GRUB_CORE_ENTRY_ADDR. */
|
#include <grub/offsets.h>
|
||||||
#define GRUB_KERNEL_MACHINE_CORE_ENTRY_ADDR 0x8
|
|
||||||
|
|
||||||
/* The offset of GRUB_KERNEL_IMAGE_SIZE. */
|
|
||||||
#define GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE 0xc
|
|
||||||
|
|
||||||
/* The offset of GRUB_PREFIX. */
|
|
||||||
#define GRUB_KERNEL_MACHINE_PREFIX 0x10
|
|
||||||
|
|
||||||
/* End of the data section. */
|
|
||||||
#define GRUB_KERNEL_MACHINE_DATA_END 0x50
|
|
||||||
|
|
||||||
#ifndef ASM_FILE
|
#ifndef ASM_FILE
|
||||||
|
|
||||||
|
@ -44,10 +34,6 @@ extern grub_int32_t grub_kernel_image_size;
|
||||||
/* The total size of module images following the kernel. */
|
/* The total size of module images following the kernel. */
|
||||||
extern grub_int32_t grub_total_module_size;
|
extern grub_int32_t grub_total_module_size;
|
||||||
|
|
||||||
/* The prefix which points to the directory where GRUB modules and its
|
|
||||||
configuration file are located. */
|
|
||||||
extern char grub_prefix[];
|
|
||||||
|
|
||||||
#endif /* ! ASM_FILE */
|
#endif /* ! ASM_FILE */
|
||||||
|
|
||||||
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
|
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
|
||||||
|
|
|
@ -42,19 +42,33 @@ struct grub_module_header
|
||||||
/* "gmim" (GRUB Module Info Magic). */
|
/* "gmim" (GRUB Module Info Magic). */
|
||||||
#define GRUB_MODULE_MAGIC 0x676d696d
|
#define GRUB_MODULE_MAGIC 0x676d696d
|
||||||
|
|
||||||
struct grub_module_info
|
struct grub_module_info32
|
||||||
{
|
{
|
||||||
/* Magic number so we know we have modules present. */
|
/* Magic number so we know we have modules present. */
|
||||||
grub_uint32_t magic;
|
grub_uint32_t magic;
|
||||||
#if GRUB_TARGET_SIZEOF_VOID_P == 8
|
|
||||||
grub_uint32_t padding;
|
|
||||||
#endif
|
|
||||||
/* The offset of the modules. */
|
/* The offset of the modules. */
|
||||||
grub_target_off_t offset;
|
grub_uint32_t offset;
|
||||||
/* The size of all modules plus this header. */
|
/* The size of all modules plus this header. */
|
||||||
grub_target_size_t size;
|
grub_uint32_t size;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct grub_module_info64
|
||||||
|
{
|
||||||
|
/* Magic number so we know we have modules present. */
|
||||||
|
grub_uint32_t magic;
|
||||||
|
grub_uint32_t padding;
|
||||||
|
/* The offset of the modules. */
|
||||||
|
grub_uint64_t offset;
|
||||||
|
/* The size of all modules plus this header. */
|
||||||
|
grub_uint64_t size;
|
||||||
|
};
|
||||||
|
|
||||||
|
#if GRUB_TARGET_SIZEOF_VOID_P == 8
|
||||||
|
#define grub_module_info grub_module_info64
|
||||||
|
#else
|
||||||
|
#define grub_module_info grub_module_info32
|
||||||
|
#endif
|
||||||
|
|
||||||
extern grub_addr_t grub_arch_modules_addr (void);
|
extern grub_addr_t grub_arch_modules_addr (void);
|
||||||
|
|
||||||
extern void EXPORT_FUNC(grub_module_iterate) (int (*hook) (struct grub_module_header *));
|
extern void EXPORT_FUNC(grub_module_iterate) (int (*hook) (struct grub_module_header *));
|
||||||
|
@ -76,4 +90,8 @@ void grub_machine_set_prefix (void);
|
||||||
/* Register all the exported symbols. This is automatically generated. */
|
/* Register all the exported symbols. This is automatically generated. */
|
||||||
void grub_register_exported_symbols (void);
|
void grub_register_exported_symbols (void);
|
||||||
|
|
||||||
|
#if ! defined (ASM_FILE) && !defined (GRUB_MACHINE_EMU)
|
||||||
|
extern char grub_prefix[];
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif /* ! GRUB_KERNEL_HEADER */
|
#endif /* ! GRUB_KERNEL_HEADER */
|
||||||
|
|
|
@ -30,15 +30,10 @@ struct grub_list
|
||||||
};
|
};
|
||||||
typedef struct grub_list *grub_list_t;
|
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_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);
|
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,
|
#define FOR_LIST_ELEMENTS(var, list) for ((var) = (list); (var); (var) = (var)->next)
|
||||||
grub_list_test_t test);
|
|
||||||
|
|
||||||
static inline void *
|
static inline void *
|
||||||
grub_bad_type_cast_real (int line, const char *file)
|
grub_bad_type_cast_real (int line, const char *file)
|
||||||
|
|
|
@ -1,65 +0,0 @@
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2005,2006,2007,2008 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_KERNEL_CPU_HEADER
|
|
||||||
#define GRUB_KERNEL_CPU_HEADER 1
|
|
||||||
|
|
||||||
#define GRUB_MOD_ALIGN 0x1
|
|
||||||
/* Non-zero value is only needed for PowerMacs. */
|
|
||||||
#define GRUB_MOD_GAP 0x0
|
|
||||||
|
|
||||||
#define GRUB_KERNEL_MACHINE_LINK_ALIGN 32
|
|
||||||
|
|
||||||
#define GRUB_KERNEL_CPU_RAW_SIZE 0x200
|
|
||||||
#define GRUB_KERNEL_CPU_COMPRESSED_SIZE 0x8
|
|
||||||
#define GRUB_KERNEL_CPU_TOTAL_MODULE_SIZE 0xc
|
|
||||||
#define GRUB_KERNEL_CPU_KERNEL_IMAGE_SIZE 0x10
|
|
||||||
|
|
||||||
#define GRUB_KERNEL_CPU_PREFIX GRUB_KERNEL_CPU_RAW_SIZE
|
|
||||||
#define GRUB_KERNEL_CPU_DATA_END GRUB_KERNEL_CPU_RAW_SIZE + 0x48
|
|
||||||
|
|
||||||
#define GRUB_KERNEL_MACHINE_RAW_SIZE GRUB_KERNEL_CPU_RAW_SIZE
|
|
||||||
|
|
||||||
#define GRUB_KERNEL_MACHINE_PREFIX GRUB_KERNEL_CPU_PREFIX
|
|
||||||
#define GRUB_KERNEL_MACHINE_DATA_END GRUB_KERNEL_CPU_DATA_END
|
|
||||||
#define GRUB_KERNEL_MACHINE_KERNEL_IMAGE_SIZE GRUB_KERNEL_CPU_KERNEL_IMAGE_SIZE
|
|
||||||
#define GRUB_KERNEL_MACHINE_TOTAL_MODULE_SIZE GRUB_KERNEL_CPU_TOTAL_MODULE_SIZE
|
|
||||||
#define GRUB_KERNEL_MACHINE_COMPRESSED_SIZE GRUB_KERNEL_CPU_COMPRESSED_SIZE
|
|
||||||
|
|
||||||
#define GRUB_PLATFORM_IMAGE_FORMATS "raw, elf"
|
|
||||||
#define GRUB_PLATFORM_IMAGE_DEFAULT_FORMAT "raw"
|
|
||||||
|
|
||||||
#define GRUB_PLATFORM_IMAGE_DEFAULT GRUB_PLATFORM_IMAGE_RAW
|
|
||||||
|
|
||||||
#ifndef ASM_FILE
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
GRUB_PLATFORM_IMAGE_RAW,
|
|
||||||
GRUB_PLATFORM_IMAGE_ELF
|
|
||||||
}
|
|
||||||
grub_platform_image_format_t;
|
|
||||||
#define GRUB_PLATFORM_IMAGE_RAW GRUB_PLATFORM_IMAGE_RAW
|
|
||||||
#define GRUB_PLATFORM_IMAGE_ELF GRUB_PLATFORM_IMAGE_ELF
|
|
||||||
|
|
||||||
/* The prefix which points to the directory where GRUB modules and its
|
|
||||||
configuration file are located. */
|
|
||||||
extern char grub_prefix[];
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -27,10 +27,6 @@
|
||||||
void EXPORT_FUNC (grub_reboot) (void);
|
void EXPORT_FUNC (grub_reboot) (void);
|
||||||
void EXPORT_FUNC (grub_halt) (void);
|
void EXPORT_FUNC (grub_halt) (void);
|
||||||
|
|
||||||
/* The prefix which points to the directory where GRUB modules and its
|
|
||||||
configuration file are located. */
|
|
||||||
extern char grub_prefix[];
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
|
#endif /* ! GRUB_KERNEL_MACHINE_HEADER */
|
||||||
|
|
|
@ -20,7 +20,6 @@
|
||||||
#define GRUB_KERNEL_MACHINE_HEADER 1
|
#define GRUB_KERNEL_MACHINE_HEADER 1
|
||||||
|
|
||||||
#include <grub/symbol.h>
|
#include <grub/symbol.h>
|
||||||
#include <grub/cpu/kernel.h>
|
|
||||||
|
|
||||||
#ifndef ASM_FILE
|
#ifndef ASM_FILE
|
||||||
|
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue