now renamed

This commit is contained in:
locomiadev 2026-03-16 19:24:10 +02:00
parent cf69f6e32b
commit c53b43ee0f
1314 changed files with 106740 additions and 106740 deletions

282
.gitignore vendored
View File

@ -11,9 +11,9 @@ ahci_test
ascii.bitmaps ascii.bitmaps
ascii.h ascii.h
autom4te.cache autom4te.cache
build-grub-gen-asciih build-VasEBoot-gen-asciih
build-grub-gen-widthspec build-VasEBoot-gen-widthspec
build-grub-mkfont build-VasEBoot-mkfont
cdboot_test cdboot_test
cmp_test cmp_test
config.cache config.cache
@ -31,7 +31,7 @@ docs/*.info
docs/stamp-vti docs/stamp-vti
docs/version.texi docs/version.texi
ehci_test ehci_test
example_grub_script_test example_VasEBoot_script_test
example_scripted_test example_scripted_test
example_unit_test example_unit_test
*.exec *.exec
@ -43,101 +43,101 @@ gentrigtables
gentrigtables.exe gentrigtables.exe
gettext_strings_test gettext_strings_test
gpt_unit_test gpt_unit_test
grub-bin2h VasEBoot-bin2h
/grub-bios-setup /VasEBoot-bios-setup
/grub-bios-setup.exe /VasEBoot-bios-setup.exe
grub_cmd_date VasEBoot_cmd_date
grub_cmd_echo VasEBoot_cmd_echo
grub_cmd_regexp VasEBoot_cmd_regexp
grub_cmd_set_date VasEBoot_cmd_set_date
grub_cmd_sleep VasEBoot_cmd_sleep
/grub-editenv /VasEBoot-editenv
/grub-editenv.exe /VasEBoot-editenv.exe
grub-emu VasEBoot-emu
grub-emu-lite VasEBoot-emu-lite
grub-emu.exe VasEBoot-emu.exe
grub-emu-lite.exe VasEBoot-emu-lite.exe
grub_emu_init.c VasEBoot_emu_init.c
grub_emu_init.h VasEBoot_emu_init.h
/grub-file /VasEBoot-file
/grub-file.exe /VasEBoot-file.exe
grub-fstest VasEBoot-fstest
grub-fstest.exe VasEBoot-fstest.exe
grub_fstest_init.c VasEBoot_fstest_init.c
grub_fstest_init.h VasEBoot_fstest_init.h
grub_func_test VasEBoot_func_test
grub-install VasEBoot-install
grub-install.exe VasEBoot-install.exe
grub-kbdcomp VasEBoot-kbdcomp
/grub-macbless /VasEBoot-macbless
/grub-macbless.exe /VasEBoot-macbless.exe
grub-macho2img VasEBoot-macho2img
/grub-menulst2cfg /VasEBoot-menulst2cfg
/grub-menulst2cfg.exe /VasEBoot-menulst2cfg.exe
/grub-mk* /VasEBoot-mk*
grub-mount VasEBoot-mount
/grub-ofpathname /VasEBoot-ofpathname
/grub-ofpathname.exe /VasEBoot-ofpathname.exe
grub-core/build-grub-pe2elf.exe VasEBoot-core/build-VasEBoot-pe2elf.exe
/grub-probe /VasEBoot-probe
/grub-probe.exe /VasEBoot-probe.exe
grub_probe_init.c VasEBoot_probe_init.c
grub_probe_init.h VasEBoot_probe_init.h
/grub-reboot /VasEBoot-reboot
grub_script_blanklines VasEBoot_script_blanklines
grub_script_blockarg VasEBoot_script_blockarg
grub_script_break VasEBoot_script_break
grub-script-check VasEBoot-script-check
grub-script-check.exe VasEBoot-script-check.exe
grub_script_check_init.c VasEBoot_script_check_init.c
grub_script_check_init.h VasEBoot_script_check_init.h
grub_script_comments VasEBoot_script_comments
grub_script_continue VasEBoot_script_continue
grub_script_dollar VasEBoot_script_dollar
grub_script_echo1 VasEBoot_script_echo1
grub_script_echo_keywords VasEBoot_script_echo_keywords
grub_script_escape_comma VasEBoot_script_escape_comma
grub_script_eval VasEBoot_script_eval
grub_script_expansion VasEBoot_script_expansion
grub_script_final_semicolon VasEBoot_script_final_semicolon
grub_script_for1 VasEBoot_script_for1
grub_script_functions VasEBoot_script_functions
grub_script_gettext VasEBoot_script_gettext
grub_script_if VasEBoot_script_if
grub_script_leading_whitespace VasEBoot_script_leading_whitespace
grub_script_no_commands VasEBoot_script_no_commands
grub_script_not VasEBoot_script_not
grub_script_return VasEBoot_script_return
grub_script_setparams VasEBoot_script_setparams
grub_script_shift VasEBoot_script_shift
grub_script_strcmp VasEBoot_script_strcmp
grub_script_test VasEBoot_script_test
grub_script_vars1 VasEBoot_script_vars1
grub_script_while1 VasEBoot_script_while1
grub_script.tab.c VasEBoot_script.tab.c
grub_script.tab.h VasEBoot_script.tab.h
grub_script.yy.c VasEBoot_script.yy.c
grub_script.yy.h VasEBoot_script.yy.h
grub-set-default VasEBoot-set-default
grub_setup_init.c VasEBoot_setup_init.c
grub_setup_init.h VasEBoot_setup_init.h
grub-shell VasEBoot-shell
grub-shell-tester VasEBoot-shell-tester
grub-sparc64-setup VasEBoot-sparc64-setup
grub-sparc64-setup.exe VasEBoot-sparc64-setup.exe
/grub-syslinux2cfg /VasEBoot-syslinux2cfg
/grub-syslinux2cfg.exe /VasEBoot-syslinux2cfg.exe
gzcompress_test gzcompress_test
hddboot_test hddboot_test
help_test help_test
*.img *.img
*.image *.image
*.image.exe *.image.exe
include/grub/cpu include/VasEBoot/cpu
include/grub/machine include/VasEBoot/machine
install-sh install-sh
lib/libgcrypt-grub lib/libgcrypt-VasEBoot
libgrub_a_init.c libVasEBoot_a_init.c
*.log *.log
*.lst *.lst
lzocompress_test lzocompress_test
@ -155,7 +155,7 @@ pata_test
*.pf2 *.pf2
*.pp *.pp
po/*.mo po/*.mo
po/grub.pot po/VasEBoot.pot
po/POTFILES po/POTFILES
po/stamp-po po/stamp-po
printf_test printf_test
@ -169,7 +169,7 @@ symlist.h
trigtables.c trigtables.c
*.trs *.trs
uhci_test uhci_test
update-grub_lib update-VasEBoot_lib
unidata.c unidata.c
xzcompress_test xzcompress_test
Makefile.in Makefile.in
@ -181,48 +181,48 @@ compile
depcomp depcomp
mdate-sh mdate-sh
texinfo.tex texinfo.tex
grub-core/lib/libgcrypt-grub VasEBoot-core/lib/libgcrypt-VasEBoot
.deps .deps
.deps-util .deps-util
.deps-core .deps-core
.dirstamp .dirstamp
Makefile.util.am Makefile.util.am
contrib contrib
grub-core/bootinfo.txt VasEBoot-core/bootinfo.txt
grub-core/Makefile.core.am VasEBoot-core/Makefile.core.am
grub-core/Makefile.gcry.def VasEBoot-core/Makefile.gcry.def
grub-core/contrib VasEBoot-core/contrib
grub-core/gdb_grub VasEBoot-core/gdb_VasEBoot
grub-core/genmod.sh VasEBoot-core/genmod.sh
grub-core/gensyminfo.sh VasEBoot-core/gensyminfo.sh
grub-core/gmodule.pl VasEBoot-core/gmodule.pl
grub-core/grub.chrp VasEBoot-core/VasEBoot.chrp
grub-core/modinfo.sh VasEBoot-core/modinfo.sh
grub-core/*.module VasEBoot-core/*.module
grub-core/*.module.exe VasEBoot-core/*.module.exe
grub-core/*.pp VasEBoot-core/*.pp
grub-core/kernel.img.bin VasEBoot-core/kernel.img.bin
util/bash-completion.d/grub util/bash-completion.d/VasEBoot
grub-core/gnulib/alloca.h VasEBoot-core/gnulib/alloca.h
grub-core/gnulib/arg-nonnull.h VasEBoot-core/gnulib/arg-nonnull.h
grub-core/gnulib/c++defs.h VasEBoot-core/gnulib/c++defs.h
grub-core/gnulib/charset.alias VasEBoot-core/gnulib/charset.alias
grub-core/gnulib/configmake.h VasEBoot-core/gnulib/configmake.h
grub-core/gnulib/float.h VasEBoot-core/gnulib/float.h
grub-core/gnulib/getopt.h VasEBoot-core/gnulib/getopt.h
grub-core/gnulib/langinfo.h VasEBoot-core/gnulib/langinfo.h
grub-core/gnulib/ref-add.sed VasEBoot-core/gnulib/ref-add.sed
grub-core/gnulib/ref-del.sed VasEBoot-core/gnulib/ref-del.sed
grub-core/gnulib/stdio.h VasEBoot-core/gnulib/stdio.h
grub-core/gnulib/stdlib.h VasEBoot-core/gnulib/stdlib.h
grub-core/gnulib/string.h VasEBoot-core/gnulib/string.h
grub-core/gnulib/strings.h VasEBoot-core/gnulib/strings.h
grub-core/gnulib/sys VasEBoot-core/gnulib/sys
grub-core/gnulib/unistd.h VasEBoot-core/gnulib/unistd.h
grub-core/gnulib/warn-on-use.h VasEBoot-core/gnulib/warn-on-use.h
grub-core/gnulib/wchar.h VasEBoot-core/gnulib/wchar.h
grub-core/gnulib/wctype.h VasEBoot-core/gnulib/wctype.h
grub-core/rs_decoder.h VasEBoot-core/rs_decoder.h
widthspec.bin widthspec.bin
widthspec.h widthspec.h
docs/stamp-1 docs/stamp-1
@ -232,19 +232,19 @@ po/*.po
po/*.gmo po/*.gmo
po/LINGUAS po/LINGUAS
po/remove-potcdate.sed po/remove-potcdate.sed
include/grub/gcrypt/gcrypt.h include/VasEBoot/gcrypt/gcrypt.h
include/grub/gcrypt/g10lib.h include/VasEBoot/gcrypt/g10lib.h
po/POTFILES.in po/POTFILES.in
po/POTFILES-shell.in po/POTFILES-shell.in
/grub-glue-efi /VasEBoot-glue-efi
/grub-render-label /VasEBoot-render-label
/grub-glue-efi.exe /VasEBoot-glue-efi.exe
/grub-render-label.exe /VasEBoot-render-label.exe
grub-core/gnulib/locale.h VasEBoot-core/gnulib/locale.h
grub-core/gnulib/unitypes.h VasEBoot-core/gnulib/unitypes.h
grub-core/gnulib/uniwidth.h VasEBoot-core/gnulib/uniwidth.h
build-aux/test-driver build-aux/test-driver
/garbage-gen /garbage-gen
/garbage-gen.exe /garbage-gen.exe
/grub-fs-tester /VasEBoot-fs-tester
grub-core/build-grub-module-verifier VasEBoot-core/build-VasEBoot-module-verifier

View File

@ -6,7 +6,7 @@ Yoshinori K. Okuji designed and implemented the initial version.
Jeroen Dekkers added initrd support, Multiboot support, and fixed bugs Jeroen Dekkers added initrd support, Multiboot support, and fixed bugs
in ext2fs. in ext2fs.
Marco Gerards added ext2fs support, grub-emu, a new command-line Marco Gerards added ext2fs support, VasEBoot-emu, a new command-line
engine, and fixed many bugs. engine, and fixed many bugs.
Omniflux added terminfo and serial support. Omniflux added terminfo and serial support.

2
BUGS
View File

@ -1,4 +1,4 @@
GRUB team is aware of following problems: VasEBoot team is aware of following problems:
- Currently search and assembling multidevice abstractions scans - Currently search and assembling multidevice abstractions scans
all the devices which can be slow. all the devices which can be slow.
- Cache isn't used correctly for video which results in slowness. - Cache isn't used correctly for video which results in slowness.

File diff suppressed because it is too large Load Diff

36
INSTALL
View File

@ -1,15 +1,15 @@
-*- Text -*- -*- Text -*-
This is the GRUB. Welcome. This is the VasEBoot. Welcome.
This file contains instructions for compiling and installing the GRUB. This file contains instructions for compiling and installing the VasEBoot.
The Requirements The Requirements
================ ================
GRUB depends on some software packages installed into your system. If VasEBoot depends on some software packages installed into your system. If
you don't have any of them, please obtain and install them before you don't have any of them, please obtain and install them before
configuring the GRUB. configuring the VasEBoot.
* GCC 4.1.3 or later * GCC 4.1.3 or later
Note: older versions may work but support is limited Note: older versions may work but support is limited
@ -30,7 +30,7 @@ configuring the GRUB.
earlier versions not tested earlier versions not tested
Note: clang 3.5 or later works for sparc64 Note: clang 3.5 or later works for sparc64
earlier versions return "error: unable to interface with target machine" earlier versions return "error: unable to interface with target machine"
Note: clang has no support for ia64 and hence you can't compile GRUB Note: clang has no support for ia64 and hence you can't compile VasEBoot
for ia64 with clang for ia64 with clang
* GNU Make * GNU Make
* GNU Bison 2.3 or later * GNU Bison 2.3 or later
@ -44,18 +44,18 @@ On GNU/Linux, you also need:
* libdevmapper 1.02.34 or later (recommended) * libdevmapper 1.02.34 or later (recommended)
For optional grub-emu features, you need: For optional VasEBoot-emu features, you need:
* SDL (recommended) * SDL (recommended)
* libpciaccess (optional) * libpciaccess (optional)
* libusb (optional) * libusb (optional)
To build GRUB's graphical terminal (gfxterm), you need: To build VasEBoot's graphical terminal (gfxterm), you need:
* FreeType 2 or later * FreeType 2 or later
* GNU Unifont * 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 VasEBoot you may
need the following. need the following.
* Python 2.6 or later * Python 2.6 or later
@ -65,9 +65,9 @@ need the following.
Prerequisites for make-check: Prerequisites for make-check:
* qemu, specifically the binary 'qemu-system-i386' * qemu, specifically the binary 'qemu-system-i386'
* xorriso 1.2.9 or later, for grub-mkrescue and grub-shell * xorriso 1.2.9 or later, for VasEBoot-mkrescue and VasEBoot-shell
Configuring the GRUB Configuring the VasEBoot
==================== ====================
The `configure' shell script attempts to guess correct values for The `configure' shell script attempts to guess correct values for
@ -91,7 +91,7 @@ called `autoconf'. You only need `configure.in' if you want to change
it or regenerate `configure' using a newer version of `autoconf'. it or regenerate `configure' using a newer version of `autoconf'.
Building the GRUB Building the VasEBoot
================= =================
The simplest way to compile this package is: The simplest way to compile this package is:
@ -131,16 +131,16 @@ The simplest way to compile this package is:
all sorts of other programs in order to regenerate files that came all sorts of other programs in order to regenerate files that came
with the distribution. with the distribution.
Cross-compiling the GRUB Cross-compiling the VasEBoot
======================== ========================
GRUB defines 3 platforms: VasEBoot defines 3 platforms:
- "Build" is the one which build systems runs on. - "Build" is the one which build systems runs on.
- "Host" is where you execute GRUB utils. - "Host" is where you execute VasEBoot utils.
- "Target" is where GRUB itself runs. - "Target" is where VasEBoot itself runs.
For grub-emu host and target must be the same but may differ from build. For VasEBoot-emu host and target must be the same but may differ from build.
If build and host are different make check isn't available. If build and host are different make check isn't available.
@ -247,10 +247,10 @@ If the package supports it, you can cause programs to be installed
with an extra prefix or suffix on their names by giving `configure' with an extra prefix or suffix on their names by giving `configure'
the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'. the option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
Please note, however, that the GRUB knows where it is located in the Please note, however, that the VasEBoot knows where it is located in the
filesystem. If you have installed it in an unusual location, the filesystem. If you have installed it in an unusual location, the
system might not work properly, or at all. The chief utility of these system might not work properly, or at all. The chief utility of these
options for the GRUB is to allow you to "install" in some alternate options for the VasEBoot is to allow you to "install" in some alternate
location, and then copy these to the actual root filesystem later. location, and then copy these to the actual root filesystem later.

View File

@ -1,9 +1,9 @@
AUTOMAKE_OPTIONS = subdir-objects -Wno-portability AUTOMAKE_OPTIONS = subdir-objects -Wno-portability
DEPDIR = .deps-util DEPDIR = .deps-util
SUBDIRS = grub-core/gnulib . SUBDIRS = VasEBoot-core/gnulib .
if COND_real_platform if COND_real_platform
SUBDIRS += grub-core SUBDIRS += VasEBoot-core
endif endif
SUBDIRS += po docs util/bash-completion.d SUBDIRS += po docs util/bash-completion.d
@ -25,44 +25,44 @@ CCASFLAGS_PROGRAM += $(CCASFLAGS_GNULIB)
include $(srcdir)/Makefile.util.am include $(srcdir)/Makefile.util.am
# XXX Use Automake's LEX & YACC support # XXX Use Automake's LEX & YACC support
grub_script.tab.h: $(top_srcdir)/grub-core/script/parser.y VasEBoot_script.tab.h: $(top_srcdir)/VasEBoot-core/script/parser.y
$(YACC) -d -p grub_script_yy -b grub_script $(top_srcdir)/grub-core/script/parser.y $(YACC) -d -p VasEBoot_script_yy -b VasEBoot_script $(top_srcdir)/VasEBoot-core/script/parser.y
grub_script.tab.c: grub_script.tab.h VasEBoot_script.tab.c: VasEBoot_script.tab.h
CLEANFILES += grub_script.tab.c grub_script.tab.h CLEANFILES += VasEBoot_script.tab.c VasEBoot_script.tab.h
# For the lexer. # For the lexer.
grub_script.yy.h: $(top_srcdir)/grub-core/script/yylex.l VasEBoot_script.yy.h: $(top_srcdir)/VasEBoot-core/script/yylex.l
$(LEX) -o grub_script.yy.c --header-file=grub_script.yy.h $(top_srcdir)/grub-core/script/yylex.l $(LEX) -o VasEBoot_script.yy.c --header-file=VasEBoot_script.yy.h $(top_srcdir)/VasEBoot-core/script/yylex.l
grub_script.yy.c: grub_script.yy.h VasEBoot_script.yy.c: VasEBoot_script.yy.h
CLEANFILES += grub_script.yy.c grub_script.yy.h CLEANFILES += VasEBoot_script.yy.c VasEBoot_script.yy.h
# For libgrub.a # For libVasEBoot.a
libgrub.pp: grub_script.tab.h grub_script.yy.h $(libgrubmods_a_SOURCES) $(libgrubkern_a_SOURCES) libVasEBoot.pp: VasEBoot_script.tab.h VasEBoot_script.yy.h $(libVasEBootmods_a_SOURCES) $(libVasEBootkern_a_SOURCES)
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgrubmods_a_CPPFLAGS) $(libgrubkern_a_CPPFLAGS) $(CPPFLAGS) \ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libVasEBootmods_a_CPPFLAGS) $(libVasEBootkern_a_CPPFLAGS) $(CPPFLAGS) \
-D'GRUB_MOD_INIT(x)=@MARKER@x@' $^ > $@ || (rm -f $@; exit 1) -D'VasEBoot_MOD_INIT(x)=@MARKER@x@' $^ > $@ || (rm -f $@; exit 1)
CLEANFILES += libgrub.pp CLEANFILES += libVasEBoot.pp
libgrub_a_init.lst: libgrub.pp libVasEBoot_a_init.lst: libVasEBoot.pp
cat $< | grep '@MARKER@' | sed 's/@MARKER@\(.*\)@/\1/g' | sort -u > $@ || (rm -f $@; exit 1) cat $< | grep '@MARKER@' | sed 's/@MARKER@\(.*\)@/\1/g' | sort -u > $@ || (rm -f $@; exit 1)
CLEANFILES += libgrub_a_init.lst CLEANFILES += libVasEBoot_a_init.lst
libgrub_a_init.c: libgrub_a_init.lst $(top_srcdir)/geninit.sh libVasEBoot_a_init.c: libVasEBoot_a_init.lst $(top_srcdir)/geninit.sh
sh $(top_srcdir)/geninit.sh `cat $<` > $@ || (rm -f $@; exit 1) sh $(top_srcdir)/geninit.sh `cat $<` > $@ || (rm -f $@; exit 1)
CLEANFILES += libgrub_a_init.c CLEANFILES += libVasEBoot_a_init.c
# For grub-fstest # For VasEBoot-fstest
grub_fstest.pp: $(grub_fstest_SOURCES) VasEBoot_fstest.pp: $(VasEBoot_fstest_SOURCES)
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_fstest_CPPFLAGS) $(CPPFLAGS) \ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(VasEBoot_fstest_CPPFLAGS) $(CPPFLAGS) \
-D'GRUB_MOD_INIT(x)=@MARKER@x@' $^ > $@ || (rm -f $@; exit 1) -D'VasEBoot_MOD_INIT(x)=@MARKER@x@' $^ > $@ || (rm -f $@; exit 1)
CLEANFILES += grub_fstest.pp CLEANFILES += VasEBoot_fstest.pp
grub_fstest_init.lst: libgrub.pp grub_fstest.pp VasEBoot_fstest_init.lst: libVasEBoot.pp VasEBoot_fstest.pp
cat $^ | grep '@MARKER@' | sed 's/@MARKER@\(.*\)@/\1/g' | sort -u > $@ || (rm -f $@; exit 1) cat $^ | grep '@MARKER@' | sed 's/@MARKER@\(.*\)@/\1/g' | sort -u > $@ || (rm -f $@; exit 1)
CLEANFILES += grub_fstest_init.lst CLEANFILES += VasEBoot_fstest_init.lst
grub_fstest_init.c: grub_fstest_init.lst $(top_srcdir)/geninit.sh VasEBoot_fstest_init.c: VasEBoot_fstest_init.lst $(top_srcdir)/geninit.sh
sh $(top_srcdir)/geninit.sh `cat $<` > $@ || (rm -f $@; exit 1) sh $(top_srcdir)/geninit.sh `cat $<` > $@ || (rm -f $@; exit 1)
CLEANFILES += grub_fstest_init.c CLEANFILES += VasEBoot_fstest_init.c
if COND_HAVE_FONT_SOURCE if COND_HAVE_FONT_SOURCE
pkgdata_DATA += unicode.pf2 ascii.pf2 euro.pf2 ascii.h widthspec.h pkgdata_DATA += unicode.pf2 ascii.pf2 euro.pf2 ascii.h widthspec.h
@ -70,39 +70,39 @@ endif
starfield_theme_files = $(srcdir)/themes/starfield/blob_w.png $(srcdir)/themes/starfield/boot_menu_c.png $(srcdir)/themes/starfield/boot_menu_e.png $(srcdir)/themes/starfield/boot_menu_ne.png $(srcdir)/themes/starfield/boot_menu_n.png $(srcdir)/themes/starfield/boot_menu_nw.png $(srcdir)/themes/starfield/boot_menu_se.png $(srcdir)/themes/starfield/boot_menu_s.png $(srcdir)/themes/starfield/boot_menu_sw.png $(srcdir)/themes/starfield/boot_menu_w.png $(srcdir)/themes/starfield/slider_c.png $(srcdir)/themes/starfield/slider_n.png $(srcdir)/themes/starfield/slider_s.png $(srcdir)/themes/starfield/starfield.png $(srcdir)/themes/starfield/terminal_box_c.png $(srcdir)/themes/starfield/terminal_box_e.png $(srcdir)/themes/starfield/terminal_box_ne.png $(srcdir)/themes/starfield/terminal_box_n.png $(srcdir)/themes/starfield/terminal_box_nw.png $(srcdir)/themes/starfield/terminal_box_se.png $(srcdir)/themes/starfield/terminal_box_s.png $(srcdir)/themes/starfield/terminal_box_sw.png $(srcdir)/themes/starfield/terminal_box_w.png $(srcdir)/themes/starfield/theme.txt $(srcdir)/themes/starfield/README $(srcdir)/themes/starfield/COPYING.CC-BY-SA-3.0 starfield_theme_files = $(srcdir)/themes/starfield/blob_w.png $(srcdir)/themes/starfield/boot_menu_c.png $(srcdir)/themes/starfield/boot_menu_e.png $(srcdir)/themes/starfield/boot_menu_ne.png $(srcdir)/themes/starfield/boot_menu_n.png $(srcdir)/themes/starfield/boot_menu_nw.png $(srcdir)/themes/starfield/boot_menu_se.png $(srcdir)/themes/starfield/boot_menu_s.png $(srcdir)/themes/starfield/boot_menu_sw.png $(srcdir)/themes/starfield/boot_menu_w.png $(srcdir)/themes/starfield/slider_c.png $(srcdir)/themes/starfield/slider_n.png $(srcdir)/themes/starfield/slider_s.png $(srcdir)/themes/starfield/starfield.png $(srcdir)/themes/starfield/terminal_box_c.png $(srcdir)/themes/starfield/terminal_box_e.png $(srcdir)/themes/starfield/terminal_box_ne.png $(srcdir)/themes/starfield/terminal_box_n.png $(srcdir)/themes/starfield/terminal_box_nw.png $(srcdir)/themes/starfield/terminal_box_se.png $(srcdir)/themes/starfield/terminal_box_s.png $(srcdir)/themes/starfield/terminal_box_sw.png $(srcdir)/themes/starfield/terminal_box_w.png $(srcdir)/themes/starfield/theme.txt $(srcdir)/themes/starfield/README $(srcdir)/themes/starfield/COPYING.CC-BY-SA-3.0
build-grub-mkfont$(BUILD_EXEEXT): util/grub-mkfont.c grub-core/unidata.c grub-core/kern/emu/misc.c util/misc.c build-VasEBoot-mkfont$(BUILD_EXEEXT): util/VasEBoot-mkfont.c VasEBoot-core/unidata.c VasEBoot-core/kern/emu/misc.c util/misc.c
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-mkfont\" $^ $(build_freetype_cflags) $(build_freetype_libs) $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DVasEBoot_MKFONT=1 -DVasEBoot_BUILD=1 -DVasEBoot_UTIL=1 -DVasEBoot_BUILD_PROGRAM_NAME=\"build-VasEBoot-mkfont\" $^ $(build_freetype_cflags) $(build_freetype_libs)
CLEANFILES += build-grub-mkfont$(BUILD_EXEEXT) CLEANFILES += build-VasEBoot-mkfont$(BUILD_EXEEXT)
garbage-gen$(BUILD_EXEEXT): util/garbage-gen.c garbage-gen$(BUILD_EXEEXT): util/garbage-gen.c
$(BUILD_CC) -o $@ $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) $^ $(BUILD_CC) -o $@ $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) $^
CLEANFILES += garbage-gen$(BUILD_EXEEXT) CLEANFILES += garbage-gen$(BUILD_EXEEXT)
EXTRA_DIST += util/garbage-gen.c EXTRA_DIST += util/garbage-gen.c
build-grub-gen-asciih$(BUILD_EXEEXT): util/grub-gen-asciih.c build-VasEBoot-gen-asciih$(BUILD_EXEEXT): util/VasEBoot-gen-asciih.c
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DVasEBoot_MKFONT=1 -DVasEBoot_BUILD=1 -DVasEBoot_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
CLEANFILES += build-grub-gen-asciih$(BUILD_EXEEXT) CLEANFILES += build-VasEBoot-gen-asciih$(BUILD_EXEEXT)
build-grub-gen-widthspec$(BUILD_EXEEXT): util/grub-gen-widthspec.c build-VasEBoot-gen-widthspec$(BUILD_EXEEXT): util/VasEBoot-gen-widthspec.c
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_MKFONT=1 -DGRUB_BUILD=1 -DGRUB_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DVasEBoot_MKFONT=1 -DVasEBoot_BUILD=1 -DVasEBoot_UTIL=1 $^ $(build_freetype_cflags) $(build_freetype_libs) -Wall -Werror
CLEANFILES += build-grub-gen-widthspec$(BUILD_EXEEXT) CLEANFILES += build-VasEBoot-gen-widthspec$(BUILD_EXEEXT)
if COND_STARFIELD if COND_STARFIELD
starfield_DATA = dejavu_10.pf2 dejavu_12.pf2 dejavu_bold_14.pf2 dejavu_14.pf2 dejavu_16.pf2 $(starfield_theme_files) starfield_DATA = dejavu_10.pf2 dejavu_12.pf2 dejavu_bold_14.pf2 dejavu_14.pf2 dejavu_16.pf2 $(starfield_theme_files)
dejavu_10.pf2: $(DJVU_FONT_SOURCE) build-grub-mkfont$(BUILD_EXEEXT) dejavu_10.pf2: $(DJVU_FONT_SOURCE) build-VasEBoot-mkfont$(BUILD_EXEEXT)
./build-grub-mkfont$(BUILD_EXEEXT) -s 10 -o $@ $(DJVU_FONT_SOURCE) ./build-VasEBoot-mkfont$(BUILD_EXEEXT) -s 10 -o $@ $(DJVU_FONT_SOURCE)
CLEANFILES += dejavu_10.pf2 CLEANFILES += dejavu_10.pf2
dejavu_12.pf2: $(DJVU_FONT_SOURCE) build-grub-mkfont$(BUILD_EXEEXT) dejavu_12.pf2: $(DJVU_FONT_SOURCE) build-VasEBoot-mkfont$(BUILD_EXEEXT)
./build-grub-mkfont$(BUILD_EXEEXT) -s 12 -o $@ $(DJVU_FONT_SOURCE) ./build-VasEBoot-mkfont$(BUILD_EXEEXT) -s 12 -o $@ $(DJVU_FONT_SOURCE)
CLEANFILES += dejavu_12.pf2 CLEANFILES += dejavu_12.pf2
dejavu_14.pf2: $(DJVU_FONT_SOURCE) build-grub-mkfont$(BUILD_EXEEXT) dejavu_14.pf2: $(DJVU_FONT_SOURCE) build-VasEBoot-mkfont$(BUILD_EXEEXT)
./build-grub-mkfont$(BUILD_EXEEXT) -s 14 -o $@ $(DJVU_FONT_SOURCE) ./build-VasEBoot-mkfont$(BUILD_EXEEXT) -s 14 -o $@ $(DJVU_FONT_SOURCE)
CLEANFILES += dejavu_14.pf2 CLEANFILES += dejavu_14.pf2
dejavu_bold_14.pf2: $(DJVU_FONT_SOURCE) build-grub-mkfont$(BUILD_EXEEXT) dejavu_bold_14.pf2: $(DJVU_FONT_SOURCE) build-VasEBoot-mkfont$(BUILD_EXEEXT)
./build-grub-mkfont$(BUILD_EXEEXT) -b -s 14 -o $@ $(DJVU_FONT_SOURCE) ./build-VasEBoot-mkfont$(BUILD_EXEEXT) -b -s 14 -o $@ $(DJVU_FONT_SOURCE)
CLEANFILES += dejavu_bold_14.pf2 CLEANFILES += dejavu_bold_14.pf2
dejavu_16.pf2: $(DJVU_FONT_SOURCE) build-grub-mkfont$(BUILD_EXEEXT) dejavu_16.pf2: $(DJVU_FONT_SOURCE) build-VasEBoot-mkfont$(BUILD_EXEEXT)
./build-grub-mkfont$(BUILD_EXEEXT) -s 16 -o $@ $(DJVU_FONT_SOURCE) ./build-VasEBoot-mkfont$(BUILD_EXEEXT) -s 16 -o $@ $(DJVU_FONT_SOURCE)
CLEANFILES += dejavu_16.pf2 CLEANFILES += dejavu_16.pf2
else else
starfield_DATA = starfield_DATA =
@ -111,34 +111,34 @@ endif
EXTRA_DIST += $(starfield_theme_files) EXTRA_DIST += $(starfield_theme_files)
EXTRA_DIST += $(srcdir)/themes/starfield/src/slider_s.xcf $(srcdir)/themes/starfield/src/slider_n.xcf $(srcdir)/themes/starfield/src/slider_c.xcf $(srcdir)/themes/starfield/src/blob_nw.xcf $(srcdir)/themes/starfield/src/bootmenu/center.xcf $(srcdir)/themes/starfield/src/bootmenu/corner.xcf $(srcdir)/themes/starfield/src/bootmenu/side.xcf $(srcdir)/themes/starfield/src/terminalbox/side.xcf $(srcdir)/themes/starfield/src/terminalbox/corner.xcf $(srcdir)/themes/starfield/src/terminalbox/center.xcf EXTRA_DIST += $(srcdir)/themes/starfield/src/slider_s.xcf $(srcdir)/themes/starfield/src/slider_n.xcf $(srcdir)/themes/starfield/src/slider_c.xcf $(srcdir)/themes/starfield/src/blob_nw.xcf $(srcdir)/themes/starfield/src/bootmenu/center.xcf $(srcdir)/themes/starfield/src/bootmenu/corner.xcf $(srcdir)/themes/starfield/src/bootmenu/side.xcf $(srcdir)/themes/starfield/src/terminalbox/side.xcf $(srcdir)/themes/starfield/src/terminalbox/corner.xcf $(srcdir)/themes/starfield/src/terminalbox/center.xcf
unicode.pf2: $(FONT_SOURCE) build-grub-mkfont$(BUILD_EXEEXT) unicode.pf2: $(FONT_SOURCE) build-VasEBoot-mkfont$(BUILD_EXEEXT)
./build-grub-mkfont$(BUILD_EXEEXT) -o $@ $(FONT_SOURCE) || (rm -f $@; exit 1) ./build-VasEBoot-mkfont$(BUILD_EXEEXT) -o $@ $(FONT_SOURCE) || (rm -f $@; exit 1)
CLEANFILES += unicode.pf2 CLEANFILES += unicode.pf2
# Arrows and lines are needed to draw the menu, so always include them # Arrows and lines are needed to draw the menu, so always include them
UNICODE_ARROWS=0x2190-0x2193 UNICODE_ARROWS=0x2190-0x2193
UNICODE_LINES=0x2501-0x251B UNICODE_LINES=0x2501-0x251B
ascii.pf2: $(FONT_SOURCE) build-grub-mkfont$(BUILD_EXEEXT) ascii.pf2: $(FONT_SOURCE) build-VasEBoot-mkfont$(BUILD_EXEEXT)
./build-grub-mkfont$(BUILD_EXEEXT) -o $@ $(FONT_SOURCE) -r 0x0-0x7f,$(UNICODE_ARROWS),$(UNICODE_LINES) || (rm -f $@; exit 1) ./build-VasEBoot-mkfont$(BUILD_EXEEXT) -o $@ $(FONT_SOURCE) -r 0x0-0x7f,$(UNICODE_ARROWS),$(UNICODE_LINES) || (rm -f $@; exit 1)
CLEANFILES += ascii.pf2 CLEANFILES += ascii.pf2
euro.pf2: $(FONT_SOURCE) build-grub-mkfont$(BUILD_EXEEXT) euro.pf2: $(FONT_SOURCE) build-VasEBoot-mkfont$(BUILD_EXEEXT)
./build-grub-mkfont$(BUILD_EXEEXT) -o $@ $(FONT_SOURCE) -r 0x0-0x4ff,0x1e00-0x1fff,$(UNICODE_ARROWS),$(UNICODE_LINES) || (rm -f $@; exit 1) ./build-VasEBoot-mkfont$(BUILD_EXEEXT) -o $@ $(FONT_SOURCE) -r 0x0-0x4ff,0x1e00-0x1fff,$(UNICODE_ARROWS),$(UNICODE_LINES) || (rm -f $@; exit 1)
CLEANFILES += euro.pf2 CLEANFILES += euro.pf2
ascii.h: $(FONT_SOURCE) build-grub-gen-asciih$(BUILD_EXEEXT) ascii.h: $(FONT_SOURCE) build-VasEBoot-gen-asciih$(BUILD_EXEEXT)
./build-grub-gen-asciih$(BUILD_EXEEXT) $(FONT_SOURCE) $@ || (rm -f $@; exit 1) ./build-VasEBoot-gen-asciih$(BUILD_EXEEXT) $(FONT_SOURCE) $@ || (rm -f $@; exit 1)
CLEANFILES += ascii.h CLEANFILES += ascii.h
widthspec.h: $(FONT_SOURCE) build-grub-gen-widthspec$(BUILD_EXEEXT) widthspec.h: $(FONT_SOURCE) build-VasEBoot-gen-widthspec$(BUILD_EXEEXT)
./build-grub-gen-widthspec$(BUILD_EXEEXT) $(FONT_SOURCE) $@ || (rm -f $@; exit 1) ./build-VasEBoot-gen-widthspec$(BUILD_EXEEXT) $(FONT_SOURCE) $@ || (rm -f $@; exit 1)
CLEANFILES += widthspec.h CLEANFILES += widthspec.h
# Install config.h into platformdir # Install config.h into platformdir
nodist_platform_HEADERS = config.h nodist_platform_HEADERS = config.h
pkgdata_DATA += grub-mkconfig_lib pkgdata_DATA += VasEBoot-mkconfig_lib
if COND_real_platform if COND_real_platform
@ -178,64 +178,64 @@ QEMU32=qemu-system-x86_64
MINIMUM_CPU_LINUX=core2duo MINIMUM_CPU_LINUX=core2duo
endif endif
linux.init.x86_64: $(srcdir)/grub-core/tests/boot/linux.init-x86_64.S $(srcdir)/grub-core/tests/boot/qemu-shutdown-x86.S linux.init.x86_64: $(srcdir)/VasEBoot-core/tests/boot/linux.init-x86_64.S $(srcdir)/VasEBoot-core/tests/boot/qemu-shutdown-x86.S
$(TARGET_CC) -o $@ $< -static -m64 -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" $(TARGET_CC) -o $@ $< -static -m64 -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\"
linux.init.i386: $(srcdir)/grub-core/tests/boot/linux.init-i386.S $(srcdir)/grub-core/tests/boot/qemu-shutdown-x86.S linux.init.i386: $(srcdir)/VasEBoot-core/tests/boot/linux.init-i386.S $(srcdir)/VasEBoot-core/tests/boot/qemu-shutdown-x86.S
$(TARGET_CC) -o $@ $< -static -m32 -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" $(TARGET_CC) -o $@ $< -static -m32 -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\"
linux.init.mips: $(srcdir)/grub-core/tests/boot/linux.init-mips.S linux.init.mips: $(srcdir)/VasEBoot-core/tests/boot/linux.init-mips.S
$(TARGET_CC) -o $@ $< -static -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" $(TARGET_CC) -o $@ $< -static -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\"
linux.init.ppc: $(srcdir)/grub-core/tests/boot/linux.init-ppc.S linux.init.ppc: $(srcdir)/VasEBoot-core/tests/boot/linux.init-ppc.S
$(TARGET_CC) -o $@ $< -static -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" $(TARGET_CC) -o $@ $< -static -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\"
linux.init.mipsel: $(srcdir)/grub-core/tests/boot/linux.init-mips.S linux.init.mipsel: $(srcdir)/VasEBoot-core/tests/boot/linux.init-mips.S
$(TARGET_CC) -o $@ $< -static -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" $(TARGET_CC) -o $@ $< -static -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\"
linux.init.loongson: $(srcdir)/grub-core/tests/boot/linux.init-mips.S linux.init.loongson: $(srcdir)/VasEBoot-core/tests/boot/linux.init-mips.S
$(TARGET_CC) -o $@ $< -static -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -DREBOOT=1 $(TARGET_CC) -o $@ $< -static -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -DREBOOT=1
multiboot.elf: $(srcdir)/grub-core/tests/boot/kernel-i386.S $(srcdir)/grub-core/tests/boot/qemu-shutdown-x86.S multiboot.elf: $(srcdir)/VasEBoot-core/tests/boot/kernel-i386.S $(srcdir)/VasEBoot-core/tests/boot/qemu-shutdown-x86.S
$(TARGET_CC) -o $@ $< -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -static -ffreestanding -nostdlib -nostdinc -DTARGET_MULTIBOOT=1 -Wl,--build-id=none -Wl,-N -Wl,-Ttext,0x100000 -m32 -I$(srcdir)/include $(TARGET_CC) -o $@ $< -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -static -ffreestanding -nostdlib -nostdinc -DTARGET_MULTIBOOT=1 -Wl,--build-id=none -Wl,-N -Wl,-Ttext,0x100000 -m32 -I$(srcdir)/include
kfreebsd.elf: $(srcdir)/grub-core/tests/boot/kernel-i386.S $(srcdir)/grub-core/tests/boot/qemu-shutdown-x86.S kfreebsd.elf: $(srcdir)/VasEBoot-core/tests/boot/kernel-i386.S $(srcdir)/VasEBoot-core/tests/boot/qemu-shutdown-x86.S
$(TARGET_CC) -o $@ $< -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -static -ffreestanding -nostdlib -nostdinc -Wl,--build-id=none -Wl,-N -Wl,-Ttext,0x100000 -m32 -I$(srcdir)/include $(TARGET_CC) -o $@ $< -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -static -ffreestanding -nostdlib -nostdinc -Wl,--build-id=none -Wl,-N -Wl,-Ttext,0x100000 -m32 -I$(srcdir)/include
kfreebsd.aout: kfreebsd.elf kfreebsd.aout: kfreebsd.elf
$(TARGET_OBJCOPY) -O a.out-i386-linux $< $@ -j .text $(TARGET_OBJCOPY) -O a.out-i386-linux $< $@ -j .text
pc-chainloader.elf: $(srcdir)/grub-core/tests/boot/kernel-8086.S $(srcdir)/grub-core/tests/boot/qemu-shutdown-x86.S pc-chainloader.elf: $(srcdir)/VasEBoot-core/tests/boot/kernel-8086.S $(srcdir)/VasEBoot-core/tests/boot/qemu-shutdown-x86.S
$(TARGET_CC) -o $@ $< -static -DTARGET_CHAINLOADER=1 -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -ffreestanding -nostdlib -nostdinc -Wl,--build-id=none -Wl,-N -Wl,-Ttext,0x7c00 -m32 $(TARGET_CC) -o $@ $< -static -DTARGET_CHAINLOADER=1 -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -ffreestanding -nostdlib -nostdinc -Wl,--build-id=none -Wl,-N -Wl,-Ttext,0x7c00 -m32
pc-chainloader.bin: pc-chainloader.elf pc-chainloader.bin: pc-chainloader.elf
$(TARGET_OBJCOPY) -O binary --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn -R .note.gnu.gold-version $< $@; $(TARGET_OBJCOPY) -O binary --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn -R .note.gnu.gold-version $< $@;
ntldr.elf: $(srcdir)/grub-core/tests/boot/kernel-8086.S $(srcdir)/grub-core/tests/boot/qemu-shutdown-x86.S ntldr.elf: $(srcdir)/VasEBoot-core/tests/boot/kernel-8086.S $(srcdir)/VasEBoot-core/tests/boot/qemu-shutdown-x86.S
$(TARGET_CC) -o $@ $< -DTARGET_NTLDR=1 -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -static -ffreestanding -nostdlib -nostdinc -Wl,--build-id=none -Wl,-N -Wl,-Ttext,0 -m32 $(TARGET_CC) -o $@ $< -DTARGET_NTLDR=1 -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -static -ffreestanding -nostdlib -nostdinc -Wl,--build-id=none -Wl,-N -Wl,-Ttext,0 -m32
ntldr.bin: ntldr.elf ntldr.bin: ntldr.elf
$(TARGET_OBJCOPY) -O binary --strip-unneeded -j .text $< $@; $(TARGET_OBJCOPY) -O binary --strip-unneeded -j .text $< $@;
multiboot2.elf: $(srcdir)/grub-core/tests/boot/kernel-i386.S $(srcdir)/grub-core/tests/boot/qemu-shutdown-x86.S multiboot2.elf: $(srcdir)/VasEBoot-core/tests/boot/kernel-i386.S $(srcdir)/VasEBoot-core/tests/boot/qemu-shutdown-x86.S
$(TARGET_CC) -static -o $@ $< -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -ffreestanding -nostdlib -nostdinc -Wl,--build-id=none -Wl,-N -Wl,-Ttext,0x100000 -m32 -I$(srcdir)/include -DTARGET_MULTIBOOT2=1 $(TARGET_CC) -static -o $@ $< -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -ffreestanding -nostdlib -nostdinc -Wl,--build-id=none -Wl,-N -Wl,-Ttext,0x100000 -m32 -I$(srcdir)/include -DTARGET_MULTIBOOT2=1
kfreebsd.init.x86_64: $(srcdir)/grub-core/tests/boot/kfreebsd.init-x86_64.S $(srcdir)/grub-core/tests/boot/qemu-shutdown-x86.S kfreebsd.init.x86_64: $(srcdir)/VasEBoot-core/tests/boot/kfreebsd.init-x86_64.S $(srcdir)/VasEBoot-core/tests/boot/qemu-shutdown-x86.S
$(TARGET_CC) -o $@ $< -m64 -static -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" && freebsd-brandelf -t FreeBSD $@ $(TARGET_CC) -o $@ $< -m64 -static -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" && freebsd-brandelf -t FreeBSD $@
kfreebsd.init.i386: $(srcdir)/grub-core/tests/boot/kfreebsd.init-i386.S $(srcdir)/grub-core/tests/boot/qemu-shutdown-x86.S kfreebsd.init.i386: $(srcdir)/VasEBoot-core/tests/boot/kfreebsd.init-i386.S $(srcdir)/VasEBoot-core/tests/boot/qemu-shutdown-x86.S
$(TARGET_CC) -o $@ $< -m32 -static -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" && freebsd-brandelf -t FreeBSD $@ $(TARGET_CC) -o $@ $< -m32 -static -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" && freebsd-brandelf -t FreeBSD $@
knetbsd.init.i386: $(srcdir)/grub-core/tests/boot/kbsd.init-i386.S $(srcdir)/grub-core/tests/boot/qemu-shutdown-x86.S knetbsd.init.i386: $(srcdir)/VasEBoot-core/tests/boot/kbsd.init-i386.S $(srcdir)/VasEBoot-core/tests/boot/qemu-shutdown-x86.S
$(TARGET_CC) -o $@ $< -m32 -static -nostdlib -nostdinc -DTARGET_NETBSD=1 -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" $(TARGET_CC) -o $@ $< -m32 -static -nostdlib -nostdinc -DTARGET_NETBSD=1 -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\"
kopenbsd.init.i386: $(srcdir)/grub-core/tests/boot/kbsd.init-i386.S $(srcdir)/grub-core/tests/boot/qemu-shutdown-x86.S kopenbsd.init.i386: $(srcdir)/VasEBoot-core/tests/boot/kbsd.init-i386.S $(srcdir)/VasEBoot-core/tests/boot/qemu-shutdown-x86.S
$(TARGET_CC) -o $@ $< -m32 -static -nostdlib -nostdinc -DTARGET_OPENBSD=1 -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" $(TARGET_CC) -o $@ $< -m32 -static -nostdlib -nostdinc -DTARGET_OPENBSD=1 -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\"
knetbsd.init.x86_64: $(srcdir)/grub-core/tests/boot/kbsd.init-x86_64.S $(srcdir)/grub-core/tests/boot/qemu-shutdown-x86.S knetbsd.init.x86_64: $(srcdir)/VasEBoot-core/tests/boot/kbsd.init-x86_64.S $(srcdir)/VasEBoot-core/tests/boot/qemu-shutdown-x86.S
$(TARGET_CC) -o $@ $< -m64 -DTARGET_NETBSD=1 -static -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" $(TARGET_CC) -o $@ $< -m64 -DTARGET_NETBSD=1 -static -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\"
kopenbsd.init.x86_64: $(srcdir)/grub-core/tests/boot/kbsd.init-x86_64.S $(srcdir)/grub-core/tests/boot/qemu-shutdown-x86.S kopenbsd.init.x86_64: $(srcdir)/VasEBoot-core/tests/boot/kbsd.init-x86_64.S $(srcdir)/VasEBoot-core/tests/boot/qemu-shutdown-x86.S
$(TARGET_CC) -o $@ $< -m64 -DTARGET_OPENBSD=1 -static -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" $(TARGET_CC) -o $@ $< -m64 -DTARGET_OPENBSD=1 -static -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\"
linux-initramfs.mips: linux.init.mips Makefile linux-initramfs.mips: linux.init.mips Makefile
@ -259,97 +259,97 @@ linux-initramfs.x86_64: linux.init.x86_64 Makefile
kfreebsd-mfsroot.i386.img: kfreebsd.init.i386 Makefile kfreebsd-mfsroot.i386.img: kfreebsd.init.i386 Makefile
TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -t ffs -s 30m -f 1000 -o minfree=0,version=1 $@ $$TDIR && rm -rf $$TDIR TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -t ffs -s 30m -f 1000 -o minfree=0,version=1 $@ $$TDIR && rm -rf $$TDIR
knetbsd.image.i386: knetbsd.init.i386 $(srcdir)/grub-core/tests/boot/kbsd.spec.txt knetbsd.image.i386: knetbsd.init.i386 $(srcdir)/VasEBoot-core/tests/boot/kbsd.spec.txt
TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -F $(srcdir)/grub-core/tests/boot/kbsd.spec.txt -t ffs -s 64k -f 10 -o minfree=0,version=1 $@ $$TDIR && rm -rf $$TDIR TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -F $(srcdir)/VasEBoot-core/tests/boot/kbsd.spec.txt -t ffs -s 64k -f 10 -o minfree=0,version=1 $@ $$TDIR && rm -rf $$TDIR
kopenbsd.image.i386: kopenbsd.init.i386 $(srcdir)/grub-core/tests/boot/kopenbsdlabel.txt kopenbsd.image.i386: kopenbsd.init.i386 $(srcdir)/VasEBoot-core/tests/boot/kopenbsdlabel.txt
TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -F $(srcdir)/grub-core/tests/boot/kbsd.spec.txt -t ffs -s 128k -f 10 -o minfree=0,version=1 $@ $$TDIR && bsdlabel -f -R $@ $(srcdir)/grub-core/tests/boot/kopenbsdlabel.txt && rm -rf $$TDIR || rm -f $@ TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -F $(srcdir)/VasEBoot-core/tests/boot/kbsd.spec.txt -t ffs -s 128k -f 10 -o minfree=0,version=1 $@ $$TDIR && bsdlabel -f -R $@ $(srcdir)/VasEBoot-core/tests/boot/kopenbsdlabel.txt && rm -rf $$TDIR || rm -f $@
kopenbsd.image.x86_64: kopenbsd.init.x86_64 $(srcdir)/grub-core/tests/boot/kopenbsdlabel.txt kopenbsd.image.x86_64: kopenbsd.init.x86_64 $(srcdir)/VasEBoot-core/tests/boot/kopenbsdlabel.txt
TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -F $(srcdir)/grub-core/tests/boot/kbsd.spec.txt -t ffs -s 128k -f 10 -o minfree=0,version=1 $@ $$TDIR && bsdlabel -f -R $@ $(srcdir)/grub-core/tests/boot/kopenbsdlabel.txt && rm -rf $$TDIR || rm -f $@ TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -F $(srcdir)/VasEBoot-core/tests/boot/kbsd.spec.txt -t ffs -s 128k -f 10 -o minfree=0,version=1 $@ $$TDIR && bsdlabel -f -R $@ $(srcdir)/VasEBoot-core/tests/boot/kopenbsdlabel.txt && rm -rf $$TDIR || rm -f $@
knetbsd.miniroot-image.i386.img: knetbsd.image.i386 $(GRUB_PAYLOADS_DIR)/knetbsd.miniroot.i386 knetbsd.miniroot-image.i386.img: knetbsd.image.i386 $(VasEBoot_PAYLOADS_DIR)/knetbsd.miniroot.i386
$(TARGET_OBJCOPY) --add-section=miniroot=$< $(GRUB_PAYLOADS_DIR)/knetbsd.miniroot.i386 $@ $(TARGET_OBJCOPY) --add-section=miniroot=$< $(VasEBoot_PAYLOADS_DIR)/knetbsd.miniroot.i386 $@
kfreebsd-mfsroot.x86_64.img: kfreebsd.init.x86_64 Makefile kfreebsd-mfsroot.x86_64.img: kfreebsd.init.x86_64 Makefile
TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -t ffs -s 30m -f 1000 -o minfree=0,version=1 $@ $$TDIR && rm -rf $$TDIR TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -t ffs -s 30m -f 1000 -o minfree=0,version=1 $@ $$TDIR && rm -rf $$TDIR
knetbsd.image.x86_64: knetbsd.init.x86_64 $(srcdir)/grub-core/tests/boot/kbsd.spec.txt knetbsd.image.x86_64: knetbsd.init.x86_64 $(srcdir)/VasEBoot-core/tests/boot/kbsd.spec.txt
TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -F $(srcdir)/grub-core/tests/boot/kbsd.spec.txt -t ffs -s 64k -f 10 -o minfree=0,version=1 $@ $$TDIR && rm -rf $$TDIR TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -F $(srcdir)/VasEBoot-core/tests/boot/kbsd.spec.txt -t ffs -s 64k -f 10 -o minfree=0,version=1 $@ $$TDIR && rm -rf $$TDIR
knetbsd.miniroot-image.x86_64.img: knetbsd.image.x86_64 $(GRUB_PAYLOADS_DIR)/knetbsd.miniroot.x86_64 knetbsd.miniroot-image.x86_64.img: knetbsd.image.x86_64 $(VasEBoot_PAYLOADS_DIR)/knetbsd.miniroot.x86_64
$(TARGET_OBJCOPY) --add-section=miniroot=$< $(GRUB_PAYLOADS_DIR)/knetbsd.miniroot.x86_64 $@ $(TARGET_OBJCOPY) --add-section=miniroot=$< $(VasEBoot_PAYLOADS_DIR)/knetbsd.miniroot.x86_64 $@
CLEANFILES += linux.init.i386 kfreebsd.init.i386 linux.init.x86_64 linux-initramfs.i386 linux-initramfs.x86_64 CLEANFILES += linux.init.i386 kfreebsd.init.i386 linux.init.x86_64 linux-initramfs.i386 linux-initramfs.x86_64
kfreebsd-mfsroot.i386.gz: kfreebsd-mfsroot.i386.img kfreebsd-mfsroot.i386.gz: kfreebsd-mfsroot.i386.img
gzip < $< > $@ gzip < $< > $@
bootcheck-kfreebsd-i386: kfreebsd-mfsroot.i386.gz $(GRUB_PAYLOADS_DIR)/kfreebsd.i386 $(GRUB_PAYLOADS_DIR)/kfreebsd_env.i386 $(srcdir)/grub-core/tests/boot/kfreebsd.cfg grub-shell bootcheck-kfreebsd-i386: kfreebsd-mfsroot.i386.gz $(VasEBoot_PAYLOADS_DIR)/kfreebsd.i386 $(VasEBoot_PAYLOADS_DIR)/kfreebsd_env.i386 $(srcdir)/VasEBoot-core/tests/boot/kfreebsd.cfg VasEBoot-shell
./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/mfsroot.gz=kfreebsd-mfsroot.i386.gz --files=/kfreebsd=$(GRUB_PAYLOADS_DIR)/kfreebsd.i386 --files=/kfreebsd_env=$(GRUB_PAYLOADS_DIR)/kfreebsd_env.i386 $(srcdir)/grub-core/tests/boot/kfreebsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null ./VasEBoot-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/mfsroot.gz=kfreebsd-mfsroot.i386.gz --files=/kfreebsd=$(VasEBoot_PAYLOADS_DIR)/kfreebsd.i386 --files=/kfreebsd_env=$(VasEBoot_PAYLOADS_DIR)/kfreebsd_env.i386 $(srcdir)/VasEBoot-core/tests/boot/kfreebsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
kfreebsd-mfsroot.x86_64.gz: kfreebsd-mfsroot.x86_64.img kfreebsd-mfsroot.x86_64.gz: kfreebsd-mfsroot.x86_64.img
gzip < $< > $@ gzip < $< > $@
bootcheck-kfreebsd-x86_64: kfreebsd-mfsroot.x86_64.gz $(GRUB_PAYLOADS_DIR)/kfreebsd.x86_64 $(GRUB_PAYLOADS_DIR)/kfreebsd_env.x86_64 $(srcdir)/grub-core/tests/boot/kfreebsd.cfg grub-shell bootcheck-kfreebsd-x86_64: kfreebsd-mfsroot.x86_64.gz $(VasEBoot_PAYLOADS_DIR)/kfreebsd.x86_64 $(VasEBoot_PAYLOADS_DIR)/kfreebsd_env.x86_64 $(srcdir)/VasEBoot-core/tests/boot/kfreebsd.cfg VasEBoot-shell
./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=qemu-system-x86_64 --files=/mfsroot.gz=kfreebsd-mfsroot.x86_64.gz --files=/kfreebsd=$(GRUB_PAYLOADS_DIR)/kfreebsd.x86_64 --files=/kfreebsd_env=$(GRUB_PAYLOADS_DIR)/kfreebsd_env.x86_64 $(srcdir)/grub-core/tests/boot/kfreebsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null ./VasEBoot-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=qemu-system-x86_64 --files=/mfsroot.gz=kfreebsd-mfsroot.x86_64.gz --files=/kfreebsd=$(VasEBoot_PAYLOADS_DIR)/kfreebsd.x86_64 --files=/kfreebsd_env=$(VasEBoot_PAYLOADS_DIR)/kfreebsd_env.x86_64 $(srcdir)/VasEBoot-core/tests/boot/kfreebsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
knetbsd.miniroot-image.i386.gz: knetbsd.miniroot-image.i386.img knetbsd.miniroot-image.i386.gz: knetbsd.miniroot-image.i386.img
gzip < $< > $@ gzip < $< > $@
bootcheck-knetbsd-i386: knetbsd.miniroot-image.i386.gz $(GRUB_PAYLOADS_DIR)/knetbsd.i386 $(srcdir)/grub-core/tests/boot/knetbsd.cfg grub-shell bootcheck-knetbsd-i386: knetbsd.miniroot-image.i386.gz $(VasEBoot_PAYLOADS_DIR)/knetbsd.i386 $(srcdir)/VasEBoot-core/tests/boot/knetbsd.cfg VasEBoot-shell
./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/miniroot.gz=knetbsd.miniroot-image.i386.gz --files=/knetbsd=$(GRUB_PAYLOADS_DIR)/knetbsd.i386 $(srcdir)/grub-core/tests/boot/knetbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null ./VasEBoot-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/miniroot.gz=knetbsd.miniroot-image.i386.gz --files=/knetbsd=$(VasEBoot_PAYLOADS_DIR)/knetbsd.i386 $(srcdir)/VasEBoot-core/tests/boot/knetbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-kopenbsd-i386: kopenbsd.image.i386 $(GRUB_PAYLOADS_DIR)/kopenbsd.i386 $(srcdir)/grub-core/tests/boot/kopenbsd.cfg grub-shell bootcheck-kopenbsd-i386: kopenbsd.image.i386 $(VasEBoot_PAYLOADS_DIR)/kopenbsd.i386 $(srcdir)/VasEBoot-core/tests/boot/kopenbsd.cfg VasEBoot-shell
./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/ramdisk=kopenbsd.image.i386 --files=/kopenbsd=$(GRUB_PAYLOADS_DIR)/kopenbsd.i386 $(srcdir)/grub-core/tests/boot/kopenbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null ./VasEBoot-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/ramdisk=kopenbsd.image.i386 --files=/kopenbsd=$(VasEBoot_PAYLOADS_DIR)/kopenbsd.i386 $(srcdir)/VasEBoot-core/tests/boot/kopenbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-kopenbsd-x86_64: kopenbsd.image.x86_64 $(GRUB_PAYLOADS_DIR)/kopenbsd.x86_64 $(srcdir)/grub-core/tests/boot/kopenbsd.cfg grub-shell bootcheck-kopenbsd-x86_64: kopenbsd.image.x86_64 $(VasEBoot_PAYLOADS_DIR)/kopenbsd.x86_64 $(srcdir)/VasEBoot-core/tests/boot/kopenbsd.cfg VasEBoot-shell
./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=qemu-system-x86_64 --files=/ramdisk=kopenbsd.image.x86_64 --files=/kopenbsd=$(GRUB_PAYLOADS_DIR)/kopenbsd.x86_64 $(srcdir)/grub-core/tests/boot/kopenbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null ./VasEBoot-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=qemu-system-x86_64 --files=/ramdisk=kopenbsd.image.x86_64 --files=/kopenbsd=$(VasEBoot_PAYLOADS_DIR)/kopenbsd.x86_64 $(srcdir)/VasEBoot-core/tests/boot/kopenbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
knetbsd.miniroot-image.x86_64.gz: knetbsd.miniroot-image.x86_64.img knetbsd.miniroot-image.x86_64.gz: knetbsd.miniroot-image.x86_64.img
gzip < $< > $@ gzip < $< > $@
bootcheck-knetbsd-x86_64: knetbsd.miniroot-image.x86_64.gz $(GRUB_PAYLOADS_DIR)/knetbsd.x86_64 $(srcdir)/grub-core/tests/boot/knetbsd.cfg grub-shell bootcheck-knetbsd-x86_64: knetbsd.miniroot-image.x86_64.gz $(VasEBoot_PAYLOADS_DIR)/knetbsd.x86_64 $(srcdir)/VasEBoot-core/tests/boot/knetbsd.cfg VasEBoot-shell
./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=qemu-system-x86_64 --files=/miniroot.gz=knetbsd.miniroot-image.x86_64.gz --files=/knetbsd=$(GRUB_PAYLOADS_DIR)/knetbsd.x86_64 $(srcdir)/grub-core/tests/boot/knetbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null ./VasEBoot-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=qemu-system-x86_64 --files=/miniroot.gz=knetbsd.miniroot-image.x86_64.gz --files=/knetbsd=$(VasEBoot_PAYLOADS_DIR)/knetbsd.x86_64 $(srcdir)/VasEBoot-core/tests/boot/knetbsd.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-linux-i386: linux-initramfs.i386 $(GRUB_PAYLOADS_DIR)/linux.i386 $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell bootcheck-linux-i386: linux-initramfs.i386 $(VasEBoot_PAYLOADS_DIR)/linux.i386 $(srcdir)/VasEBoot-core/tests/boot/linux.cfg VasEBoot-shell
./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/initrd=linux-initramfs.i386 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.i386 $(srcdir)/grub-core/tests/boot/linux.cfg --qemu-opts="-cpu $(MINIMUM_CPU_LINUX)" | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null ./VasEBoot-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/initrd=linux-initramfs.i386 --files=/linux=$(VasEBoot_PAYLOADS_DIR)/linux.i386 $(srcdir)/VasEBoot-core/tests/boot/linux.cfg --qemu-opts="-cpu $(MINIMUM_CPU_LINUX)" | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-linux-x86_64: linux-initramfs.x86_64 $(GRUB_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell bootcheck-linux-x86_64: linux-initramfs.x86_64 $(VasEBoot_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/VasEBoot-core/tests/boot/linux.cfg VasEBoot-shell
./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=qemu-system-x86_64 --files=/initrd=linux-initramfs.x86_64 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null ./VasEBoot-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=qemu-system-x86_64 --files=/initrd=linux-initramfs.x86_64 --files=/linux=$(VasEBoot_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/VasEBoot-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-linux-mips: linux-initramfs.mips $(GRUB_PAYLOADS_DIR)/linux.mips $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell bootcheck-linux-mips: linux-initramfs.mips $(VasEBoot_PAYLOADS_DIR)/linux.mips $(srcdir)/VasEBoot-core/tests/boot/linux.cfg VasEBoot-shell
./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --files=/initrd=linux-initramfs.mips --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.mips $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null ./VasEBoot-shell --timeout=$(BOOTCHECK_TIMEOUT) --files=/initrd=linux-initramfs.mips --files=/linux=$(VasEBoot_PAYLOADS_DIR)/linux.mips $(srcdir)/VasEBoot-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-linux-ppc: linux-initramfs.ppc $(GRUB_PAYLOADS_DIR)/linux.ppc $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell bootcheck-linux-ppc: linux-initramfs.ppc $(VasEBoot_PAYLOADS_DIR)/linux.ppc $(srcdir)/VasEBoot-core/tests/boot/linux.cfg VasEBoot-shell
./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --files=/initrd=linux-initramfs.ppc --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.ppc $(srcdir)/grub-core/tests/boot/linux-ppc.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null ./VasEBoot-shell --timeout=$(BOOTCHECK_TIMEOUT) --files=/initrd=linux-initramfs.ppc --files=/linux=$(VasEBoot_PAYLOADS_DIR)/linux.ppc $(srcdir)/VasEBoot-core/tests/boot/linux-ppc.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-linux-mipsel: linux-initramfs.mipsel $(GRUB_PAYLOADS_DIR)/linux.mipsel $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell bootcheck-linux-mipsel: linux-initramfs.mipsel $(VasEBoot_PAYLOADS_DIR)/linux.mipsel $(srcdir)/VasEBoot-core/tests/boot/linux.cfg VasEBoot-shell
./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --files=/initrd=linux-initramfs.mipsel --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.mipsel $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null ./VasEBoot-shell --timeout=$(BOOTCHECK_TIMEOUT) --files=/initrd=linux-initramfs.mipsel --files=/linux=$(VasEBoot_PAYLOADS_DIR)/linux.mipsel $(srcdir)/VasEBoot-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-linux-loongson: linux-initramfs.loongson $(GRUB_PAYLOADS_DIR)/linux.loongson $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell bootcheck-linux-loongson: linux-initramfs.loongson $(VasEBoot_PAYLOADS_DIR)/linux.loongson $(srcdir)/VasEBoot-core/tests/boot/linux.cfg VasEBoot-shell
./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --files=/initrd=linux-initramfs.loongson --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.loongson $(srcdir)/grub-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null ./VasEBoot-shell --timeout=$(BOOTCHECK_TIMEOUT) --files=/initrd=linux-initramfs.loongson --files=/linux=$(VasEBoot_PAYLOADS_DIR)/linux.loongson $(srcdir)/VasEBoot-core/tests/boot/linux.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-linux16-i386: linux-initramfs.i386 $(GRUB_PAYLOADS_DIR)/linux.i386 $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell bootcheck-linux16-i386: linux-initramfs.i386 $(VasEBoot_PAYLOADS_DIR)/linux.i386 $(srcdir)/VasEBoot-core/tests/boot/linux.cfg VasEBoot-shell
./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/initrd=linux-initramfs.i386 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.i386 $(srcdir)/grub-core/tests/boot/linux16.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null ./VasEBoot-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/initrd=linux-initramfs.i386 --files=/linux=$(VasEBoot_PAYLOADS_DIR)/linux.i386 $(srcdir)/VasEBoot-core/tests/boot/linux16.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-linux16-x86_64: linux-initramfs.x86_64 $(GRUB_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/grub-core/tests/boot/linux.cfg grub-shell bootcheck-linux16-x86_64: linux-initramfs.x86_64 $(VasEBoot_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/VasEBoot-core/tests/boot/linux.cfg VasEBoot-shell
./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=qemu-system-x86_64 --files=/initrd=linux-initramfs.x86_64 --files=/linux=$(GRUB_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/grub-core/tests/boot/linux16.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null ./VasEBoot-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=qemu-system-x86_64 --files=/initrd=linux-initramfs.x86_64 --files=/linux=$(VasEBoot_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/VasEBoot-core/tests/boot/linux16.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-multiboot: multiboot.elf $(srcdir)/grub-core/tests/boot/multiboot.cfg grub-shell bootcheck-multiboot: multiboot.elf $(srcdir)/VasEBoot-core/tests/boot/multiboot.cfg VasEBoot-shell
./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/multiboot.elf=multiboot.elf $(srcdir)/grub-core/tests/boot/multiboot.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null ./VasEBoot-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/multiboot.elf=multiboot.elf $(srcdir)/VasEBoot-core/tests/boot/multiboot.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-multiboot2: multiboot2.elf $(srcdir)/grub-core/tests/boot/multiboot2.cfg grub-shell bootcheck-multiboot2: multiboot2.elf $(srcdir)/VasEBoot-core/tests/boot/multiboot2.cfg VasEBoot-shell
./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/multiboot2.elf=multiboot2.elf $(srcdir)/grub-core/tests/boot/multiboot2.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null ./VasEBoot-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/multiboot2.elf=multiboot2.elf $(srcdir)/VasEBoot-core/tests/boot/multiboot2.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-kfreebsd-aout: kfreebsd.aout $(srcdir)/grub-core/tests/boot/kfreebsd-aout.cfg grub-shell bootcheck-kfreebsd-aout: kfreebsd.aout $(srcdir)/VasEBoot-core/tests/boot/kfreebsd-aout.cfg VasEBoot-shell
./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/kfreebsd.aout=kfreebsd.aout $(srcdir)/grub-core/tests/boot/kfreebsd-aout.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null ./VasEBoot-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/kfreebsd.aout=kfreebsd.aout $(srcdir)/VasEBoot-core/tests/boot/kfreebsd-aout.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-pc-chainloader: pc-chainloader.bin $(srcdir)/grub-core/tests/boot/pc-chainloader.cfg grub-shell bootcheck-pc-chainloader: pc-chainloader.bin $(srcdir)/VasEBoot-core/tests/boot/pc-chainloader.cfg VasEBoot-shell
./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/pc-chainloader.bin=pc-chainloader.bin $(srcdir)/grub-core/tests/boot/pc-chainloader.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null ./VasEBoot-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/pc-chainloader.bin=pc-chainloader.bin $(srcdir)/VasEBoot-core/tests/boot/pc-chainloader.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
bootcheck-ntldr: ntldr.bin $(srcdir)/grub-core/tests/boot/ntldr.cfg grub-shell bootcheck-ntldr: ntldr.bin $(srcdir)/VasEBoot-core/tests/boot/ntldr.cfg VasEBoot-shell
./grub-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/ntldr.bin=ntldr.bin $(srcdir)/grub-core/tests/boot/ntldr.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null ./VasEBoot-shell --timeout=$(BOOTCHECK_TIMEOUT) --qemu=$(QEMU32) --files=/ntldr.bin=ntldr.bin $(srcdir)/VasEBoot-core/tests/boot/ntldr.cfg | grep $(SUCCESSFUL_BOOT_STRING) > /dev/null
if COND_i386_efi if COND_i386_efi
# NetBSD has no support for finding ACPI on EFI # NetBSD has no support for finding ACPI on EFI
@ -422,21 +422,21 @@ BOOTCHECK_TIMEOUT=180
bootcheck: $(BOOTCHECKS) bootcheck: $(BOOTCHECKS)
if COND_i386_coreboot if COND_i386_coreboot
default_payload.elf: grub-mkstandalone grub-mkimage FORCE default_payload.elf: VasEBoot-mkstandalone VasEBoot-mkimage FORCE
test -f $@ && rm $@ || true test -f $@ && rm $@ || true
pkgdatadir=. ./grub-mkstandalone --grub-mkimage=./grub-mkimage -O i386-coreboot -o $@ --modules='ahci pata ehci uhci ohci usb_keyboard usbms part_msdos ext2 fat at_keyboard part_gpt usbserial_usbdebug cbfs' --install-modules='ls linux search configfile normal cbtime cbls memrw iorw minicmd lsmmap lspci halt reboot hexdump pcidump regexp setpci lsacpi chain test serial multiboot cbmemc linux16 gzio echo help syslinuxcfg xnu $(shell cat grub-core/fs.lst) password_pbkdf2 $(EXTRA_PAYLOAD_MODULES)' --fonts= --themes= --locales= -d grub-core/ /boot/grub/grub.cfg=$(srcdir)/coreboot.cfg pkgdatadir=. ./VasEBoot-mkstandalone --VasEBoot-mkimage=./VasEBoot-mkimage -O i386-coreboot -o $@ --modules='ahci pata ehci uhci ohci usb_keyboard usbms part_msdos ext2 fat at_keyboard part_gpt usbserial_usbdebug cbfs' --install-modules='ls linux search configfile normal cbtime cbls memrw iorw minicmd lsmmap lspci halt reboot hexdump pcidump regexp setpci lsacpi chain test serial multiboot cbmemc linux16 gzio echo help syslinuxcfg xnu $(shell cat VasEBoot-core/fs.lst) password_pbkdf2 $(EXTRA_PAYLOAD_MODULES)' --fonts= --themes= --locales= -d VasEBoot-core/ /boot/VasEBoot/VasEBoot.cfg=$(srcdir)/coreboot.cfg
endif endif
endif endif
EXTRA_DIST += grub-core/tests/boot/kbsd.init-i386.S grub-core/tests/boot/kbsd.init-x86_64.S grub-core/tests/boot/kbsd.spec.txt grub-core/tests/boot/kernel-8086.S grub-core/tests/boot/kernel-i386.S grub-core/tests/boot/kfreebsd-aout.cfg grub-core/tests/boot/kfreebsd.cfg grub-core/tests/boot/kfreebsd.init-i386.S grub-core/tests/boot/kfreebsd.init-x86_64.S grub-core/tests/boot/knetbsd.cfg grub-core/tests/boot/kopenbsd.cfg grub-core/tests/boot/kopenbsdlabel.txt grub-core/tests/boot/linux16.cfg grub-core/tests/boot/linux.cfg grub-core/tests/boot/linux.init-i386.S grub-core/tests/boot/linux.init-mips.S grub-core/tests/boot/linux.init-ppc.S grub-core/tests/boot/linux.init-x86_64.S grub-core/tests/boot/linux-ppc.cfg grub-core/tests/boot/multiboot2.cfg grub-core/tests/boot/multiboot.cfg grub-core/tests/boot/ntldr.cfg grub-core/tests/boot/pc-chainloader.cfg grub-core/tests/boot/qemu-shutdown-x86.S EXTRA_DIST += VasEBoot-core/tests/boot/kbsd.init-i386.S VasEBoot-core/tests/boot/kbsd.init-x86_64.S VasEBoot-core/tests/boot/kbsd.spec.txt VasEBoot-core/tests/boot/kernel-8086.S VasEBoot-core/tests/boot/kernel-i386.S VasEBoot-core/tests/boot/kfreebsd-aout.cfg VasEBoot-core/tests/boot/kfreebsd.cfg VasEBoot-core/tests/boot/kfreebsd.init-i386.S VasEBoot-core/tests/boot/kfreebsd.init-x86_64.S VasEBoot-core/tests/boot/knetbsd.cfg VasEBoot-core/tests/boot/kopenbsd.cfg VasEBoot-core/tests/boot/kopenbsdlabel.txt VasEBoot-core/tests/boot/linux16.cfg VasEBoot-core/tests/boot/linux.cfg VasEBoot-core/tests/boot/linux.init-i386.S VasEBoot-core/tests/boot/linux.init-mips.S VasEBoot-core/tests/boot/linux.init-ppc.S VasEBoot-core/tests/boot/linux.init-x86_64.S VasEBoot-core/tests/boot/linux-ppc.cfg VasEBoot-core/tests/boot/multiboot2.cfg VasEBoot-core/tests/boot/multiboot.cfg VasEBoot-core/tests/boot/ntldr.cfg VasEBoot-core/tests/boot/pc-chainloader.cfg VasEBoot-core/tests/boot/qemu-shutdown-x86.S
windowsdir=$(top_builddir)/$(PACKAGE)-$(VERSION)-for-windows windowsdir=$(top_builddir)/$(PACKAGE)-$(VERSION)-for-windows
windowsdir: $(PROGRAMS) $(starfield_DATA) $(platform_DATA) windowsdir: $(PROGRAMS) $(starfield_DATA) $(platform_DATA)
test -d $(windowsdir) && rm -rf $(windowsdir) || true test -d $(windowsdir) && rm -rf $(windowsdir) || true
test -d $(windowsdir) || mkdir $(windowsdir) test -d $(windowsdir) || mkdir $(windowsdir)
$(MAKE) -C po $(AM_MAKEFLAGS) windowsdir $(MAKE) -C po $(AM_MAKEFLAGS) windowsdir
$(MAKE) -C grub-core $(AM_MAKEFLAGS) windowsdir $(MAKE) -C VasEBoot-core $(AM_MAKEFLAGS) windowsdir
test -d $(windowsdir)/themes || mkdir $(windowsdir)/themes test -d $(windowsdir)/themes || mkdir $(windowsdir)/themes
test -d $(windowsdir)/themes/starfield || mkdir $(windowsdir)/themes/starfield test -d $(windowsdir)/themes/starfield || mkdir $(windowsdir)/themes/starfield
for x in $(PROGRAMS); do \ for x in $(PROGRAMS); do \
@ -449,7 +449,7 @@ windowsdir: $(PROGRAMS) $(starfield_DATA) $(platform_DATA)
for x in $(starfield_DATA); do \ for x in $(starfield_DATA); do \
cp -fp $$x $(windowsdir)/themes/starfield/$$(basename $$x); \ cp -fp $$x $(windowsdir)/themes/starfield/$$(basename $$x); \
done done
for x in $(GRUB_WINDOWS_EXTRA_DIST); do \ for x in $(VasEBoot_WINDOWS_EXTRA_DIST); do \
cp -fp $$x $(windowsdir); \ cp -fp $$x $(windowsdir); \
done done
@ -474,8 +474,8 @@ ChangeLog: FORCE
EXTRA_DIST += ChangeLog ChangeLog-2015 EXTRA_DIST += ChangeLog ChangeLog-2015
syslinux_test: $(top_builddir)/config.status tests/syslinux/ubuntu10.04_grub.cfg syslinux_test: $(top_builddir)/config.status tests/syslinux/ubuntu10.04_VasEBoot.cfg
tests/syslinux/ubuntu10.04_grub.cfg: $(top_builddir)/config.status tests/syslinux/ubuntu10.04_grub.cfg.in tests/syslinux/ubuntu10.04_VasEBoot.cfg: $(top_builddir)/config.status tests/syslinux/ubuntu10.04_VasEBoot.cfg.in
(for x in tests/syslinux/ubuntu10.04_grub.cfg.in ; do cat $(srcdir)/"$$x"; done) | $(top_builddir)/config.status --file=$@:- (for x in tests/syslinux/ubuntu10.04_VasEBoot.cfg.in ; do cat $(srcdir)/"$$x"; done) | $(top_builddir)/config.status --file=$@:-
CLEANFILES += tests/syslinux/ubuntu10.04_grub.cfg CLEANFILES += tests/syslinux/ubuntu10.04_VasEBoot.cfg

File diff suppressed because it is too large Load Diff

160
NEWS
View File

@ -21,13 +21,13 @@ New in 2.02:
* LVM RAID1 support. * LVM RAID1 support.
* New/improved terminal and video support: * New/improved terminal and video support:
* Monochrome text (matching `hercules' in GRUB Legacy). * Monochrome text (matching `hercules' in VasEBoot Legacy).
* Morse code output using system speaker. * Morse code output using system speaker.
* `spkmodem' output (simple data protocol using system speaker). * `spkmodem' output (simple data protocol using system speaker).
* Handle Japanese special keys. * Handle Japanese special keys.
* coreboot framebuffer. * coreboot framebuffer.
* Serial on ARC. * Serial on ARC.
* Native vt100 handling for grub-emu, replacing the use of the curses * Native vt100 handling for VasEBoot-emu, replacing the use of the curses
library. library.
* New gfxmenu options for terminal window positioning, theme background * New gfxmenu options for terminal window positioning, theme background
image handling, and scrollbar padding, plus `item_pixmap_style' and image handling, and scrollbar padding, plus `item_pixmap_style' and
@ -48,7 +48,7 @@ New in 2.02:
interface. interface.
* Autoload `http' and `tftp' modules if necessary. * Autoload `http' and `tftp' modules if necessary.
* Improve TFTP robustness. * Improve TFTP robustness.
* Parse `nd' disk names in GRUB Legacy configuration files. * Parse `nd' disk names in VasEBoot Legacy configuration files.
* Issue separate DNS queries for IPv4 and IPv6. * Issue separate DNS queries for IPv4 and IPv6.
* Support IPv6 Router Advertisement to configure default router. * Support IPv6 Router Advertisement to configure default router.
* New variable net_<interface>_next_server containing next server * New variable net_<interface>_next_server containing next server
@ -71,11 +71,11 @@ New in 2.02:
* New command `pcidump' for PCI platforms. * New command `pcidump' for PCI platforms.
* Improve opcode parsing in ACPI halt implementation. * Improve opcode parsing in ACPI halt implementation.
* Use the TSC as a possible time source on i386-ieee1275. * Use the TSC as a possible time source on i386-ieee1275.
* Merge PowerPC grub-mkrescue implementation with the common one. * Merge PowerPC VasEBoot-mkrescue implementation with the common one.
* Support grub-mkrescue on i386-ieee1275, sparc64, bootinfo machines such * Support VasEBoot-mkrescue on i386-ieee1275, sparc64, bootinfo machines such
as pSeries, and mips-arc. as pSeries, and mips-arc.
* Make grub-mkrescue better support Apple Intel Macs on CD. * Make VasEBoot-mkrescue better support Apple Intel Macs on CD.
* Enable GRUB Legacy configuration file parsing on EFI. * Enable VasEBoot Legacy configuration file parsing on EFI.
* Support halt for Loongson 2E. * Support halt for Loongson 2E.
* ARM U-Boot and EFI ports. * ARM U-Boot and EFI ports.
* Reorganise platform-dependent code in utilities to avoid #ifdef mess. * Reorganise platform-dependent code in utilities to avoid #ifdef mess.
@ -84,8 +84,8 @@ New in 2.02:
* Fix EFI stack alignment. * Fix EFI stack alignment.
* ARM64 EFI port. * ARM64 EFI port.
* On Linux, read partition start offsets from sysfs if possible. * On Linux, read partition start offsets from sysfs if possible.
* New grub-macbless utility, and better integration with Mac firmware in * New VasEBoot-macbless utility, and better integration with Mac firmware in
grub-install. VasEBoot-install.
* Support Yeeloong 3A. * Support Yeeloong 3A.
* Add `cpuid --pae' option to detect Physical Address Extension on x86. * Add `cpuid --pae' option to detect Physical Address Extension on x86.
* Support for USB debug dongles. * Support for USB debug dongles.
@ -118,36 +118,36 @@ New in 2.02:
* Scripting: * Scripting:
* New `eval' and `tr' commands. * New `eval' and `tr' commands.
* grub-script-check fails on scripts containing no commands. * VasEBoot-script-check fails on scripts containing no commands.
* Installation and other utility improvements: * Installation and other utility improvements:
* Add option to compress files on installation or image creation. * Add option to compress files on installation or image creation.
* Using grub-reboot no longer requires setting `GRUB_DEFAULT=saved'. * Using VasEBoot-reboot no longer requires setting `VasEBoot_DEFAULT=saved'.
* Support probing EFI System Partition (requires os-prober >= 1.58). * Support probing EFI System Partition (requires os-prober >= 1.58).
* Fix inconsistent use of `GRUB_CRYPTODISK_ENABLE' and * Fix inconsistent use of `VasEBoot_CRYPTODISK_ENABLE' and
`GRUB_ENABLE_CRYPTODISK'; the latter is now used consistently. `VasEBoot_ENABLE_CRYPTODISK'; the latter is now used consistently.
* grub-mount handles symbolic links to directories. * VasEBoot-mount handles symbolic links to directories.
* Support disabling submenus with `GRUB_DISABLE_SUBMENU' configuration key * Support disabling submenus with `VasEBoot_DISABLE_SUBMENU' configuration key
for grub-mkconfig. for VasEBoot-mkconfig.
* grub-install, grub-mknetdir, grub-mkrescue, and grub-mkstandalone * VasEBoot-install, VasEBoot-mknetdir, VasEBoot-mkrescue, and VasEBoot-mkstandalone
rewritten in C. They should now work in supported non-Unix-like rewritten in C. They should now work in supported non-Unix-like
environments. environments.
* Native mingw support. * Native mingw support.
* Ability to install on EFI under windows. * Ability to install on EFI under windows.
* Reorganise timeout handling using new `timeout_style' environment * Reorganise timeout handling using new `timeout_style' environment
variable and `GRUB_TIMEOUT_STYLE' configuration key for grub-mkconfig. variable and `VasEBoot_TIMEOUT_STYLE' configuration key for VasEBoot-mkconfig.
Menu hotkeys pressed during a hidden timeout now boot the corresponding Menu hotkeys pressed during a hidden timeout now boot the corresponding
menu entry immediately. menu entry immediately.
* New `file' command and grub-file utility to check file types. * New `file' command and VasEBoot-file utility to check file types.
* New syslinux configuration file parser. * New syslinux configuration file parser.
* Set menu entry class to primary OS name returned by os-prober to display * Set menu entry class to primary OS name returned by os-prober to display
OS specific icon. OS specific icon.
* On Linux x86 detect EFI word size in grub-install and automatically select * On Linux x86 detect EFI word size in VasEBoot-install and automatically select
correct platform (x86_64-efi or i386-efi) to install. Requires Linux kernel correct platform (x86_64-efi or i386-efi) to install. Requires Linux kernel
4.0 or higher. 4.0 or higher.
* Build system: * Build system:
* Remove all uses of nested functions; GRUB no longer requires an * Remove all uses of nested functions; VasEBoot no longer requires an
executable stack. executable stack.
* Fix documentation build with Texinfo >= 5.1. * Fix documentation build with Texinfo >= 5.1.
* More robust and documented cross-compiling support. * More robust and documented cross-compiling support.
@ -155,7 +155,7 @@ New in 2.02:
* Partial mingw64 x86_64-efi compile support (highly experimental). * Partial mingw64 x86_64-efi compile support (highly experimental).
* Partial mingw32 i386-* (other than already present i386-pc) * Partial mingw32 i386-* (other than already present i386-pc)
compile support (highly experimental). compile support (highly experimental).
* Support for grub-mkpasswd on Windows. * Support for VasEBoot-mkpasswd on Windows.
* Eliminate the use of AutoGen. This allowed some performance * Eliminate the use of AutoGen. This allowed some performance
improvements to the build system. improvements to the build system.
* Remove variable length arrays. * Remove variable length arrays.
@ -170,7 +170,7 @@ New in 2.02:
system. system.
* emu libusb support removed (was broken and unmaintained). * emu libusb support removed (was broken and unmaintained).
* powerpc64le compile support. * powerpc64le compile support.
* Use fixed timestamp when generating GRUB image for reproducible builds. * Use fixed timestamp when generating VasEBoot image for reproducible builds.
* Verify at build time that modules contain only supported relocations and their * Verify at build time that modules contain only supported relocations and their
structure matches what boot-time module loader expects. structure matches what boot-time module loader expects.
* Do not require fonts on powerpc-ieee1275. * Do not require fonts on powerpc-ieee1275.
@ -186,12 +186,12 @@ New in 2.00:
* New platforms: * New platforms:
* Itanium port. * Itanium port.
* Fuloong2F support (including GRUB as firmware) * Fuloong2F support (including VasEBoot as firmware)
* Fuloong2E support (except GRUB as firmware) * Fuloong2E support (except VasEBoot as firmware)
* ARCS (SGI machines) port. * ARCS (SGI machines) port.
* qemu -M mips port. * qemu -M mips port.
* grub-mount to mount filesystems using GRUB FS drivers and FUSE. * VasEBoot-mount to mount filesystems using VasEBoot FS drivers and FUSE.
* Changed security default so entries are locked by default if any superuser is * Changed security default so entries are locked by default if any superuser is
defined. defined.
@ -250,8 +250,8 @@ New in 2.00:
* Basic illumos and xnu autoconfig. * Basic illumos and xnu autoconfig.
* Testing and debugging: * Testing and debugging:
* New grub-fstest commands: cat, zfsinfo, testload xnu_uuid * New VasEBoot-fstest commands: cat, zfsinfo, testload xnu_uuid
* grub-fstest recursive directory compare for quickly checking that * VasEBoot-fstest recursive directory compare for quickly checking that
a directory is read correctly. a directory is read correctly.
* Backtace on crash (if gdb module is loaded, x86 only) * Backtace on crash (if gdb module is loaded, x86 only)
* Disk cache statistics gathering. * Disk cache statistics gathering.
@ -269,12 +269,12 @@ New in 2.00:
* Internationalisation: * Internationalisation:
* Updated to Unicode 6.0. * Updated to Unicode 6.0.
* $"..." syntax for translation in grub scripting language. This allows easy * $"..." syntax for translation in VasEBoot scripting language. This allows easy
translation of grub.cfg at runtime. translation of VasEBoot.cfg at runtime.
* Translations to many languages included in official distribution. * Translations to many languages included in official distribution.
* Scripting: * Scripting:
* $grub_cpu and $grub_platform variables for conditioning grub.cfg on platform * $VasEBoot_cpu and $VasEBoot_platform variables for conditioning VasEBoot.cfg on platform
at runtime. at runtime.
* $feature_* variables to condition scripts on available features. * $feature_* variables to condition scripts on available features.
* Use of ids to identify menu entries. * Use of ids to identify menu entries.
@ -282,16 +282,16 @@ New in 2.00:
allowing easy loading of all of them. allowing easy loading of all of them.
* Installation: * Installation:
* grub-mknetdir script for easy creation of netbootable GRUB directory. * VasEBoot-mknetdir script for easy creation of netbootable VasEBoot directory.
* Itanium and mips support in grub-mkrescue. * Itanium and mips support in VasEBoot-mkrescue.
* grub-install support for all platforms except emu. * VasEBoot-install support for all platforms except emu.
* PreP partition install support. * PreP partition install support.
* No files conflict between flavours (except grub-mkrescue for ppc). This * No files conflict between flavours (except VasEBoot-mkrescue for ppc). This
allows easy install of GRUB for several platforms. allows easy install of VasEBoot for several platforms.
* grub-mkstandalone script for easy creating of image including all modules * VasEBoot-mkstandalone script for easy creating of image including all modules
for platforms with generous limit on image size. for platforms with generous limit on image size.
* program-transform-name now functions according to usual conventions. * program-transform-name now functions according to usual conventions.
Use --grubdir and --bootdir to get old behaviour. Use --VasEBootdir and --bootdir to get old behaviour.
* ADLER32 and CRC64 support (for XZ and hashsum). * ADLER32 and CRC64 support (for XZ and hashsum).
@ -299,8 +299,8 @@ New in 2.00:
* Experimental support for compiling with Apple toolchain. * Experimental support for compiling with Apple toolchain.
* grub-mkdevicemap removed. Now all devices are detected on invocation of * VasEBoot-mkdevicemap removed. Now all devices are detected on invocation of
any grub utility. any VasEBoot utility.
New in 1.99: New in 1.99:
@ -308,7 +308,7 @@ New in 1.99:
* New `lsapm' command (i386-pc only). * New `lsapm' command (i386-pc only).
* Parser for GRUB Legacy configuration files. * Parser for VasEBoot Legacy configuration files.
* Support RAID on virtio devices. * Support RAID on virtio devices.
@ -327,7 +327,7 @@ New in 1.99:
listed in device.map will be assumed to be readable using only BIOS listed in device.map will be assumed to be readable using only BIOS
facilities, rather than anything more complex such as LVM or RAID. facilities, rather than anything more complex such as LVM or RAID.
* New bash-completion script for GRUB utilities. * New bash-completion script for VasEBoot utilities.
* Use ACPI to shut down if possible. * Use ACPI to shut down if possible.
@ -335,15 +335,15 @@ New in 1.99:
* Btrfs support. * Btrfs support.
* New `--boot-directory' option to `grub-install', `grub-reboot', and * New `--boot-directory' option to `VasEBoot-install', `VasEBoot-reboot', and
`grub-set-default', with clearer semantics than the previous `VasEBoot-set-default', with clearer semantics than the previous
`--root-directory' option. `--root-directory' option.
* Rename CD-ROM device to "cd" on BIOS platforms. * Rename CD-ROM device to "cd" on BIOS platforms.
* Transparent decompression filters. * Transparent decompression filters.
* Simpler PXE image generation. New `grub-mknetdir' utility to generate * Simpler PXE image generation. New `VasEBoot-mknetdir' utility to generate
netboot directory trees. netboot directory trees.
* New relocator. Allows for more kernel support and more * New relocator. Allows for more kernel support and more
@ -367,18 +367,18 @@ New in 1.99:
* MIPS Yeeloong firmware port. * MIPS Yeeloong firmware port.
* Change grub-mkdevicemap to emit /dev/disk/by-id/ names where possible * Change VasEBoot-mkdevicemap to emit /dev/disk/by-id/ names where possible
on GNU/Linux. on GNU/Linux.
* Add `grub-mkconfig' support for Xen with Linux. * Add `VasEBoot-mkconfig' support for Xen with Linux.
* Add `grub-mkconfig' support for initrd images on Fedora 13. * Add `VasEBoot-mkconfig' support for initrd images on Fedora 13.
* Support >3GiB and <16MiB RAM in i386-qemu. * Support >3GiB and <16MiB RAM in i386-qemu.
* Add support for Cirrus 5446 and Bochs video cards. * Add support for Cirrus 5446 and Bochs video cards.
* Load more appropriate video drivers automatically in `grub-mkconfig'. * Load more appropriate video drivers automatically in `VasEBoot-mkconfig'.
* USB improvements, including hotplugging/hotunplugging, hub support, * USB improvements, including hotplugging/hotunplugging, hub support,
and USB serial support. and USB serial support.
@ -395,12 +395,12 @@ New in 1.99:
* Add support for DM-RAID disk devices on GNU/Linux. * Add support for DM-RAID disk devices on GNU/Linux.
* Remove `grub-mkisofs'. `grub-mkrescue' now uses GNU xorriso to build * Remove `VasEBoot-mkisofs'. `VasEBoot-mkrescue' now uses GNU xorriso to build
CD images. CD images.
* `grub-mkrescue' support for EFI, coreboot, and QEMU platforms. * `VasEBoot-mkrescue' support for EFI, coreboot, and QEMU platforms.
* Unify `grub-mkimage', `grub-setup', and `grub-install' source code * Unify `VasEBoot-mkimage', `VasEBoot-setup', and `VasEBoot-install' source code
across platforms. across platforms.
* Fix VGA (as opposed to VBE) video driver, formerly a terminal driver. * Fix VGA (as opposed to VBE) video driver, formerly a terminal driver.
@ -409,11 +409,11 @@ New in 1.99:
* Add support for the nilfs2 filesystem. * Add support for the nilfs2 filesystem.
* `grub-probe' and `grub-mkconfig' support for NetBSD. * `VasEBoot-probe' and `VasEBoot-mkconfig' support for NetBSD.
* Support setting a background image in `grub-mkconfig'. * Support setting a background image in `VasEBoot-mkconfig'.
* Support multiple terminals in `grub-mkconfig'. * Support multiple terminals in `VasEBoot-mkconfig'.
* Regexp support. * Regexp support.
@ -423,17 +423,17 @@ New in 1.99:
* sunpc partition table support. * sunpc partition table support.
* Add a number of new language features to GRUB script: `for', `while', * Add a number of new language features to VasEBoot script: `for', `while',
`until', `elif', function parameters, `break', `continue', `shift', `until', `elif', function parameters, `break', `continue', `shift',
multi-line quoted strings, positional parameters with `setparams', multi-line quoted strings, positional parameters with `setparams',
`return', filename wildcard expansion, and `!'. `return', filename wildcard expansion, and `!'.
* Support nested partition tables. GRUB now prefers to name partitions * Support nested partition tables. VasEBoot now prefers to name partitions
in the form `(hd0,msdos1,bsd1)' rather than `(hd0,1,a)'. in the form `(hd0,msdos1,bsd1)' rather than `(hd0,1,a)'.
* Speed up consecutive hostdisk operations on the same device. * Speed up consecutive hostdisk operations on the same device.
* Compile parts of `grub-emu' as modules. * Compile parts of `VasEBoot-emu' as modules.
New in 1.98 - 2010-03-06: New in 1.98 - 2010-03-06:
@ -443,18 +443,18 @@ New in 1.98 - 2010-03-06:
* MIPS support. * MIPS support.
* Saved default menu entry support, with new utilities `grub-reboot' and * Saved default menu entry support, with new utilities `VasEBoot-reboot' and
`grub-set-default'. `VasEBoot-set-default'.
* Unit testing framework. * Unit testing framework.
* Support for multiple terminals. * Support for multiple terminals.
* Encrypted password support, with a new utility `grub-mkpasswd-pbkdf2'. * Encrypted password support, with a new utility `VasEBoot-mkpasswd-pbkdf2'.
* `grub-mkfloppy' removed; use `grub-mkrescue' to create floppy images. * `VasEBoot-mkfloppy' removed; use `VasEBoot-mkrescue' to create floppy images.
* Add grub-probe support for GNU/Hurd. * Add VasEBoot-probe support for GNU/Hurd.
* Add support for gettext. * Add support for gettext.
@ -482,7 +482,7 @@ New in 1.97:
* Add support for RAID levels 4,6 and 10. * Add support for RAID levels 4,6 and 10.
* update-grub is replaced by grub-mkconfig. * update-VasEBoot is replaced by VasEBoot-mkconfig.
* When booting from PXE, PXE can be used to load files. * When booting from PXE, PXE can be used to load files.
@ -510,7 +510,7 @@ New in 1.97:
* Create partmap.lst and use it to automatically load partition map * Create partmap.lst and use it to automatically load partition map
modules. modules.
* grub-mkconfig supports os-prober to add operating systems to the * VasEBoot-mkconfig supports os-prober to add operating systems to the
boot menu. boot menu.
* The ATA driver supports devices bigger than 2 TiB. * The ATA driver supports devices bigger than 2 TiB.
@ -525,26 +525,26 @@ New in 1.97:
* Support for direct access to AT keyboards. * Support for direct access to AT keyboards.
* New utility `grub-fstest'. * New utility `VasEBoot-fstest'.
New in 1.96 - 2008-02-03: New in 1.96 - 2008-02-03:
* The license term is changed to GNU General Public License Version 3. * The license term is changed to GNU General Public License Version 3.
* grub-emu is made optional. Now you have to use * VasEBoot-emu is made optional. Now you have to use
`--enable-grub-emu' to enable it. `--enable-VasEBoot-emu' to enable it.
* Add Multiboot2 support. * Add Multiboot2 support.
* grub-emu can access the host filesystem now. * VasEBoot-emu can access the host filesystem now.
* Add support for the NTFS, cpio/tar and Reiserfs filesystems. * Add support for the NTFS, cpio/tar and Reiserfs filesystems.
* Add support for ATA/ATAPI. * Add support for ATA/ATAPI.
* Add update-grub script to generate grub.cfg. * Add update-VasEBoot script to generate VasEBoot.cfg.
* Add grub-mkrescue script to generate floppy or ElTorito images * Add VasEBoot-mkrescue script to generate floppy or ElTorito images
(i386-pc only). (i386-pc only).
* Add support for background images in gfxterm (background_image command). * Add support for background images in gfxterm (background_image command).
@ -553,7 +553,7 @@ New in 1.96 - 2008-02-03:
* GPT is now enabled in i386-pc target. * GPT is now enabled in i386-pc target.
* Add grub-install for EFI. * Add VasEBoot-install for EFI.
* Ported to the following new platforms: Efika, coreboot (a.k.a. LinuxBIOS), * Ported to the following new platforms: Efika, coreboot (a.k.a. LinuxBIOS),
OLPC XO. OLPC XO.
@ -568,8 +568,8 @@ New in 1.95 - 2006-10-15:
* Number partitions from 1 instead of 0. For instance, the first * Number partitions from 1 instead of 0. For instance, the first
partition of "hd0" is now "hd0,1" but not "hd0,0". partition of "hd0" is now "hd0,1" but not "hd0,0".
* grub-probefs is renamed to grub-probe, and supports printing a * VasEBoot-probefs is renamed to VasEBoot-probe, and supports printing a
guessed OS device name and a GRUB drive name. guessed OS device name and a VasEBoot drive name.
* RAID and LVM support is added. * RAID and LVM support is added.
@ -591,9 +591,9 @@ New in 1.94 - 2006-06-04:
* Use --with-platform to specify a boot environment. For now, efi, * Use --with-platform to specify a boot environment. For now, efi,
ieee1275 and pc are supported. ieee1275 and pc are supported.
* Use the filename "kernel.elf" instead of "grubof" on ieee1275. * Use the filename "kernel.elf" instead of "VasEBootof" on ieee1275.
* Install GRUB into pkglibdir instead of pkgdatadir. * Install VasEBoot into pkglibdir instead of pkgdatadir.
* Support environmental variables. You can export variables by the * Support environmental variables. You can export variables by the
command "export". command "export".
@ -646,17 +646,17 @@ New in 1.91 - 2005-10-15:
* Add support for x86_64. * Add support for x86_64.
* GRUB itself is a Multiboot-compliant kernel. * VasEBoot itself is a Multiboot-compliant kernel.
* Add new filesystems: XFS, SFS, and AFFS. * Add new filesystems: XFS, SFS, and AFFS.
New in 1.90 - 2005-08-07: New in 1.90 - 2005-08-07:
* Rename the project name PUPA to GRUB. Now this version is the * Rename the project name PUPA to VasEBoot. Now this version is the
developmental version of GRUB officially. developmental version of VasEBoot officially.
* The GRUB emulator ``grub-emu'' is added. * The VasEBoot emulator ``VasEBoot-emu'' is added.
* Add support for newworld Mac. This should work with other * Add support for newworld Mac. This should work with other
PowerPC-based machines as well, if they use IEEE 1275 PowerPC-based machines as well, if they use IEEE 1275

18
README
View File

@ -1,20 +1,20 @@
This is GRUB 2, the second version of the GRand Unified Bootloader. This is VasEBoot 2, the second version of the GRand Unified Bootloader.
GRUB 2 is rewritten from scratch to make GNU GRUB cleaner, safer, more VasEBoot 2 is rewritten from scratch to make GNU VasEBoot cleaner, safer, more
robust, more powerful, and more portable. robust, more powerful, and more portable.
See the file NEWS for a description of recent changes to GRUB 2. See the file NEWS for a description of recent changes to VasEBoot 2.
See the file INSTALL for instructions on how to build and install the See the file INSTALL for instructions on how to build and install the
GRUB 2 data and program files. VasEBoot 2 data and program files.
Please visit the official web page of GRUB 2, for more information. Please visit the official web page of VasEBoot 2, for more information.
The URL is <http://www.gnu.org/software/grub/grub.html>. The URL is <http://www.gnu.org/software/VasEBoot/VasEBoot.html>.
More extensive documentation is available in the Info manual, More extensive documentation is available in the Info manual,
accessible using 'info grub' after building and installing GRUB 2. accessible using 'info VasEBoot' after building and installing VasEBoot 2.
There are a number of important user-visible differences from the There are a number of important user-visible differences from the
first version of GRUB, now known as GRUB Legacy. For a summary, please first version of VasEBoot, now known as VasEBoot Legacy. For a summary, please
see: see:
info grub Introduction 'Changes from GRUB Legacy' info VasEBoot Introduction 'Changes from VasEBoot Legacy'

4
THANKS
View File

@ -1,10 +1,10 @@
GRUB 2 would not be what it is today without the invaluable help of VasEBoot 2 would not be what it is today without the invaluable help of
everybody who was kind enough to spend time testing it and reporting everybody who was kind enough to spend time testing it and reporting
bugs. bugs.
The following people made especially gracious contributions of their The following people made especially gracious contributions of their
time and energy in helping to track down bugs, add new features, and time and energy in helping to track down bugs, add new features, and
generally assist in the GRUB 2 maintainership process: generally assist in the VasEBoot 2 maintainership process:
Andrey Shuvikov <mr_hyro@yahoo.com> Andrey Shuvikov <mr_hyro@yahoo.com>
Bibo Mao <bibo.mao@intel.com> Bibo Mao <bibo.mao@intel.com>

8
TODO
View File

@ -1,9 +1,9 @@
Before working on improving GRUB, it's very important that you Before working on improving VasEBoot, it's very important that you
make contact with the core GRUB developers. Things herein might be make contact with the core VasEBoot developers. Things herein might be
slightly out of date or otherwise not easy to understand at first slightly out of date or otherwise not easy to understand at first
glance. So write to <grub-devel@gnu.org> first. glance. So write to <VasEBoot-devel@gnu.org> first.
For bug tracking, refer to: For bug tracking, refer to:
http://savannah.gnu.org/bugs/?group=grub http://savannah.gnu.org/bugs/?group=VasEBoot

View File

@ -10,7 +10,7 @@ CCAS=$(TARGET_CC)
RANLIB=$(TARGET_RANLIB) RANLIB=$(TARGET_RANLIB)
STRIP=$(TARGET_STRIP) STRIP=$(TARGET_STRIP)
MACHO2IMG=$(top_builddir)/grub-macho2img MACHO2IMG=$(top_builddir)/VasEBoot-macho2img
AM_CFLAGS = $(TARGET_CFLAGS) AM_CFLAGS = $(TARGET_CFLAGS)
AM_LDFLAGS = $(TARGET_LDFLAGS) AM_LDFLAGS = $(TARGET_LDFLAGS)
@ -26,22 +26,22 @@ CFLAGS_LIBRARY += $(CFLAGS_PLATFORM) -fno-builtin
CPPFLAGS_LIBRARY += $(CPPFLAGS_PLATFORM) CPPFLAGS_LIBRARY += $(CPPFLAGS_PLATFORM)
CCASFLAGS_LIBRARY += $(CCASFLAGS_PLATFORM) CCASFLAGS_LIBRARY += $(CCASFLAGS_PLATFORM)
build-grub-pep2elf$(BUILD_EXEEXT): $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c build-VasEBoot-pep2elf$(BUILD_EXEEXT): $(top_srcdir)/util/VasEBoot-pe2elf.c $(top_srcdir)/VasEBoot-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=64 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pep2elf\" $^ $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DVasEBoot_BUILD=1 -DVasEBoot_TARGET_WORDSIZE=64 -DVasEBoot_UTIL=1 -DVasEBoot_BUILD_PROGRAM_NAME=\"build-VasEBoot-pep2elf\" $^
CLEANFILES += build-grub-pep2elf$(BUILD_EXEEXT) CLEANFILES += build-VasEBoot-pep2elf$(BUILD_EXEEXT)
build-grub-pe2elf$(BUILD_EXEEXT): $(top_srcdir)/util/grub-pe2elf.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c build-VasEBoot-pe2elf$(BUILD_EXEEXT): $(top_srcdir)/util/VasEBoot-pe2elf.c $(top_srcdir)/VasEBoot-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_BUILD=1 -DGRUB_TARGET_WORDSIZE=32 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-pe2elf\" $^ $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DVasEBoot_BUILD=1 -DVasEBoot_TARGET_WORDSIZE=32 -DVasEBoot_UTIL=1 -DVasEBoot_BUILD_PROGRAM_NAME=\"build-VasEBoot-pe2elf\" $^
CLEANFILES += build-grub-pe2elf$(BUILD_EXEEXT) CLEANFILES += build-VasEBoot-pe2elf$(BUILD_EXEEXT)
# gentrigtables # gentrigtables
gentrigtables$(BUILD_EXEEXT): gentrigtables.c gentrigtables$(BUILD_EXEEXT): gentrigtables.c
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) $< $(BUILD_LIBM) $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) $< $(BUILD_LIBM)
CLEANFILES += gentrigtables$(BUILD_EXEEXT) CLEANFILES += gentrigtables$(BUILD_EXEEXT)
build-grub-module-verifier$(BUILD_EXEEXT): $(top_srcdir)/util/grub-module-verifier.c $(top_srcdir)/util/grub-module-verifier32.c $(top_srcdir)/util/grub-module-verifier64.c $(top_srcdir)/grub-core/kern/emu/misc.c $(top_srcdir)/util/misc.c build-VasEBoot-module-verifier$(BUILD_EXEEXT): $(top_srcdir)/util/VasEBoot-module-verifier.c $(top_srcdir)/util/VasEBoot-module-verifier32.c $(top_srcdir)/util/VasEBoot-module-verifier64.c $(top_srcdir)/VasEBoot-core/kern/emu/misc.c $(top_srcdir)/util/misc.c
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DGRUB_BUILD=1 -DGRUB_UTIL=1 -DGRUB_BUILD_PROGRAM_NAME=\"build-grub-module-verifier\" $^ $(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) -DVasEBoot_BUILD=1 -DVasEBoot_UTIL=1 -DVasEBoot_BUILD_PROGRAM_NAME=\"build-VasEBoot-module-verifier\" $^
CLEANFILES += build-grub-module-verifier$(BUILD_EXEEXT) CLEANFILES += build-VasEBoot-module-verifier$(BUILD_EXEEXT)
# trigtables.c # trigtables.c
trigtables.c: gentrigtables$(BUILD_EXEEXT) gentrigtables.c $(top_srcdir)/configure.ac trigtables.c: gentrigtables$(BUILD_EXEEXT) gentrigtables.c $(top_srcdir)/configure.ac
@ -49,223 +49,223 @@ trigtables.c: gentrigtables$(BUILD_EXEEXT) gentrigtables.c $(top_srcdir)/configu
CLEANFILES += trigtables.c CLEANFILES += trigtables.c
# XXX Use Automake's LEX & YACC support # XXX Use Automake's LEX & YACC support
grub_script.tab.h: script/parser.y VasEBoot_script.tab.h: script/parser.y
$(YACC) -d -p grub_script_yy -b grub_script $< $(YACC) -d -p VasEBoot_script_yy -b VasEBoot_script $<
grub_script.tab.c: grub_script.tab.h VasEBoot_script.tab.c: VasEBoot_script.tab.h
CLEANFILES += grub_script.tab.c grub_script.tab.h CLEANFILES += VasEBoot_script.tab.c VasEBoot_script.tab.h
# For the lexer. # For the lexer.
grub_script.yy.h: script/yylex.l VasEBoot_script.yy.h: script/yylex.l
$(LEX) -o grub_script.yy.c --header-file=grub_script.yy.h $< $(LEX) -o VasEBoot_script.yy.c --header-file=VasEBoot_script.yy.h $<
grub_script.yy.c: grub_script.yy.h VasEBoot_script.yy.c: VasEBoot_script.yy.h
rs_decoder.h: $(srcdir)/lib/reed_solomon.c rs_decoder.h: $(srcdir)/lib/reed_solomon.c
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Os -I$(top_builddir) -S -DSTANDALONE -o $@ $< -g0 -mregparm=3 -ffreestanding $(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Os -I$(top_builddir) -S -DSTANDALONE -o $@ $< -g0 -mregparm=3 -ffreestanding
CLEANFILES += grub_script.yy.c grub_script.yy.h CLEANFILES += VasEBoot_script.yy.c VasEBoot_script.yy.h
include $(srcdir)/Makefile.core.am include $(srcdir)/Makefile.core.am
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/cache.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/cache.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/command.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/command.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/device.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/device.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/disk.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/disk.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/dl.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/dl.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/env.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env_private.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/env_private.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/err.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/err.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/file.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/file.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/fs.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/fs.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i18n.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/i18n.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/kernel.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/kernel.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/list.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/list.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/misc.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/misc.h
if COND_emu if COND_emu
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/compiler-rt-emu.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/compiler-rt-emu.h
else else
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/compiler-rt.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/compiler-rt.h
endif endif
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/mm.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/parser.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/parser.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/partition.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/partition.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/term.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/term.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/time.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/time.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm_private.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/mm_private.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/net.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/net.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/tpm.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/tpm.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/memory.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/memory.h
if COND_i386_pc if COND_i386_pc
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h KERNEL_HEADER_FILES += $(top_builddir)/include/VasEBoot/machine/kernel.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/pxe.h KERNEL_HEADER_FILES += $(top_builddir)/include/VasEBoot/machine/pxe.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/int.h KERNEL_HEADER_FILES += $(top_builddir)/include/VasEBoot/machine/int.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/i386/tsc.h
endif endif
if COND_i386_efi if COND_i386_efi
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/efi/efi.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/efi/disk.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/i386/tsc.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/acpi.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/pci.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pmtimer.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/i386/pmtimer.h
endif endif
if COND_i386_coreboot if COND_i386_coreboot
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/i386/tsc.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/coreboot/lbio.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/i386/coreboot/lbio.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/video.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video_fb.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/video_fb.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gfxterm.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/gfxterm.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/font.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/font.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bufio.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/bufio.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/acpi.h
endif endif
if COND_i386_multiboot if COND_i386_multiboot
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/i386/tsc.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/acpi.h
endif endif
if COND_i386_qemu if COND_i386_qemu
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/pci.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/i386/tsc.h
endif endif
if COND_i386_ieee1275 if COND_i386_ieee1275
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/ieee1275/ieee1275.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/terminfo.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/extcmd.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/lib/arg.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/i386/tsc.h
endif endif
if COND_i386_xen if COND_i386_xen
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/xen.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/xen.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/xen/hypercall.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/i386/xen/hypercall.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/terminfo.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/extcmd.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/lib/arg.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/loader.h
endif endif
if COND_x86_64_xen if COND_x86_64_xen
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/xen.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/xen.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/x86_64/xen/hypercall.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/x86_64/xen/hypercall.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/terminfo.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/extcmd.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/lib/arg.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/loader.h
endif endif
if COND_x86_64_efi if COND_x86_64_efi
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/efi/efi.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/efi/disk.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/i386/tsc.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/pci.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/acpi.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pmtimer.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/i386/pmtimer.h
endif endif
if COND_ia64_efi if COND_ia64_efi
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/efi/efi.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/efi/disk.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/acpi.h
endif endif
if COND_mips if COND_mips
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/kernel.h KERNEL_HEADER_FILES += $(top_builddir)/include/VasEBoot/cpu/kernel.h
endif endif
if COND_mips_arc if COND_mips_arc
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/extcmd.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arc/arc.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/arc/arc.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/terminfo.h
endif endif
if COND_mips_qemu_mips if COND_mips_qemu_mips
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/keyboard_layouts.h KERNEL_HEADER_FILES += $(top_builddir)/include/VasEBoot/keyboard_layouts.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h KERNEL_HEADER_FILES += $(top_builddir)/include/VasEBoot/machine/kernel.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/serial.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/serial.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/loader.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/terminfo.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/extcmd.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/lib/arg.h
endif endif
if COND_mips_loongson if COND_mips_loongson
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/keyboard_layouts.h KERNEL_HEADER_FILES += $(top_builddir)/include/VasEBoot/keyboard_layouts.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h KERNEL_HEADER_FILES += $(top_builddir)/include/VasEBoot/machine/kernel.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/time.h KERNEL_HEADER_FILES += $(top_builddir)/include/VasEBoot/machine/time.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/video.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video_fb.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/video_fb.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gfxterm.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/gfxterm.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/font.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/font.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bufio.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/bufio.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/pci.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/cs5536.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/cs5536.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/pci.h KERNEL_HEADER_FILES += $(top_builddir)/include/VasEBoot/machine/pci.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/serial.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/serial.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/loader.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/terminfo.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/extcmd.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/lib/arg.h
endif endif
if COND_mips_qemu_mips if COND_mips_qemu_mips
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h KERNEL_HEADER_FILES += $(top_builddir)/include/VasEBoot/machine/memory.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h KERNEL_HEADER_FILES += $(top_builddir)/include/VasEBoot/machine/kernel.h
endif endif
if COND_powerpc_ieee1275 if COND_powerpc_ieee1275
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/ieee1275/ieee1275.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/terminfo.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/extcmd.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/lib/arg.h
endif endif
if COND_sparc64_ieee1275 if COND_sparc64_ieee1275
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/ieee1275/ieee1275.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sparc64/ieee1275/ieee1275.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/sparc64/ieee1275/ieee1275.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/terminfo.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/extcmd.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/lib/arg.h
endif endif
if COND_arm_uboot if COND_arm_uboot
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/uboot/uboot.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/uboot/uboot.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/uboot/disk.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/uboot/disk.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/extcmd.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/lib/arg.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/system.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/arm/system.h
endif endif
if COND_arm_efi if COND_arm_efi
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/efi/loader.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/arm/efi/loader.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/efi/efi.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/efi/disk.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/system.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/arm/system.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/acpi.h
endif endif
if COND_arm64_efi if COND_arm64_efi
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/efi/efi.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/efi/disk.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/acpi.h
endif endif
if COND_emu if COND_emu
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/datetime.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/datetime.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/misc.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/emu/misc.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/net.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/emu/net.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/hostdisk.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/emu/hostdisk.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/hostfile.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/emu/hostfile.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/extcmd.h
if COND_GRUB_EMU_SDL if COND_VasEBoot_EMU_SDL
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sdl.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/sdl.h
endif endif
if COND_GRUB_EMU_PCI if COND_VasEBoot_EMU_PCI
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libpciaccess.h KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/libpciaccess.h
endif endif
endif endif
@ -278,7 +278,7 @@ CLEANFILES += symlist.h
BUILT_SOURCES += symlist.h BUILT_SOURCES += symlist.h
symlist.c: symlist.h gensymlist.sh symlist.c: symlist.h gensymlist.sh
$(TARGET_CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) $(CPPFLAGS) -DGRUB_SYMBOL_GENERATOR=1 symlist.h > symlist.p || (rm -f symlist.p; exit 1) $(TARGET_CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) $(CPPFLAGS) -DVasEBoot_SYMBOL_GENERATOR=1 symlist.h > symlist.p || (rm -f symlist.p; exit 1)
cat symlist.p | /bin/sh $(srcdir)/gensymlist.sh $(top_builddir)/config.h $(KERNEL_HEADER_FILES) >$@ || (rm -f $@; exit 1) cat symlist.p | /bin/sh $(srcdir)/gensymlist.sh $(top_builddir)/config.h $(KERNEL_HEADER_FILES) >$@ || (rm -f $@; exit 1)
rm -f symlist.p rm -f symlist.p
CLEANFILES += symlist.c CLEANFILES += symlist.c
@ -293,7 +293,7 @@ endif
noinst_DATA += kernel_syms.lst noinst_DATA += kernel_syms.lst
kernel_syms.lst: $(KERNEL_HEADER_FILES) $(top_builddir)/config.h kernel_syms.lst: $(KERNEL_HEADER_FILES) $(top_builddir)/config.h
$(TARGET_CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) $(CPPFLAGS) $(CFLAGS) -DGRUB_SYMBOL_GENERATOR=1 $^ >kernel_syms.input $(TARGET_CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) $(CPPFLAGS) $(CFLAGS) -DVasEBoot_SYMBOL_GENERATOR=1 $^ >kernel_syms.input
cat kernel_syms.input | grep -v '^#' | sed -n \ cat kernel_syms.input | grep -v '^#' | sed -n \
-e '/EXPORT_FUNC *([a-zA-Z0-9_]*)/{s/.*EXPORT_FUNC *(\([a-zA-Z0-9_]*\)).*/defined kernel '"$(ASM_PREFIX)"'\1/;p;}' \ -e '/EXPORT_FUNC *([a-zA-Z0-9_]*)/{s/.*EXPORT_FUNC *(\([a-zA-Z0-9_]*\)).*/defined kernel '"$(ASM_PREFIX)"'\1/;p;}' \
-e '/EXPORT_VAR *([a-zA-Z0-9_]*)/{s/.*EXPORT_VAR *(\([a-zA-Z0-9_]*\)).*/defined kernel '"$(ASM_PREFIX)"'\1/;p;}' \ -e '/EXPORT_VAR *([a-zA-Z0-9_]*)/{s/.*EXPORT_VAR *(\([a-zA-Z0-9_]*\)).*/defined kernel '"$(ASM_PREFIX)"'\1/;p;}' \
@ -302,18 +302,18 @@ kernel_syms.lst: $(KERNEL_HEADER_FILES) $(top_builddir)/config.h
CLEANFILES += kernel_syms.lst CLEANFILES += kernel_syms.lst
if COND_emu if COND_emu
kern/emu/grub_emu-main.$(OBJEXT):grub_emu_init.h kern/emu/VasEBoot_emu-main.$(OBJEXT):VasEBoot_emu_init.h
grub_emu-grub_emu_init.$(OBJEXT):grub_emu_init.h VasEBoot_emu-VasEBoot_emu_init.$(OBJEXT):VasEBoot_emu_init.h
kern/emu/grub_emu_dyn-main.$(OBJEXT):grub_emu_init.h kern/emu/VasEBoot_emu_dyn-main.$(OBJEXT):VasEBoot_emu_init.h
grub_emu_dyn-grub_emu_init.$(OBJEXT):grub_emu_init.h VasEBoot_emu_dyn-VasEBoot_emu_init.$(OBJEXT):VasEBoot_emu_init.h
grub_emu_init.h: genemuinitheader.sh $(MODULE_FILES) VasEBoot_emu_init.h: genemuinitheader.sh $(MODULE_FILES)
rm -f $@; echo $(MODULE_FILES) | sh $(srcdir)/genemuinitheader.sh $(TARGET_NM) > $@ rm -f $@; echo $(MODULE_FILES) | sh $(srcdir)/genemuinitheader.sh $(TARGET_NM) > $@
CLEANFILES += grub_emu_init.h CLEANFILES += VasEBoot_emu_init.h
grub_emu_init.c: grub_emu_init.h genemuinit.sh $(MODULE_FILES) VasEBoot_emu_init.c: VasEBoot_emu_init.h genemuinit.sh $(MODULE_FILES)
rm -f $@; echo $(MODULE_FILES) | sh $(srcdir)/genemuinit.sh $(TARGET_NM) > $@ rm -f $@; echo $(MODULE_FILES) | sh $(srcdir)/genemuinit.sh $(TARGET_NM) > $@
CLEANFILES += grub_emu_init.c CLEANFILES += VasEBoot_emu_init.c
endif endif
# List files # List files
@ -379,7 +379,7 @@ platform_DATA += video.lst
CLEANFILES += video.lst CLEANFILES += video.lst
# but, crypto.lst is simply copied # but, crypto.lst is simply copied
crypto.lst: $(srcdir)/lib/libgcrypt-grub/cipher/crypto.lst crypto.lst: $(srcdir)/lib/libgcrypt-VasEBoot/cipher/crypto.lst
cp $^ $@ cp $^ $@
platform_DATA += crypto.lst platform_DATA += crypto.lst
CLEANFILES += crypto.lst CLEANFILES += crypto.lst
@ -397,7 +397,7 @@ moddep.lst: syminfo.lst genmoddep.awk video.lst
platform_DATA += moddep.lst platform_DATA += moddep.lst
CLEANFILES += config.log syminfo.lst moddep.lst CLEANFILES += config.log syminfo.lst moddep.lst
$(MOD_FILES): %.mod : genmod.sh moddep.lst %.module$(EXEEXT) build-grub-module-verifier$(BUILD_EXEEXT) $(MOD_FILES): %.mod : genmod.sh moddep.lst %.module$(EXEEXT) build-VasEBoot-module-verifier$(BUILD_EXEEXT)
TARGET_OBJ2ELF=@TARGET_OBJ2ELF@ sh $^ $@ TARGET_OBJ2ELF=@TARGET_OBJ2ELF@ sh $^ $@
platform_DATA += $(MOD_FILES) platform_DATA += $(MOD_FILES)
platform_DATA += modinfo.sh platform_DATA += modinfo.sh

View File

@ -26,14 +26,14 @@ transform_data = {
transform_data = { transform_data = {
installdir = platform; installdir = platform;
name = gdb_grub; name = gdb_VasEBoot;
common = gdb_grub.in; common = gdb_VasEBoot.in;
}; };
transform_data = { transform_data = {
installdir = platform; installdir = platform;
name = grub.chrp; name = VasEBoot.chrp;
common = boot/powerpc/grub.chrp.in; common = boot/powerpc/VasEBoot.chrp.in;
enable = powerpc_ieee1275; enable = powerpc_ieee1275;
}; };
@ -86,8 +86,8 @@ kernel = {
mips_arc_ldflags = '-Wl,-Ttext,$(TARGET_LINK_ADDR)'; mips_arc_ldflags = '-Wl,-Ttext,$(TARGET_LINK_ADDR)';
mips_qemu_mips_ldflags = '-Wl,-Ttext,0x80200000'; mips_qemu_mips_ldflags = '-Wl,-Ttext,0x80200000';
mips_arc_cppflags = '-DGRUB_DECOMPRESSOR_LINK_ADDR=$(TARGET_DECOMPRESSOR_LINK_ADDR)'; mips_arc_cppflags = '-DVasEBoot_DECOMPRESSOR_LINK_ADDR=$(TARGET_DECOMPRESSOR_LINK_ADDR)';
i386_qemu_cppflags = '-DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)'; i386_qemu_cppflags = '-DVasEBoot_BOOT_MACHINE_LINK_ADDR=$(VasEBoot_BOOT_MACHINE_LINK_ADDR)';
emu_cflags = '$(CFLAGS_GNULIB)'; emu_cflags = '$(CFLAGS_GNULIB)';
emu_cppflags = '$(CPPFLAGS_GNULIB)'; emu_cppflags = '$(CPPFLAGS_GNULIB)';
arm_uboot_ldflags = '-Wl,-r,-d'; arm_uboot_ldflags = '-Wl,-r,-d';
@ -334,11 +334,11 @@ kernel = {
}; };
program = { program = {
name = grub-emu; name = VasEBoot-emu;
mansection = 1; mansection = 1;
emu = kern/emu/full.c; emu = kern/emu/full.c;
emu_nodist = grub_emu_init.c; emu_nodist = VasEBoot_emu_init.c;
ldadd = 'kernel.exec$(EXEEXT)'; ldadd = 'kernel.exec$(EXEEXT)';
ldadd = '$(MODULE_FILES)'; ldadd = '$(MODULE_FILES)';
@ -348,7 +348,7 @@ program = {
}; };
program = { program = {
name = grub-emu-lite; name = VasEBoot-emu-lite;
emu = kern/emu/lite.c; emu = kern/emu/lite.c;
emu_nodist = symlist.c; emu_nodist = symlist.c;
@ -369,8 +369,8 @@ image = {
i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x7C00'; i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x7C00';
i386_qemu_ldflags = '$(TARGET_IMG_LDFLAGS)'; i386_qemu_ldflags = '$(TARGET_IMG_LDFLAGS)';
i386_qemu_ldflags = '$(TARGET_IMG_BASE_LDOPT),$(GRUB_BOOT_MACHINE_LINK_ADDR)'; i386_qemu_ldflags = '$(TARGET_IMG_BASE_LDOPT),$(VasEBoot_BOOT_MACHINE_LINK_ADDR)';
i386_qemu_ccasflags = '-DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)'; i386_qemu_ccasflags = '-DVasEBoot_BOOT_MACHINE_LINK_ADDR=$(VasEBoot_BOOT_MACHINE_LINK_ADDR)';
sparc64_ieee1275_objcopyflags = '-O a.out-sunos-big'; sparc64_ieee1275_objcopyflags = '-O a.out-sunos-big';
sparc64_ieee1275_ldflags = ' -Wl,-Ttext=0x4000'; sparc64_ieee1275_ldflags = ' -Wl,-Ttext=0x4000';
@ -460,7 +460,7 @@ image = {
common = lib/xzembed/xz_dec_stream.c; common = lib/xzembed/xz_dec_stream.c;
common = kern/compiler-rt.c; common = kern/compiler-rt.c;
cppflags = '-I$(srcdir)/lib/posix_wrap -I$(srcdir)/lib/xzembed -DGRUB_EMBED_DECOMPRESSOR=1'; cppflags = '-I$(srcdir)/lib/posix_wrap -I$(srcdir)/lib/xzembed -DVasEBoot_EMBED_DECOMPRESSOR=1';
objcopyflags = '-O binary'; objcopyflags = '-O binary';
mips_ldflags = '-Wl,-Ttext,$(TARGET_DECOMPRESSOR_LINK_ADDR)'; mips_ldflags = '-Wl,-Ttext,$(TARGET_DECOMPRESSOR_LINK_ADDR)';
@ -473,7 +473,7 @@ image = {
mips = boot/mips/startup_raw.S; mips = boot/mips/startup_raw.S;
common = boot/decompressor/none.c; common = boot/decompressor/none.c;
cppflags = '-DGRUB_EMBED_DECOMPRESSOR=1'; cppflags = '-DVasEBoot_EMBED_DECOMPRESSOR=1';
objcopyflags = '-O binary'; objcopyflags = '-O binary';
mips_ldflags = '-Wl,-Ttext,$(TARGET_DECOMPRESSOR_LINK_ADDR)'; mips_ldflags = '-Wl,-Ttext,$(TARGET_DECOMPRESSOR_LINK_ADDR)';
@ -606,7 +606,7 @@ module = {
common = commands/lspci.c; common = commands/lspci.c;
enable = emu; enable = emu;
condition = COND_GRUB_EMU_PCI; condition = COND_VasEBoot_EMU_PCI;
}; };
module = { module = {
@ -1557,7 +1557,7 @@ module = {
name = crypto; name = crypto;
common = lib/crypto.c; common = lib/crypto.c;
extra_dist = lib/libgcrypt-grub/cipher/crypto.lst; extra_dist = lib/libgcrypt-VasEBoot/cipher/crypto.lst;
}; };
module = { module = {
@ -1688,7 +1688,7 @@ module = {
module = { module = {
name = multiboot2; name = multiboot2;
cppflags = "-DGRUB_USE_MULTIBOOT2"; cppflags = "-DVasEBoot_USE_MULTIBOOT2";
common = loader/multiboot.c; common = loader/multiboot.c;
common = lib/cmdline.c; common = lib/cmdline.c;
@ -1856,10 +1856,10 @@ module = {
common = commands/menuentry.c; common = commands/menuentry.c;
common = unidata.c; common = unidata.c;
common_nodist = grub_script.tab.c; common_nodist = VasEBoot_script.tab.c;
common_nodist = grub_script.yy.c; common_nodist = VasEBoot_script.yy.c;
common_nodist = grub_script.tab.h; common_nodist = VasEBoot_script.tab.h;
common_nodist = grub_script.yy.h; common_nodist = VasEBoot_script.yy.h;
extra_dist = script/yylex.l; extra_dist = script/yylex.l;
extra_dist = script/parser.y; extra_dist = script/parser.y;
@ -2184,7 +2184,7 @@ module = {
name = sdl; name = sdl;
emu = video/emu/sdl.c; emu = video/emu/sdl.c;
enable = emu; enable = emu;
condition = COND_GRUB_EMU_SDL; condition = COND_VasEBoot_EMU_SDL;
}; };
module = { module = {
@ -2348,28 +2348,28 @@ module = {
module = { module = {
name = mpi; name = mpi;
common = lib/libgcrypt-grub/mpi/mpiutil.c; common = lib/libgcrypt-VasEBoot/mpi/mpiutil.c;
common = lib/libgcrypt-grub/mpi/mpi-bit.c; common = lib/libgcrypt-VasEBoot/mpi/mpi-bit.c;
common = lib/libgcrypt-grub/mpi/mpi-add.c; common = lib/libgcrypt-VasEBoot/mpi/mpi-add.c;
common = lib/libgcrypt-grub/mpi/mpi-mul.c; common = lib/libgcrypt-VasEBoot/mpi/mpi-mul.c;
common = lib/libgcrypt-grub/mpi/mpi-mod.c; common = lib/libgcrypt-VasEBoot/mpi/mpi-mod.c;
common = lib/libgcrypt-grub/mpi/mpi-gcd.c; common = lib/libgcrypt-VasEBoot/mpi/mpi-gcd.c;
common = lib/libgcrypt-grub/mpi/mpi-div.c; common = lib/libgcrypt-VasEBoot/mpi/mpi-div.c;
common = lib/libgcrypt-grub/mpi/mpi-cmp.c; common = lib/libgcrypt-VasEBoot/mpi/mpi-cmp.c;
common = lib/libgcrypt-grub/mpi/mpi-inv.c; common = lib/libgcrypt-VasEBoot/mpi/mpi-inv.c;
common = lib/libgcrypt-grub/mpi/mpi-pow.c; common = lib/libgcrypt-VasEBoot/mpi/mpi-pow.c;
common = lib/libgcrypt-grub/mpi/mpi-mpow.c; common = lib/libgcrypt-VasEBoot/mpi/mpi-mpow.c;
common = lib/libgcrypt-grub/mpi/mpih-lshift.c; common = lib/libgcrypt-VasEBoot/mpi/mpih-lshift.c;
common = lib/libgcrypt-grub/mpi/mpih-mul.c; common = lib/libgcrypt-VasEBoot/mpi/mpih-mul.c;
common = lib/libgcrypt-grub/mpi/mpih-mul1.c; common = lib/libgcrypt-VasEBoot/mpi/mpih-mul1.c;
common = lib/libgcrypt-grub/mpi/mpih-mul2.c; common = lib/libgcrypt-VasEBoot/mpi/mpih-mul2.c;
common = lib/libgcrypt-grub/mpi/mpih-mul3.c; common = lib/libgcrypt-VasEBoot/mpi/mpih-mul3.c;
common = lib/libgcrypt-grub/mpi/mpih-add1.c; common = lib/libgcrypt-VasEBoot/mpi/mpih-add1.c;
common = lib/libgcrypt-grub/mpi/mpih-sub1.c; common = lib/libgcrypt-VasEBoot/mpi/mpih-sub1.c;
common = lib/libgcrypt-grub/mpi/mpih-div.c; common = lib/libgcrypt-VasEBoot/mpi/mpih-div.c;
common = lib/libgcrypt-grub/mpi/mpicoder.c; common = lib/libgcrypt-VasEBoot/mpi/mpicoder.c;
common = lib/libgcrypt-grub/mpi/mpih-rshift.c; common = lib/libgcrypt-VasEBoot/mpi/mpih-rshift.c;
common = lib/libgcrypt-grub/mpi/mpi-inline.c; common = lib/libgcrypt-VasEBoot/mpi/mpi-inline.c;
common = lib/libgcrypt_wrap/mem.c; common = lib/libgcrypt_wrap/mem.c;
cflags = '$(CFLAGS_GCRY) -Wno-redundant-decls -Wno-sign-compare'; cflags = '$(CFLAGS_GCRY) -Wno-redundant-decls -Wno-sign-compare';

View File

@ -1,36 +1,36 @@
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2010 Free Software Foundation, Inc. * Copyright (C) 2010 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/types.h> #include <VasEBoot/types.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/decompressor.h> #include <VasEBoot/decompressor.h>
void * void *
grub_memset (void *s, int c, grub_size_t len) VasEBoot_memset (void *s, int c, VasEBoot_size_t len)
{ {
grub_uint8_t *ptr; VasEBoot_uint8_t *ptr;
for (ptr = s; len; ptr++, len--) for (ptr = s; len; ptr++, len--)
*ptr = c; *ptr = c;
return s; return s;
} }
void * void *
grub_memmove (void *dest, const void *src, grub_size_t n) VasEBoot_memmove (void *dest, const void *src, VasEBoot_size_t n)
{ {
char *d = (char *) dest; char *d = (char *) dest;
const char *s = (const char *) src; const char *s = (const char *) src;
@ -51,7 +51,7 @@ grub_memmove (void *dest, const void *src, grub_size_t n)
} }
int int
grub_memcmp (const void *s1, const void *s2, grub_size_t n) VasEBoot_memcmp (const void *s1, const void *s2, VasEBoot_size_t n)
{ {
const unsigned char *t1 = s1; const unsigned char *t1 = s1;
const unsigned char *t2 = s2; const unsigned char *t2 = s2;
@ -68,7 +68,7 @@ grub_memcmp (const void *s1, const void *s2, grub_size_t n)
return 0; return 0;
} }
void *grub_decompressor_scratch; void *VasEBoot_decompressor_scratch;
void void
find_scratch (void *src, void *dst, unsigned long srcsize, find_scratch (void *src, void *dst, unsigned long srcsize,
@ -76,18 +76,18 @@ find_scratch (void *src, void *dst, unsigned long srcsize,
{ {
#ifdef _mips #ifdef _mips
/* Decoding from ROM. */ /* Decoding from ROM. */
if (((grub_addr_t) src & 0x10000000)) if (((VasEBoot_addr_t) src & 0x10000000))
{ {
grub_decompressor_scratch = (void *) ALIGN_UP((grub_addr_t) dst + dstsize, VasEBoot_decompressor_scratch = (void *) ALIGN_UP((VasEBoot_addr_t) dst + dstsize,
256); 256);
return; return;
} }
#endif #endif
if ((char *) src + srcsize > (char *) dst + dstsize) if ((char *) src + srcsize > (char *) dst + dstsize)
grub_decompressor_scratch = (void *) ALIGN_UP ((grub_addr_t) src + srcsize, VasEBoot_decompressor_scratch = (void *) ALIGN_UP ((VasEBoot_addr_t) src + srcsize,
256); 256);
else else
grub_decompressor_scratch = (void *) ALIGN_UP ((grub_addr_t) dst + dstsize, VasEBoot_decompressor_scratch = (void *) ALIGN_UP ((VasEBoot_addr_t) dst + dstsize,
256); 256);
return; return;
} }

View File

@ -1,25 +1,25 @@
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2010 Free Software Foundation, Inc. * Copyright (C) 2010 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/decompressor.h> #include <VasEBoot/decompressor.h>
void void
grub_decompress_core (void *src, void *dest, unsigned long n, VasEBoot_decompress_core (void *src, void *dest, unsigned long n,
unsigned long dstsize __attribute__ ((unused))) unsigned long dstsize __attribute__ ((unused)))
{ {
char *d = (char *) dest; char *d = (char *) dest;

View File

@ -1,30 +1,30 @@
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2010 Free Software Foundation, Inc. * Copyright (C) 2010 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/types.h> #include <VasEBoot/types.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/decompressor.h> #include <VasEBoot/decompressor.h>
#include "xz.h" #include "xz.h"
#include "xz_stream.h" #include "xz_stream.h"
void void
grub_decompress_core (void *src, void *dst, unsigned long srcsize, VasEBoot_decompress_core (void *src, void *dst, unsigned long srcsize,
unsigned long dstsize) unsigned long dstsize)
{ {
struct xz_dec *dec; struct xz_dec *dec;
@ -32,7 +32,7 @@ grub_decompress_core (void *src, void *dst, unsigned long srcsize,
find_scratch (src, dst, srcsize, dstsize); find_scratch (src, dst, srcsize, dstsize);
dec = xz_dec_init (GRUB_DECOMPRESSOR_DICT_SIZE); dec = xz_dec_init (VasEBoot_DECOMPRESSOR_DICT_SIZE);
buf.in = src; buf.in = src;
buf.in_pos = 0; buf.in_pos = 0;

View File

@ -1,24 +1,24 @@
/* -*-Asm-*- */ /* -*-Asm-*- */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 1999,2000,2001,2002,2005,2006,2007,2008,2009 Free Software Foundation, Inc. * Copyright (C) 1999,2000,2001,2002,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/symbol.h> #include <VasEBoot/symbol.h>
#include <grub/machine/boot.h> #include <VasEBoot/machine/boot.h>
/* /*
* defines for the code go here * defines for the code go here
@ -72,7 +72,7 @@ fd_probe_error_string: .asciz "Floppy"
1: 1:
/* perform read */ /* perform read */
movw MACRO_DOLLAR(GRUB_BOOT_MACHINE_BUFFER_SEG), %bx movw MACRO_DOLLAR(VasEBoot_BOOT_MACHINE_BUFFER_SEG), %bx
movw %bx, %es movw %bx, %es
xorw %bx, %bx xorw %bx, %bx
movw MACRO_DOLLAR(0x201), %ax movw MACRO_DOLLAR(0x201), %ax
@ -169,7 +169,7 @@ start:
* this area. * this area.
*/ */
.org GRUB_BOOT_MACHINE_BPB_START .org VasEBoot_BOOT_MACHINE_BPB_START
.org 4 .org 4
#endif #endif
#ifdef HYBRID_BOOT #ifdef HYBRID_BOOT
@ -178,23 +178,23 @@ start:
scratch scratch
#endif #endif
.org GRUB_BOOT_MACHINE_BPB_END .org VasEBoot_BOOT_MACHINE_BPB_END
/* /*
* End of BIOS parameter block. * End of BIOS parameter block.
*/ */
LOCAL(kernel_address): LOCAL(kernel_address):
.word GRUB_BOOT_MACHINE_KERNEL_ADDR .word VasEBoot_BOOT_MACHINE_KERNEL_ADDR
#ifndef HYBRID_BOOT #ifndef HYBRID_BOOT
.org GRUB_BOOT_MACHINE_KERNEL_SECTOR .org VasEBoot_BOOT_MACHINE_KERNEL_SECTOR
LOCAL(kernel_sector): LOCAL(kernel_sector):
.long 1 .long 1
LOCAL(kernel_sector_high): LOCAL(kernel_sector_high):
.long 0 .long 0
#endif #endif
.org GRUB_BOOT_MACHINE_BOOT_DRIVE .org VasEBoot_BOOT_MACHINE_BOOT_DRIVE
boot_drive: boot_drive:
.byte 0xff /* the disk to load kernel from */ .byte 0xff /* the disk to load kernel from */
/* 0xff means use the boot drive */ /* 0xff means use the boot drive */
@ -206,15 +206,15 @@ LOCAL(after_BPB):
/* /*
* This is a workaround for buggy BIOSes which don't pass boot * This is a workaround for buggy BIOSes which don't pass boot
* drive correctly. If GRUB is installed into a HDD, check if * drive correctly. If VasEBoot is installed into a HDD, check if
* DL is masked correctly. If not, assume that the BIOS passed * DL is masked correctly. If not, assume that the BIOS passed
* a bogus value and set DL to 0x80, since this is the only * a bogus value and set DL to 0x80, since this is the only
* possible boot drive. If GRUB is installed into a floppy, * possible boot drive. If VasEBoot is installed into a floppy,
* this does nothing (only jump). * this does nothing (only jump).
*/ */
.org GRUB_BOOT_MACHINE_DRIVE_CHECK .org VasEBoot_BOOT_MACHINE_DRIVE_CHECK
boot_drive_check: boot_drive_check:
jmp 3f /* grub-setup may overwrite this jump */ jmp 3f /* VasEBoot-setup may overwrite this jump */
testb $0x80, %dl testb $0x80, %dl
jz 2f jz 2f
3: 3:
@ -238,7 +238,7 @@ real_start:
movw %ax, %ss movw %ax, %ss
/* set up the REAL stack */ /* set up the REAL stack */
movw $GRUB_BOOT_MACHINE_STACK_SEG, %sp movw $VasEBoot_BOOT_MACHINE_STACK_SEG, %sp
sti /* we're safe again */ sti /* we're safe again */
@ -302,7 +302,7 @@ LOCAL(lba_mode):
movl %ebx, 12(%si) movl %ebx, 12(%si)
/* the segment of buffer address */ /* the segment of buffer address */
movw $GRUB_BOOT_MACHINE_BUFFER_SEG, 6(%si) movw $VasEBoot_BOOT_MACHINE_BUFFER_SEG, 6(%si)
/* /*
* BIOS call "INT 0x13 Function 0x42" to read sectors from disk into memory * BIOS call "INT 0x13 Function 0x42" to read sectors from disk into memory
@ -319,7 +319,7 @@ LOCAL(lba_mode):
/* LBA read is not supported, so fallback to CHS. */ /* LBA read is not supported, so fallback to CHS. */
jc LOCAL(chs_mode) jc LOCAL(chs_mode)
movw $GRUB_BOOT_MACHINE_BUFFER_SEG, %bx movw $VasEBoot_BOOT_MACHINE_BUFFER_SEG, %bx
jmp LOCAL(copy_buffer) jmp LOCAL(copy_buffer)
LOCAL(chs_mode): LOCAL(chs_mode):
@ -427,7 +427,7 @@ setup_sectors:
* %al = 0x0 on success; err code on failure * %al = 0x0 on success; err code on failure
*/ */
movw $GRUB_BOOT_MACHINE_BUFFER_SEG, %bx movw $VasEBoot_BOOT_MACHINE_BUFFER_SEG, %bx
movw %bx, %es /* load %es segment with disk buffer */ movw %bx, %es /* load %es segment with disk buffer */
xorw %bx, %bx /* %bx = 0, put it at 0 in the segment */ xorw %bx, %bx /* %bx = 0, put it at 0 in the segment */
@ -449,7 +449,7 @@ LOCAL(copy_buffer):
movw $0x100, %cx movw $0x100, %cx
movw %bx, %ds movw %bx, %ds
xorw %si, %si xorw %si, %si
movw $GRUB_BOOT_MACHINE_KERNEL_ADDR, %di movw $VasEBoot_BOOT_MACHINE_KERNEL_ADDR, %di
movw %si, %es movw %si, %es
cld cld
@ -469,7 +469,7 @@ LOCAL(copy_buffer):
jnz boot /* No TPM or TPM deactivated */ jnz boot /* No TPM or TPM deactivated */
movw $0xBB07, %ax /* TCG_CompactHashLogExtendEvent */ movw $0xBB07, %ax /* TCG_CompactHashLogExtendEvent */
movw $GRUB_BOOT_MACHINE_KERNEL_ADDR, %di movw $VasEBoot_BOOT_MACHINE_KERNEL_ADDR, %di
xorl %esi, %esi xorl %esi, %esi
movl $0x41504354, %ebx /* TCPA */ movl $0x41504354, %ebx /* TCPA */
movl $0x200, %ecx /* Measure 512 bytes */ movl $0x200, %ecx /* Measure 512 bytes */
@ -506,7 +506,7 @@ LOCAL(general_error):
LOCAL(stop): LOCAL(stop):
jmp LOCAL(stop) jmp LOCAL(stop)
notification_string: .asciz "GRUB " notification_string: .asciz "VasEBoot "
geometry_error_string: .asciz "Geom" geometry_error_string: .asciz "Geom"
hd_probe_error_string: .asciz "Hard Disk" hd_probe_error_string: .asciz "Hard Disk"
read_error_string: .asciz "Read" read_error_string: .asciz "Read"
@ -545,7 +545,7 @@ LOCAL(kernel_sector):
LOCAL(kernel_sector_high): LOCAL(kernel_sector_high):
.long 0 .long 0
#endif #endif
.org GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC .org VasEBoot_BOOT_MACHINE_WINDOWS_NT_MAGIC
nt_magic: nt_magic:
.long 0 .long 0
.word 0 .word 0
@ -556,7 +556,7 @@ nt_magic:
* sneaky, huh? * sneaky, huh?
*/ */
.org GRUB_BOOT_MACHINE_PART_START .org VasEBoot_BOOT_MACHINE_PART_START
#ifndef HYBRID_BOOT #ifndef HYBRID_BOOT
floppy floppy
@ -564,7 +564,7 @@ nt_magic:
scratch scratch
#endif #endif
.org GRUB_BOOT_MACHINE_PART_END .org VasEBoot_BOOT_MACHINE_PART_END
/* the last 2 bytes in the sector 0 contain the signature */ /* the last 2 bytes in the sector 0 contain the signature */
.word GRUB_BOOT_MACHINE_SIGNATURE .word VasEBoot_BOOT_MACHINE_SIGNATURE

View File

@ -1,31 +1,31 @@
/* -*-Asm-*- */ /* -*-Asm-*- */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2008,2009 Free Software Foundation, Inc. * Copyright (C) 2008,2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/symbol.h> #include <VasEBoot/symbol.h>
#include <grub/machine/boot.h> #include <VasEBoot/machine/boot.h>
#include <grub/machine/kernel.h> #include <VasEBoot/machine/kernel.h>
#include <multiboot.h> #include <multiboot.h>
.file "cdboot.S" .file "cdboot.S"
#define CODE_ADDR 0x6000 #define CODE_ADDR 0x6000
#define DATA_ADDR ((GRUB_BOOT_MACHINE_KERNEL_ADDR) + 0x200) #define DATA_ADDR ((VasEBoot_BOOT_MACHINE_KERNEL_ADDR) + 0x200)
#define CDSEC_SHIFT 11 #define CDSEC_SHIFT 11
#define CDBLK_LENG 16 #define CDBLK_LENG 16

View File

@ -1,23 +1,23 @@
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 1999,2000,2001,2002,2006,2007,2009,2010 Free Software Foundation, Inc. * Copyright (C) 1999,2000,2001,2002,2006,2007,2009,2010 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/symbol.h> #include <VasEBoot/symbol.h>
#include <grub/machine/boot.h> #include <VasEBoot/machine/boot.h>
#define TPM 1 #define TPM 1
@ -132,7 +132,7 @@ LOCAL(setup_sectors):
movl %ecx, 12(%si) movl %ecx, 12(%si)
/* the segment of buffer address */ /* the segment of buffer address */
movw $GRUB_BOOT_MACHINE_BUFFER_SEG, 6(%si) movw $VasEBoot_BOOT_MACHINE_BUFFER_SEG, 6(%si)
/* save %ax from destruction! */ /* save %ax from destruction! */
pushw %ax pushw %ax
@ -154,7 +154,7 @@ LOCAL(setup_sectors):
jc LOCAL(read_error) jc LOCAL(read_error)
movw $GRUB_BOOT_MACHINE_BUFFER_SEG, %bx movw $VasEBoot_BOOT_MACHINE_BUFFER_SEG, %bx
jmp LOCAL(copy_buffer) jmp LOCAL(copy_buffer)
LOCAL(chs_mode): LOCAL(chs_mode):
@ -249,7 +249,7 @@ LOCAL(chs_mode):
* %al = 0x0 on success; err code on failure * %al = 0x0 on success; err code on failure
*/ */
movw $GRUB_BOOT_MACHINE_BUFFER_SEG, %bx movw $VasEBoot_BOOT_MACHINE_BUFFER_SEG, %bx
movw %bx, %es /* load %es segment with disk buffer */ movw %bx, %es /* load %es segment with disk buffer */
xorw %bx, %bx /* %bx = 0, put it at 0 in the segment */ xorw %bx, %bx /* %bx = 0, put it at 0 in the segment */
@ -304,7 +304,7 @@ LOCAL(copy_buffer):
jne LOCAL(setup_sectors) jne LOCAL(setup_sectors)
/* update position to load from */ /* update position to load from */
subw $GRUB_BOOT_MACHINE_LIST_SIZE, %di subw $VasEBoot_BOOT_MACHINE_LIST_SIZE, %di
/* jump to bootloop */ /* jump to bootloop */
jmp LOCAL(bootloop) jmp LOCAL(bootloop)
@ -321,7 +321,7 @@ LOCAL(bootit):
/* We've already measured the first 512 bytes, now measure the rest */ /* We've already measured the first 512 bytes, now measure the rest */
xorl %edi, %edi xorl %edi, %edi
movw $(GRUB_BOOT_MACHINE_KERNEL_ADDR + 0x200), %di movw $(VasEBoot_BOOT_MACHINE_KERNEL_ADDR + 0x200), %di
movl $0x41504354, %ebx /* EBX = "TCPA" */ movl $0x41504354, %ebx /* EBX = "TCPA" */
@ -338,7 +338,7 @@ LOCAL(bootit):
/* print a newline */ /* print a newline */
MSG(notification_done) MSG(notification_done)
popw %dx /* this makes sure %dl is our "boot" drive */ popw %dx /* this makes sure %dl is our "boot" drive */
ljmp $0, $(GRUB_BOOT_MACHINE_KERNEL_ADDR + 0x200) ljmp $0, $(VasEBoot_BOOT_MACHINE_KERNEL_ADDR + 0x200)
/* /*
@ -406,7 +406,7 @@ LOCAL(message):
.word 0 .word 0
.word 0 .word 0
.org 0x200 - GRUB_BOOT_MACHINE_LIST_SIZE .org 0x200 - VasEBoot_BOOT_MACHINE_LIST_SIZE
LOCAL(firstlist): /* this label has to be before the first list entry!!! */ LOCAL(firstlist): /* this label has to be before the first list entry!!! */
/* fill the first data listing with the default */ /* fill the first data listing with the default */
blocklist_default_start: blocklist_default_start:
@ -414,9 +414,9 @@ blocklist_default_start:
the start of the disk, sector 0 */ the start of the disk, sector 0 */
.long 2, 0 .long 2, 0
blocklist_default_len: blocklist_default_len:
/* this is the number of sectors to read. grub-mkimage /* this is the number of sectors to read. VasEBoot-mkimage
will fill this up */ will fill this up */
.word 0 .word 0
blocklist_default_seg: blocklist_default_seg:
/* this is the segment of the starting address to load the data into */ /* this is the segment of the starting address to load the data into */
.word (GRUB_BOOT_MACHINE_KERNEL_SEG + 0x20) .word (VasEBoot_BOOT_MACHINE_KERNEL_SEG + 0x20)

View File

@ -1,33 +1,33 @@
/* -*-Asm-*- */ /* -*-Asm-*- */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2007,2008,2009 Free Software Foundation, Inc. * Copyright (C) 2007,2008,2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <config.h> #include <config.h>
#include <grub/symbol.h> #include <VasEBoot/symbol.h>
#include <grub/machine/boot.h> #include <VasEBoot/machine/boot.h>
#include <grub/machine/kernel.h> #include <VasEBoot/machine/kernel.h>
#include <multiboot.h> #include <multiboot.h>
.file "lnxboot.S" .file "lnxboot.S"
#define CODE_ADDR 0x6000 #define CODE_ADDR 0x6000
#define CODE_SECTORS 1 #define CODE_SECTORS 1
#define DATA_ADDR ((GRUB_BOOT_MACHINE_KERNEL_ADDR) + 0x200) #define DATA_ADDR ((VasEBoot_BOOT_MACHINE_KERNEL_ADDR) + 0x200)
#define BLCK_LENG 0x4000 #define BLCK_LENG 0x4000
@ -201,15 +201,15 @@ real_code_2:
1: 1:
movl $(DATA_ADDR + 0x1000), %edi movl $(DATA_ADDR + 0x1000), %edi
movl %ss:(DATA_ADDR + GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE), %ecx movl %ss:(DATA_ADDR + VasEBoot_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE), %ecx
addl $GRUB_DECOMPRESSOR_I386_PC_MAX_DECOMPRESSOR_SIZE, %ecx addl $VasEBoot_DECOMPRESSOR_I386_PC_MAX_DECOMPRESSOR_SIZE, %ecx
2: 2:
call LOCAL(move_memory) call LOCAL(move_memory)
movb %dh, %ss:(DATA_ADDR + GRUB_DECOMPRESSOR_I386_PC_BOOT_DEVICE + 2) movb %dh, %ss:(DATA_ADDR + VasEBoot_DECOMPRESSOR_I386_PC_BOOT_DEVICE + 2)
movb (reg_edx + 2 - start), %dh movb (reg_edx + 2 - start), %dh
movb %dh, %ss:(DATA_ADDR + GRUB_DECOMPRESSOR_I386_PC_BOOT_DEVICE + 1) movb %dh, %ss:(DATA_ADDR + VasEBoot_DECOMPRESSOR_I386_PC_BOOT_DEVICE + 1)
movb $0xFF, %dh movb $0xFF, %dh

View File

@ -1,19 +1,19 @@
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2008 Free Software Foundation, Inc. * Copyright (C) 2008 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#define FIXED_PROPS #define FIXED_PROPS

View File

@ -1,22 +1,22 @@
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2000,2005,2007,2008,2009,2010 Free Software Foundation, Inc. * Copyright (C) 2000,2005,2007,2008,2009,2010 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/machine/boot.h> #include <VasEBoot/machine/boot.h>
.file "pxeboot.S" .file "pxeboot.S"
.text .text
@ -30,7 +30,7 @@ _start:
start: start:
/* Use drive number 0x7F for PXE */ /* Use drive number 0x7F for PXE */
movb $GRUB_BOOT_MACHINE_PXE_DL, %dl movb $VasEBoot_BOOT_MACHINE_PXE_DL, %dl
/* Jump to the real world */ /* Jump to the real world */
ljmp $0, $0x8200 ljmp $0, $0x8200

View File

@ -1,29 +1,29 @@
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 1999,2000,2001,2002,2003,2005,2006,2007,2008,2009,2011 Free Software Foundation, Inc. * Copyright (C) 1999,2000,2001,2002,2003,2005,2006,2007,2008,2009,2011 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <config.h> #include <config.h>
#include <grub/symbol.h> #include <VasEBoot/symbol.h>
#include <grub/offsets.h> #include <VasEBoot/offsets.h>
#include <grub/machine/boot.h> #include <VasEBoot/machine/boot.h>
#include <grub/machine/memory.h> #include <VasEBoot/machine/memory.h>
#include <grub/machine/kernel.h> #include <VasEBoot/machine/kernel.h>
#define ABS(x) ((x) - LOCAL (base) + GRUB_BOOT_MACHINE_KERNEL_ADDR + 0x200) #define ABS(x) ((x) - LOCAL (base) + VasEBoot_BOOT_MACHINE_KERNEL_ADDR + 0x200)
.file "startup_raw.S" .file "startup_raw.S"
@ -50,23 +50,23 @@ LOCAL (base):
* This is a special data area. * This is a special data area.
*/ */
.org GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE .org VasEBoot_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE
LOCAL(compressed_size): LOCAL(compressed_size):
.long 0 .long 0
.org GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE .org VasEBoot_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE
LOCAL(uncompressed_size): LOCAL(uncompressed_size):
.long 0 .long 0
.org GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY .org VasEBoot_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY
reed_solomon_redundancy: reed_solomon_redundancy:
.long 0 .long 0
.org GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_LENGTH .org VasEBoot_KERNEL_I386_PC_NO_REED_SOLOMON_LENGTH
.short (LOCAL(reed_solomon_part) - _start) .short (LOCAL(reed_solomon_part) - _start)
/* /*
* This is the area for all of the special variables. * This is the area for all of the special variables.
*/ */
.org GRUB_DECOMPRESSOR_I386_PC_BOOT_DEVICE .org VasEBoot_DECOMPRESSOR_I386_PC_BOOT_DEVICE
LOCAL(boot_dev): LOCAL(boot_dev):
.byte 0xFF, 0xFF, 0xFF .byte 0xFF, 0xFF, 0xFF
LOCAL(boot_drive): LOCAL(boot_drive):
@ -83,7 +83,7 @@ LOCAL (codestart):
movw %ax, %es movw %ax, %es
/* set up the real mode/BIOS stack */ /* set up the real mode/BIOS stack */
movl $GRUB_MEMORY_MACHINE_REAL_STACK, %ebp movl $VasEBoot_MEMORY_MACHINE_REAL_STACK, %ebp
movl %ebp, %esp movl %ebp, %esp
sti /* we're safe again */ sti /* we're safe again */
@ -101,7 +101,7 @@ LOCAL (codestart):
.code32 .code32
cld cld
call grub_gate_a20 call VasEBoot_gate_a20
movl LOCAL(compressed_size), %edx movl LOCAL(compressed_size), %edx
#ifdef __APPLE__ #ifdef __APPLE__
@ -113,7 +113,7 @@ LOCAL (codestart):
movl reed_solomon_redundancy, %ecx movl reed_solomon_redundancy, %ecx
leal LOCAL(reed_solomon_part), %eax leal LOCAL(reed_solomon_part), %eax
cld cld
call EXT_C (grub_reed_solomon_recover) call EXT_C (VasEBoot_reed_solomon_recover)
jmp post_reed_solomon jmp post_reed_solomon
#include "../../../kern/i386/realmode.S" #include "../../../kern/i386/realmode.S"
@ -123,7 +123,7 @@ LOCAL (codestart):
.text .text
/* /*
* grub_gate_a20(void) * VasEBoot_gate_a20(void)
* *
* Gate address-line 20 for high memory. * Gate address-line 20 for high memory.
* *
@ -132,7 +132,7 @@ LOCAL (codestart):
* It also eats any keystrokes in the keyboard buffer. :-( * It also eats any keystrokes in the keyboard buffer. :-(
*/ */
grub_gate_a20: VasEBoot_gate_a20:
gate_a20_test_current_state: gate_a20_test_current_state:
/* first of all, test if already in a good state */ /* first of all, test if already in a good state */
call gate_a20_check_state call gate_a20_check_state
@ -228,7 +228,7 @@ gate_a20_check_state:
pushl %ecx pushl %ecx
xorl %eax, %eax xorl %eax, %eax
/* compare the byte at 0x8000 with that at 0x108000 */ /* compare the byte at 0x8000 with that at 0x108000 */
movl $GRUB_BOOT_MACHINE_KERNEL_ADDR, %ebx movl $VasEBoot_BOOT_MACHINE_KERNEL_ADDR, %ebx
pushl %ebx pushl %ebx
/* save the original byte in CL */ /* save the original byte in CL */
movb (%ebx), %cl movb (%ebx), %cl
@ -259,7 +259,7 @@ gate_a20_check_state:
LOCAL(reed_solomon_part): LOCAL(reed_solomon_part):
/* /*
* Support for booting GRUB from a Multiboot boot loader (e.g. GRUB itself). * Support for booting VasEBoot from a Multiboot boot loader (e.g. VasEBoot itself).
* This uses the a.out kludge to load raw binary to the area starting at 1MB, * This uses the a.out kludge to load raw binary to the area starting at 1MB,
* and relocates itself after loaded. * and relocates itself after loaded.
*/ */
@ -287,7 +287,7 @@ multiboot_entry:
/* obtain the boot device */ /* obtain the boot device */
movl 12(%ebx), %edx movl 12(%ebx), %edx
movl $GRUB_MEMORY_MACHINE_PROT_STACK, %ebp movl $VasEBoot_MEMORY_MACHINE_PROT_STACK, %ebp
movl %ebp, %esp movl %ebp, %esp
/* relocate the code */ /* relocate the code */
@ -302,7 +302,7 @@ multiboot_entry:
addl LOCAL(compressed_size) - _start + 0x100000 + 0x200, %ecx addl LOCAL(compressed_size) - _start + 0x100000 + 0x200, %ecx
#endif #endif
movl $0x100000, %esi movl $0x100000, %esi
movl $GRUB_BOOT_MACHINE_KERNEL_ADDR, %edi movl $VasEBoot_BOOT_MACHINE_KERNEL_ADDR, %edi
cld cld
rep rep
movsb movsb
@ -323,7 +323,7 @@ multiboot_trampoline:
post_reed_solomon: post_reed_solomon:
#ifdef ENABLE_LZMA #ifdef ENABLE_LZMA
movl $GRUB_MEMORY_MACHINE_DECOMPRESSION_ADDR, %edi movl $VasEBoot_MEMORY_MACHINE_DECOMPRESSION_ADDR, %edi
#ifdef __APPLE__ #ifdef __APPLE__
movl $decompressor_end, %esi movl $decompressor_end, %esi
#else #else

View File

@ -1,26 +1,26 @@
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 1999,2000,2001,2002,2003,2005,2006,2007,2008,2009 Free Software Foundation, Inc. * Copyright (C) 1999,2000,2001,2002,2003,2005,2006,2007,2008,2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <config.h> #include <config.h>
#include <grub/symbol.h> #include <VasEBoot/symbol.h>
#include <grub/machine/memory.h> #include <VasEBoot/machine/memory.h>
#include <grub/machine/boot.h> #include <VasEBoot/machine/boot.h>
#include <grub/machine/kernel.h> #include <VasEBoot/machine/kernel.h>
.text .text
.code16 .code16
@ -31,8 +31,8 @@ _start:
jmp 1f jmp 1f
.org GRUB_BOOT_I386_QEMU_CORE_ENTRY_ADDR .org VasEBoot_BOOT_I386_QEMU_CORE_ENTRY_ADDR
VARIABLE(grub_core_entry_addr) VARIABLE(VasEBoot_core_entry_addr)
.long 0 .long 0
1: 1:
@ -43,7 +43,7 @@ VARIABLE(grub_core_entry_addr)
movw %ax, %es movw %ax, %es
/* Set up the real mode stack. */ /* Set up the real mode stack. */
movl $GRUB_MEMORY_MACHINE_REAL_STACK, %esp movl $VasEBoot_MEMORY_MACHINE_REAL_STACK, %esp
/* Transition to protected mode. We use pushl to force generation /* Transition to protected mode. We use pushl to force generation
of a flat return address. */ of a flat return address. */
@ -58,7 +58,7 @@ VARIABLE(grub_core_entry_addr)
andb $(~0x03), %al andb $(~0x03), %al
orb $0x02, %al orb $0x02, %al
outb $0x92 outb $0x92
movl EXT_C(grub_core_entry_addr), %edx movl EXT_C(VasEBoot_core_entry_addr), %edx
jmp *%edx jmp *%edx
#include "../../../kern/i386/realmode.S" #include "../../../kern/i386/realmode.S"
@ -66,9 +66,9 @@ VARIABLE(grub_core_entry_addr)
/* Intel, in its infinite wisdom, decided to put the i8086 entry point /* Intel, in its infinite wisdom, decided to put the i8086 entry point
*right here* and this is why we need this kludge. */ *right here* and this is why we need this kludge. */
.org GRUB_BOOT_MACHINE_SIZE - 16 .org VasEBoot_BOOT_MACHINE_SIZE - 16
.code16 .code16
jmp _start jmp _start
.org GRUB_BOOT_MACHINE_SIZE .org VasEBoot_BOOT_MACHINE_SIZE

View File

@ -1,43 +1,43 @@
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2000,2001,2002,2003,2004,2005,2007,2008,2009,2010 Free Software Foundation, Inc. * Copyright (C) 2000,2001,2002,2003,2004,2005,2007,2008,2009,2010 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/mips/loongson/serial.h> #include <VasEBoot/mips/loongson/serial.h>
#include <grub/mips/loongson/pci.h> #include <VasEBoot/mips/loongson/pci.h>
#include <grub/mips/loongson.h> #include <VasEBoot/mips/loongson.h>
#include <grub/pci.h> #include <VasEBoot/pci.h>
#include <grub/machine/serial.h> #include <VasEBoot/machine/serial.h>
#include <grub/machine/kernel.h> #include <VasEBoot/machine/kernel.h>
#include <grub/ns8250.h> #include <VasEBoot/ns8250.h>
#include <grub/cs5536.h> #include <VasEBoot/cs5536.h>
#include <grub/smbus.h> #include <VasEBoot/smbus.h>
#ifndef FULOONG2F #ifndef FULOONG2F
#include <grub/vgaregs.h> #include <VasEBoot/vgaregs.h>
#define GRUB_SM712_REG_BASE 0x700000 #define VasEBoot_SM712_REG_BASE 0x700000
#define GRUB_SM712_PCIID 0x0712126f #define VasEBoot_SM712_PCIID 0x0712126f
#endif #endif
#ifdef FULOONG2F #ifdef FULOONG2F
#define GRUB_MACHINE_SERIAL_PORT GRUB_MACHINE_SERIAL_PORT2 #define VasEBoot_MACHINE_SERIAL_PORT VasEBoot_MACHINE_SERIAL_PORT2
#define GRUB_MACHINE_SERIAL_DIVISOR_115200 GRUB_MACHINE_SERIAL_PORT2_DIVISOR_115200 #define VasEBoot_MACHINE_SERIAL_DIVISOR_115200 VasEBoot_MACHINE_SERIAL_PORT2_DIVISOR_115200
#else #else
#define GRUB_MACHINE_SERIAL_PORT GRUB_MACHINE_SERIAL_PORT0 #define VasEBoot_MACHINE_SERIAL_PORT VasEBoot_MACHINE_SERIAL_PORT0
#define GRUB_MACHINE_SERIAL_DIVISOR_115200 GRUB_MACHINE_SERIAL_PORT0_DIVISOR_115200 #define VasEBoot_MACHINE_SERIAL_DIVISOR_115200 VasEBoot_MACHINE_SERIAL_PORT0_DIVISOR_115200
#endif #endif
.set noreorder .set noreorder
@ -59,22 +59,22 @@ __start:
/* Find CS5536 controller. */ /* Find CS5536 controller. */
/* $t4 chooses device in priority encoding. */ /* $t4 chooses device in priority encoding. */
/* Resulting value is kept in GRUB_MACHINE_PCI_CONF_CTRL_REG. /* Resulting value is kept in VasEBoot_MACHINE_PCI_CONF_CTRL_REG.
This way we don't need to sacrifice a register for it. */ This way we don't need to sacrifice a register for it. */
retry_cs5536: retry_cs5536:
/* We have only one bus (0). Function is 0. */ /* We have only one bus (0). Function is 0. */
lui $t0, %hi(GRUB_MACHINE_PCI_CONF_CTRL_REG_ADDR_2F) lui $t0, %hi(VasEBoot_MACHINE_PCI_CONF_CTRL_REG_ADDR_2F)
lui $t1, %hi(GRUB_MACHINE_PCI_CONFSPACE_2F) lui $t1, %hi(VasEBoot_MACHINE_PCI_CONFSPACE_2F)
lui $t3, %hi(GRUB_CS5536_PCIID) lui $t3, %hi(VasEBoot_CS5536_PCIID)
addiu $t3, $t3, %lo(GRUB_CS5536_PCIID) addiu $t3, $t3, %lo(VasEBoot_CS5536_PCIID)
ori $t4, $zero, 1 ori $t4, $zero, 1
1: 1:
andi $t4, $t4, ((1 << GRUB_PCI_NUM_DEVICES_2F) - 1) andi $t4, $t4, ((1 << VasEBoot_PCI_NUM_DEVICES_2F) - 1)
/* In case of failure try again. CS5536 may be slow to come up. */ /* In case of failure try again. CS5536 may be slow to come up. */
beql $t4, $zero, retry_cs5536 beql $t4, $zero, retry_cs5536
nop nop
sw $t4, %lo(GRUB_MACHINE_PCI_CONF_CTRL_REG_ADDR_2F) ($t0) sw $t4, %lo(VasEBoot_MACHINE_PCI_CONF_CTRL_REG_ADDR_2F) ($t0)
lw $t2, (%lo(GRUB_MACHINE_PCI_CONFSPACE_2F) + GRUB_PCI_REG_PCI_ID) ($t1) lw $t2, (%lo(VasEBoot_MACHINE_PCI_CONFSPACE_2F) + VasEBoot_PCI_REG_PCI_ID) ($t1)
bnel $t2, $t3, 1b bnel $t2, $t3, 1b
sll $t4, $t4, 1 sll $t4, $t4, 1
@ -86,18 +86,18 @@ retry_cs5536:
move $a0, $t4 move $a0, $t4
#endif #endif
lui $t0, %hi(GRUB_MACHINE_PCI_CONFSPACE_2F) lui $t0, %hi(VasEBoot_MACHINE_PCI_CONFSPACE_2F)
li $t1, GRUB_CS5536_MSR_MAILBOX_CONFIG_ENABLED li $t1, VasEBoot_CS5536_MSR_MAILBOX_CONFIG_ENABLED
sw $t1, (%lo(GRUB_MACHINE_PCI_CONFSPACE_2F) + GRUB_CS5536_MSR_MAILBOX_CONFIG) ($t0) sw $t1, (%lo(VasEBoot_MACHINE_PCI_CONFSPACE_2F) + VasEBoot_CS5536_MSR_MAILBOX_CONFIG) ($t0)
/* Set GPIO LBAR. */ /* Set GPIO LBAR. */
lui $a0, %hi(GRUB_CS5536_MSR_GPIO_BAR) lui $a0, %hi(VasEBoot_CS5536_MSR_GPIO_BAR)
addiu $a0, $a0, %lo(GRUB_CS5536_MSR_GPIO_BAR) addiu $a0, $a0, %lo(VasEBoot_CS5536_MSR_GPIO_BAR)
ori $a1, $zero, GRUB_CS5536_LBAR_GPIO ori $a1, $zero, VasEBoot_CS5536_LBAR_GPIO
/* Set mask to 0xf and enabled bit to 1. */ /* Set mask to 0xf and enabled bit to 1. */
bal wrmsr bal wrmsr
ori $a2, $zero, ((GRUB_CS5536_LBAR_MASK_MASK \ ori $a2, $zero, ((VasEBoot_CS5536_LBAR_MASK_MASK \
| GRUB_CS5536_LBAR_ENABLE) >> 32) | VasEBoot_CS5536_LBAR_ENABLE) >> 32)
bal gpio_init bal gpio_init
nop nop
@ -109,63 +109,63 @@ retry_cs5536:
/* Initialise SMBus controller. */ /* Initialise SMBus controller. */
/* Set SMBUS LBAR. */ /* Set SMBUS LBAR. */
lui $a0, %hi(GRUB_CS5536_MSR_SMB_BAR) lui $a0, %hi(VasEBoot_CS5536_MSR_SMB_BAR)
addiu $a0, $a0, %lo(GRUB_CS5536_MSR_SMB_BAR) addiu $a0, $a0, %lo(VasEBoot_CS5536_MSR_SMB_BAR)
ori $a1, $zero, GRUB_CS5536_LBAR_SMBUS ori $a1, $zero, VasEBoot_CS5536_LBAR_SMBUS
/* Set mask to 0xf and enabled bit to 1. */ /* Set mask to 0xf and enabled bit to 1. */
bal wrmsr bal wrmsr
ori $a2, $zero, ((GRUB_CS5536_LBAR_MASK_MASK \ ori $a2, $zero, ((VasEBoot_CS5536_LBAR_MASK_MASK \
| GRUB_CS5536_LBAR_ENABLE) >> 32) | VasEBoot_CS5536_LBAR_ENABLE) >> 32)
lui $a0, %hi(smbus_enabled) lui $a0, %hi(smbus_enabled)
bal message bal message
addiu $a0, $a0, %lo(smbus_enabled) addiu $a0, $a0, %lo(smbus_enabled)
lui $t0, %hi(GRUB_MACHINE_PCI_IO_BASE_2F + GRUB_CS5536_LBAR_SMBUS) lui $t0, %hi(VasEBoot_MACHINE_PCI_IO_BASE_2F + VasEBoot_CS5536_LBAR_SMBUS)
/* Disable SMB. */ /* Disable SMB. */
sb $zero, %lo(GRUB_MACHINE_PCI_IO_BASE_2F + GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL2) ($t0) sb $zero, %lo(VasEBoot_MACHINE_PCI_IO_BASE_2F + VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_CTRL2) ($t0)
/* Disable interrupts. */ /* Disable interrupts. */
sb $zero, %lo(GRUB_MACHINE_PCI_IO_BASE_2F + GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL1) ($t0) sb $zero, %lo(VasEBoot_MACHINE_PCI_IO_BASE_2F + VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_CTRL1) ($t0)
/* Set as master. */ /* Set as master. */
sb $zero, %lo(GRUB_MACHINE_PCI_IO_BASE_2F + GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_ADDR) ($t0) sb $zero, %lo(VasEBoot_MACHINE_PCI_IO_BASE_2F + VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_ADDR) ($t0)
/* Launch SMBus controller at slowest speed possible. */ /* Launch SMBus controller at slowest speed possible. */
ori $t1, $zero, 0xff ori $t1, $zero, 0xff
sb $t1, %lo(GRUB_MACHINE_PCI_IO_BASE_2F + GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL3) ($t0) sb $t1, %lo(VasEBoot_MACHINE_PCI_IO_BASE_2F + VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_CTRL3) ($t0)
sb $t1, %lo(GRUB_MACHINE_PCI_IO_BASE_2F + GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL2) ($t0) sb $t1, %lo(VasEBoot_MACHINE_PCI_IO_BASE_2F + VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_CTRL2) ($t0)
/* Yeeloong and Fuloong2f have only one memory slot. */ /* Yeeloong and Fuloong2f have only one memory slot. */
/* Output first byte on serial for debugging. */ /* Output first byte on serial for debugging. */
ori $a1, $zero, GRUB_SMB_RAM_START_ADDR ori $a1, $zero, VasEBoot_SMB_RAM_START_ADDR
bal read_spd bal read_spd
move $a0, $zero move $a0, $zero
bal printhex bal printhex
move $a0, $v0 move $a0, $v0
bal read_spd bal read_spd
ori $a0, $zero, GRUB_SMBUS_SPD_MEMORY_TYPE_ADDR ori $a0, $zero, VasEBoot_SMBUS_SPD_MEMORY_TYPE_ADDR
ori $t0, $zero, GRUB_SMBUS_SPD_MEMORY_TYPE_DDR2 ori $t0, $zero, VasEBoot_SMBUS_SPD_MEMORY_TYPE_DDR2
lui $a0, %hi(unimplemented_memory_type) lui $a0, %hi(unimplemented_memory_type)
bne $t0, $v0, fatal bne $t0, $v0, fatal
addiu $a0, $a0, %lo(unimplemented_memory_type) addiu $a0, $a0, %lo(unimplemented_memory_type)
/* And here is our goal: DDR2 controller initialisation. */ /* And here is our goal: DDR2 controller initialisation. */
lui $t0, %hi(GRUB_CPU_LOONGSON_CORECFG) lui $t0, %hi(VasEBoot_CPU_LOONGSON_CORECFG)
ld $t1, %lo(GRUB_CPU_LOONGSON_CORECFG) ($t0) ld $t1, %lo(VasEBoot_CPU_LOONGSON_CORECFG) ($t0)
/* Use addiu for sign-extension. */ /* Use addiu for sign-extension. */
addiu $t2, $zero, ~(GRUB_CPU_LOONGSON_CORECFG_DISABLE_DDR2_SPACE|GRUB_CPU_LOONGSON_CORECFG_BUFFER_CPU) addiu $t2, $zero, ~(VasEBoot_CPU_LOONGSON_CORECFG_DISABLE_DDR2_SPACE|VasEBoot_CPU_LOONGSON_CORECFG_BUFFER_CPU)
and $t1, $t1, $t2 and $t1, $t1, $t2
sd $t1, %lo (GRUB_CPU_LOONGSON_CORECFG) ($t0) sd $t1, %lo (VasEBoot_CPU_LOONGSON_CORECFG) ($t0)
b continue b continue
.org GRUB_CPU_LOONGSON_FLASH_TLB_REFILL - GRUB_CPU_LOONGSON_FLASH_START .org VasEBoot_CPU_LOONGSON_FLASH_TLB_REFILL - VasEBoot_CPU_LOONGSON_FLASH_START
tlb_refill: tlb_refill:
mfc0 $s1, GRUB_CPU_LOONGSON_COP0_EPC mfc0 $s1, VasEBoot_CPU_LOONGSON_COP0_EPC
mfc0 $s2, GRUB_CPU_LOONGSON_COP0_BADVADDR mfc0 $s2, VasEBoot_CPU_LOONGSON_COP0_BADVADDR
move $s3, $ra move $s3, $ra
lui $a0, %hi(epc) lui $a0, %hi(epc)
bal message bal message
@ -196,17 +196,17 @@ tlb_refill:
b fatal b fatal
addiu $a0, $a0, %lo(unhandled_tlb_refill) addiu $a0, $a0, %lo(unhandled_tlb_refill)
.org GRUB_CPU_LOONGSON_FLASH_CACHE_ERROR - GRUB_CPU_LOONGSON_FLASH_START .org VasEBoot_CPU_LOONGSON_FLASH_CACHE_ERROR - VasEBoot_CPU_LOONGSON_FLASH_START
cache_error: cache_error:
lui $a0, %hi(unhandled_cache_error) lui $a0, %hi(unhandled_cache_error)
b fatal b fatal
addiu $a0, $a0, %lo(unhandled_cache_error) addiu $a0, $a0, %lo(unhandled_cache_error)
.org GRUB_CPU_LOONGSON_FLASH_OTHER_EXCEPTION - GRUB_CPU_LOONGSON_FLASH_START .org VasEBoot_CPU_LOONGSON_FLASH_OTHER_EXCEPTION - VasEBoot_CPU_LOONGSON_FLASH_START
other_exception: other_exception:
mfc0 $s0, GRUB_CPU_LOONGSON_COP0_CAUSE mfc0 $s0, VasEBoot_CPU_LOONGSON_COP0_CAUSE
mfc0 $s1, GRUB_CPU_LOONGSON_COP0_EPC mfc0 $s1, VasEBoot_CPU_LOONGSON_COP0_EPC
mfc0 $s2, GRUB_CPU_LOONGSON_COP0_BADVADDR mfc0 $s2, VasEBoot_CPU_LOONGSON_COP0_BADVADDR
lui $a0, %hi(cause) lui $a0, %hi(cause)
bal message bal message
addiu $a0, $a0, %lo(cause) addiu $a0, $a0, %lo(cause)
@ -237,8 +237,8 @@ other_exception:
addiu $a0, $a0, %lo(unhandled_exception) addiu $a0, $a0, %lo(unhandled_exception)
gpio_init: gpio_init:
lui $t0, %hi(GRUB_MACHINE_PCI_IO_BASE_2F + GRUB_CS5536_LBAR_GPIO) lui $t0, %hi(VasEBoot_MACHINE_PCI_IO_BASE_2F + VasEBoot_CS5536_LBAR_GPIO)
addiu $t0, $t0, %lo(GRUB_MACHINE_PCI_IO_BASE_2F + GRUB_CS5536_LBAR_GPIO) addiu $t0, $t0, %lo(VasEBoot_MACHINE_PCI_IO_BASE_2F + VasEBoot_CS5536_LBAR_GPIO)
lui $t1, %hi (gpio_dump) lui $t1, %hi (gpio_dump)
addiu $t1, $t1, %lo (gpio_dump) addiu $t1, $t1, %lo (gpio_dump)
@ -260,55 +260,55 @@ gpio_init:
serial_hw_init: serial_hw_init:
move $t2, $ra move $t2, $ra
#ifdef FULOONG2F #ifdef FULOONG2F
lui $a0, %hi(GRUB_CS5536_MSR_DIVIL_LEG_IO) lui $a0, %hi(VasEBoot_CS5536_MSR_DIVIL_LEG_IO)
addiu $a0, $a0, %lo(GRUB_CS5536_MSR_DIVIL_LEG_IO) addiu $a0, $a0, %lo(VasEBoot_CS5536_MSR_DIVIL_LEG_IO)
lui $a1, %hi (GRUB_CS5536_MSR_DIVIL_LEG_IO_UART2_COM3 \ lui $a1, %hi (VasEBoot_CS5536_MSR_DIVIL_LEG_IO_UART2_COM3 \
| GRUB_CS5536_MSR_DIVIL_LEG_IO_F_REMAP \ | VasEBoot_CS5536_MSR_DIVIL_LEG_IO_F_REMAP \
| GRUB_CS5536_MSR_DIVIL_LEG_IO_MODE_X86 \ | VasEBoot_CS5536_MSR_DIVIL_LEG_IO_MODE_X86 \
| GRUB_CS5536_MSR_DIVIL_LEG_IO_UART1_COM1) | VasEBoot_CS5536_MSR_DIVIL_LEG_IO_UART1_COM1)
ori $a1, $a1, (GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE0 \ ori $a1, $a1, (VasEBoot_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE0 \
| GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE1) | VasEBoot_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE1)
bal wrmsr bal wrmsr
move $a2, $zero move $a2, $zero
lui $a0, %hi(GRUB_CS5536_MSR_DIVIL_UART1_CONF) lui $a0, %hi(VasEBoot_CS5536_MSR_DIVIL_UART1_CONF)
addiu $a0, $a0, %lo(GRUB_CS5536_MSR_DIVIL_UART1_CONF) addiu $a0, $a0, %lo(VasEBoot_CS5536_MSR_DIVIL_UART1_CONF)
li $a1, 2 li $a1, 2
bal wrmsr bal wrmsr
move $a2, $zero move $a2, $zero
lui $a0, %hi(GRUB_CS5536_MSR_DIVIL_UART2_CONF) lui $a0, %hi(VasEBoot_CS5536_MSR_DIVIL_UART2_CONF)
addiu $a0, $a0, %lo(GRUB_CS5536_MSR_DIVIL_UART2_CONF) addiu $a0, $a0, %lo(VasEBoot_CS5536_MSR_DIVIL_UART2_CONF)
li $a1, 2 li $a1, 2
bal wrmsr bal wrmsr
move $a2, $zero move $a2, $zero
#endif #endif
lui $t0, %hi (GRUB_MACHINE_SERIAL_PORT) lui $t0, %hi (VasEBoot_MACHINE_SERIAL_PORT)
/* Turn off the interrupt. */ /* Turn off the interrupt. */
sb $zero, (%lo (GRUB_MACHINE_SERIAL_PORT) + UART_IER)($t0) sb $zero, (%lo (VasEBoot_MACHINE_SERIAL_PORT) + UART_IER)($t0)
/* Set DLAB. */ /* Set DLAB. */
ori $t1, $zero, UART_DLAB ori $t1, $zero, UART_DLAB
sb $t1, (%lo (GRUB_MACHINE_SERIAL_PORT) + UART_LCR)($t0) sb $t1, (%lo (VasEBoot_MACHINE_SERIAL_PORT) + UART_LCR)($t0)
/* Set the baud rate 115200. */ /* Set the baud rate 115200. */
ori $t1, $zero, GRUB_MACHINE_SERIAL_DIVISOR_115200 ori $t1, $zero, VasEBoot_MACHINE_SERIAL_DIVISOR_115200
sb $t1, (%lo (GRUB_MACHINE_SERIAL_PORT) + UART_DLL)($t0) sb $t1, (%lo (VasEBoot_MACHINE_SERIAL_PORT) + UART_DLL)($t0)
sb $zero, (%lo (GRUB_MACHINE_SERIAL_PORT) + UART_DLH)($t0) sb $zero, (%lo (VasEBoot_MACHINE_SERIAL_PORT) + UART_DLH)($t0)
/* Set the line status. */ /* Set the line status. */
ori $t1, $zero, (UART_NO_PARITY | UART_8BITS_WORD | UART_1_STOP_BIT) ori $t1, $zero, (UART_NO_PARITY | UART_8BITS_WORD | UART_1_STOP_BIT)
sb $t1, (%lo (GRUB_MACHINE_SERIAL_PORT) + UART_LCR)($t0) sb $t1, (%lo (VasEBoot_MACHINE_SERIAL_PORT) + UART_LCR)($t0)
/* Enable the FIFO. */ /* Enable the FIFO. */
ori $t1, $zero, UART_ENABLE_FIFO_TRIGGER1 ori $t1, $zero, UART_ENABLE_FIFO_TRIGGER1
sb $t1, (%lo (GRUB_MACHINE_SERIAL_PORT) + UART_FCR)($t0) sb $t1, (%lo (VasEBoot_MACHINE_SERIAL_PORT) + UART_FCR)($t0)
/* Turn on DTR and RTS. */ /* Turn on DTR and RTS. */
ori $t1, $zero, UART_ENABLE_DTRRTS ori $t1, $zero, UART_ENABLE_DTRRTS
sb $t1, (%lo (GRUB_MACHINE_SERIAL_PORT) + UART_MCR)($t0) sb $t1, (%lo (VasEBoot_MACHINE_SERIAL_PORT) + UART_MCR)($t0)
/* Let message return to original caller. */ /* Let message return to original caller. */
lui $a0, %hi(notification_string) lui $a0, %hi(notification_string)
@ -318,14 +318,14 @@ serial_hw_init:
/* Print message on serial console. */ /* Print message on serial console. */
/* In: $a0 = asciiz message. Out: none. Clobbered: $t0, $t1, $a0. */ /* In: $a0 = asciiz message. Out: none. Clobbered: $t0, $t1, $a0. */
message: message:
lui $t0, %hi (GRUB_MACHINE_SERIAL_PORT) lui $t0, %hi (VasEBoot_MACHINE_SERIAL_PORT)
1: 1:
lb $t1, (%lo (GRUB_MACHINE_SERIAL_PORT) + UART_LSR)($t0) lb $t1, (%lo (VasEBoot_MACHINE_SERIAL_PORT) + UART_LSR)($t0)
andi $t1, $t1, UART_EMPTY_TRANSMITTER andi $t1, $t1, UART_EMPTY_TRANSMITTER
beq $t1, $zero, 1b beq $t1, $zero, 1b
nop nop
lb $t1, 0($a0) lb $t1, 0($a0)
sb $t1, (%lo (GRUB_MACHINE_SERIAL_PORT) + UART_TX)($t0) sb $t1, (%lo (VasEBoot_MACHINE_SERIAL_PORT) + UART_TX)($t0)
bne $t1, $zero, 1b bne $t1, $zero, 1b
addiu $a0, $a0, 1 addiu $a0, $a0, 1
jr $ra jr $ra
@ -335,10 +335,10 @@ message:
In: $a0. Out: None. Clobbered: $a0, $t0, $t1, $t2 In: $a0. Out: None. Clobbered: $a0, $t0, $t1, $t2
*/ */
printhex: printhex:
lui $t0, %hi (GRUB_MACHINE_SERIAL_PORT) lui $t0, %hi (VasEBoot_MACHINE_SERIAL_PORT)
ori $t2, $zero, 8 ori $t2, $zero, 8
1: 1:
lb $t1, (%lo (GRUB_MACHINE_SERIAL_PORT) + UART_LSR)($t0) lb $t1, (%lo (VasEBoot_MACHINE_SERIAL_PORT) + UART_LSR)($t0)
andi $t1, $t1, UART_EMPTY_TRANSMITTER andi $t1, $t1, UART_EMPTY_TRANSMITTER
beq $t1, $zero, 1b beq $t1, $zero, 1b
nop nop
@ -348,7 +348,7 @@ printhex:
sll $a0, $a0, 4 sll $a0, $a0, 4
addiu $t1, $t1, 'A'-10-'0' addiu $t1, $t1, 'A'-10-'0'
2: addiu $t1, $t1, '0'+10 2: addiu $t1, $t1, '0'+10
sb $t1, (%lo (GRUB_MACHINE_SERIAL_PORT) + UART_TX)($t0) sb $t1, (%lo (VasEBoot_MACHINE_SERIAL_PORT) + UART_TX)($t0)
addiu $t2, $t2, -1 addiu $t2, $t2, -1
bne $t2, $zero, 1b bne $t2, $zero, 1b
nop nop
@ -368,22 +368,22 @@ self:
Clobbered: $t0 Clobbered: $t0
*/ */
wrmsr: wrmsr:
lui $t0, %hi(GRUB_MACHINE_PCI_CONFSPACE_2F) lui $t0, %hi(VasEBoot_MACHINE_PCI_CONFSPACE_2F)
sw $a0, (%lo(GRUB_MACHINE_PCI_CONFSPACE_2F) + GRUB_CS5536_MSR_MAILBOX_ADDR) ($t0) sw $a0, (%lo(VasEBoot_MACHINE_PCI_CONFSPACE_2F) + VasEBoot_CS5536_MSR_MAILBOX_ADDR) ($t0)
sw $a1, (%lo(GRUB_MACHINE_PCI_CONFSPACE_2F) + GRUB_CS5536_MSR_MAILBOX_DATA0) ($t0) sw $a1, (%lo(VasEBoot_MACHINE_PCI_CONFSPACE_2F) + VasEBoot_CS5536_MSR_MAILBOX_DATA0) ($t0)
jr $ra jr $ra
sw $a2, (%lo(GRUB_MACHINE_PCI_CONFSPACE_2F) + GRUB_CS5536_MSR_MAILBOX_DATA1) ($t0) sw $a2, (%lo(VasEBoot_MACHINE_PCI_CONFSPACE_2F) + VasEBoot_CS5536_MSR_MAILBOX_DATA1) ($t0)
/* Wait for SMBus data or empty transmitter. */ /* Wait for SMBus data or empty transmitter. */
/* In: $a0 = exception handler. Out: none. Clobbered: $t0, $t1 */ /* In: $a0 = exception handler. Out: none. Clobbered: $t0, $t1 */
smbus_wait: smbus_wait:
1: 1:
lui $t0, %hi(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_STATUS + GRUB_MACHINE_PCI_IO_BASE_2F) lui $t0, %hi(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_STATUS + VasEBoot_MACHINE_PCI_IO_BASE_2F)
lb $t0, %lo(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_STATUS + GRUB_MACHINE_PCI_IO_BASE_2F) ($t0) lb $t0, %lo(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_STATUS + VasEBoot_MACHINE_PCI_IO_BASE_2F) ($t0)
andi $t1, $t0, GRUB_CS5536_SMB_REG_STATUS_SDAST andi $t1, $t0, VasEBoot_CS5536_SMB_REG_STATUS_SDAST
bne $t1, $zero, return bne $t1, $zero, return
nop nop
andi $t1, $t0, (GRUB_CS5536_SMB_REG_STATUS_BER | GRUB_CS5536_SMB_REG_STATUS_NACK) andi $t1, $t0, (VasEBoot_CS5536_SMB_REG_STATUS_BER | VasEBoot_CS5536_SMB_REG_STATUS_NACK)
beq $t1, $zero, 1b beq $t1, $zero, 1b
nop nop
jr $a0 jr $a0
@ -401,59 +401,59 @@ read_spd:
addiu $a0, $a0, %lo(read_spd_fail) addiu $a0, $a0, %lo(read_spd_fail)
/* Send START. */ /* Send START. */
lui $t0, %hi(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL1 + GRUB_MACHINE_PCI_IO_BASE_2F) lui $t0, %hi(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_CTRL1 + VasEBoot_MACHINE_PCI_IO_BASE_2F)
lb $t1, %lo(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL1 + GRUB_MACHINE_PCI_IO_BASE_2F) ($t0) lb $t1, %lo(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_CTRL1 + VasEBoot_MACHINE_PCI_IO_BASE_2F) ($t0)
ori $t1, $t1, GRUB_CS5536_SMB_REG_CTRL1_START ori $t1, $t1, VasEBoot_CS5536_SMB_REG_CTRL1_START
bal smbus_wait bal smbus_wait
sb $t1, %lo(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL1 + GRUB_MACHINE_PCI_IO_BASE_2F) ($t0) sb $t1, %lo(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_CTRL1 + VasEBoot_MACHINE_PCI_IO_BASE_2F) ($t0)
/* Send device address. */ /* Send device address. */
lui $t0, %hi(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_DATA + GRUB_MACHINE_PCI_IO_BASE_2F) lui $t0, %hi(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_DATA + VasEBoot_MACHINE_PCI_IO_BASE_2F)
sll $t1, $a1, 1 sll $t1, $a1, 1
bal smbus_wait bal smbus_wait
sb $t1, %lo(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_DATA + GRUB_MACHINE_PCI_IO_BASE_2F) ($t0) sb $t1, %lo(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_DATA + VasEBoot_MACHINE_PCI_IO_BASE_2F) ($t0)
/* Send ACK. */ /* Send ACK. */
lui $t0, %hi(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL1 + GRUB_MACHINE_PCI_IO_BASE_2F) lui $t0, %hi(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_CTRL1 + VasEBoot_MACHINE_PCI_IO_BASE_2F)
lb $t1, %lo(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL1 + GRUB_MACHINE_PCI_IO_BASE_2F) ($t0) lb $t1, %lo(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_CTRL1 + VasEBoot_MACHINE_PCI_IO_BASE_2F) ($t0)
ori $t1, $t1, GRUB_CS5536_SMB_REG_CTRL1_ACK ori $t1, $t1, VasEBoot_CS5536_SMB_REG_CTRL1_ACK
sb $t1, %lo(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL1 + GRUB_MACHINE_PCI_IO_BASE_2F) ($t0) sb $t1, %lo(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_CTRL1 + VasEBoot_MACHINE_PCI_IO_BASE_2F) ($t0)
/* Send byte address. */ /* Send byte address. */
lui $t0, %hi(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_DATA + GRUB_MACHINE_PCI_IO_BASE_2F) lui $t0, %hi(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_DATA + VasEBoot_MACHINE_PCI_IO_BASE_2F)
bal smbus_wait bal smbus_wait
sb $t2, %lo(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_DATA + GRUB_MACHINE_PCI_IO_BASE_2F) ($t0) sb $t2, %lo(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_DATA + VasEBoot_MACHINE_PCI_IO_BASE_2F) ($t0)
/* Send START. */ /* Send START. */
lui $t0, %hi(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL1 + GRUB_MACHINE_PCI_IO_BASE_2F) lui $t0, %hi(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_CTRL1 + VasEBoot_MACHINE_PCI_IO_BASE_2F)
lb $t1, %lo(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL1 + GRUB_MACHINE_PCI_IO_BASE_2F) ($t0) lb $t1, %lo(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_CTRL1 + VasEBoot_MACHINE_PCI_IO_BASE_2F) ($t0)
ori $t1, $t1, GRUB_CS5536_SMB_REG_CTRL1_START ori $t1, $t1, VasEBoot_CS5536_SMB_REG_CTRL1_START
bal smbus_wait bal smbus_wait
sb $t1, %lo(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL1 + GRUB_MACHINE_PCI_IO_BASE_2F) ($t0) sb $t1, %lo(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_CTRL1 + VasEBoot_MACHINE_PCI_IO_BASE_2F) ($t0)
/* Send device address. */ /* Send device address. */
lui $t0, %hi(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_DATA + GRUB_MACHINE_PCI_IO_BASE_2F) lui $t0, %hi(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_DATA + VasEBoot_MACHINE_PCI_IO_BASE_2F)
sll $t1, $a1, 1 sll $t1, $a1, 1
ori $t1, $t1, 1 ori $t1, $t1, 1
bal smbus_wait bal smbus_wait
sb $t1, %lo(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_DATA + GRUB_MACHINE_PCI_IO_BASE_2F) ($t0) sb $t1, %lo(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_DATA + VasEBoot_MACHINE_PCI_IO_BASE_2F) ($t0)
/* Send STOP. */ /* Send STOP. */
lui $t0, %hi(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL1 + GRUB_MACHINE_PCI_IO_BASE_2F) lui $t0, %hi(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_CTRL1 + VasEBoot_MACHINE_PCI_IO_BASE_2F)
lb $t1, %lo(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL1 + GRUB_MACHINE_PCI_IO_BASE_2F) ($t0) lb $t1, %lo(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_CTRL1 + VasEBoot_MACHINE_PCI_IO_BASE_2F) ($t0)
ori $t1, $t1, GRUB_CS5536_SMB_REG_CTRL1_STOP ori $t1, $t1, VasEBoot_CS5536_SMB_REG_CTRL1_STOP
bal smbus_wait bal smbus_wait
sb $t1, %lo(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL1 + GRUB_MACHINE_PCI_IO_BASE_2F) ($t0) sb $t1, %lo(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_CTRL1 + VasEBoot_MACHINE_PCI_IO_BASE_2F) ($t0)
lui $t0, %hi(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_DATA + GRUB_MACHINE_PCI_IO_BASE_2F) lui $t0, %hi(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_DATA + VasEBoot_MACHINE_PCI_IO_BASE_2F)
lb $v0, %lo(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_DATA + GRUB_MACHINE_PCI_IO_BASE_2F) ($t0) lb $v0, %lo(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_DATA + VasEBoot_MACHINE_PCI_IO_BASE_2F) ($t0)
jr $t3 jr $t3
andi $v0, $v0, 0xff andi $v0, $v0, 0xff
read_spd_fail: read_spd_fail:
jr $t3 jr $t3
ori $v0, $v0, 0x100 ori $v0, $v0, 0x100
notification_string: .asciz "GRUB " notification_string: .asciz "VasEBoot "
cs5536_found: .asciz "CS5536 at " cs5536_found: .asciz "CS5536 at "
sm_failed: .asciz "SM transaction failed.\n\r" sm_failed: .asciz "SM transaction failed.\n\r"
unhandled_tlb_refill: .asciz "Unhandled TLB refill.\n\r" unhandled_tlb_refill: .asciz "Unhandled TLB refill.\n\r"
@ -552,13 +552,13 @@ gpio_dump_end:
write_dumpreg: write_dumpreg:
ld $t2, 0($t6) ld $t2, 0($t6)
sd $t2, 0($t4) sd $t2, 0($t4)
addiu $t4, $t4, GRUB_CPU_LOONGSON_DDR2_REG_STEP addiu $t4, $t4, VasEBoot_CPU_LOONGSON_DDR2_REG_STEP
jr $ra jr $ra
addiu $t6, $t6, GRUB_CPU_LOONGSON_DDR2_REG_SIZE addiu $t6, $t6, VasEBoot_CPU_LOONGSON_DDR2_REG_SIZE
continue: continue:
lui $t4, %hi(GRUB_CPU_LOONGSON_DDR2_BASE) lui $t4, %hi(VasEBoot_CPU_LOONGSON_DDR2_BASE)
addiu $t4, $t4, %lo(GRUB_CPU_LOONGSON_DDR2_BASE) addiu $t4, $t4, %lo(VasEBoot_CPU_LOONGSON_DDR2_BASE)
lui $t6, %hi(regdump) lui $t6, %hi(regdump)
/* 0 */ /* 0 */
@ -566,20 +566,20 @@ continue:
addiu $t6, $t6, %lo(regdump) addiu $t6, $t6, %lo(regdump)
/* 1 */ /* 1 */
ori $a1, $a1, GRUB_SMB_RAM_START_ADDR ori $a1, $a1, VasEBoot_SMB_RAM_START_ADDR
move $t8, $zero move $t8, $zero
lui $t5, 0x0001 lui $t5, 0x0001
bal read_spd bal read_spd
ori $a0, $zero, GRUB_SMBUS_SPD_MEMORY_NUM_BANKS_ADDR ori $a0, $zero, VasEBoot_SMBUS_SPD_MEMORY_NUM_BANKS_ADDR
ori $t7, $zero, 8 ori $t7, $zero, 8
bne $v0, $t7, 1f bne $v0, $t7, 1f
ori $t5, $t5, 0x0001 ori $t5, $t5, 0x0001
ori $t8, $t8, GRUB_CPU_LOONGSON_DDR2_REG1_HI_8BANKS ori $t8, $t8, VasEBoot_CPU_LOONGSON_DDR2_REG1_HI_8BANKS
1: 1:
dsll $t8, $t8, 32 dsll $t8, $t8, 32
or $t5, $t5, $t8 or $t5, $t5, $t8
sd $t5, 0 ($t4) sd $t5, 0 ($t4)
addiu $t4, $t4, GRUB_CPU_LOONGSON_DDR2_REG_STEP addiu $t4, $t4, VasEBoot_CPU_LOONGSON_DDR2_REG_STEP
/* 2 */ /* 2 */
bal write_dumpreg bal write_dumpreg
@ -597,7 +597,7 @@ continue:
/* FIXME: figure termination resistance. */ /* FIXME: figure termination resistance. */
ori $t5, $zero, 0x2 ori $t5, $zero, 0x2
bal read_spd bal read_spd
ori $a0, $zero, GRUB_SMBUS_SPD_MEMORY_NUM_ROWS_ADDR ori $a0, $zero, VasEBoot_SMBUS_SPD_MEMORY_NUM_ROWS_ADDR
/* $v0 = 15 - $v0. */ /* $v0 = 15 - $v0. */
xori $v0, $v0, 0xf xori $v0, $v0, 0xf
andi $v0, $v0, 0x7 andi $v0, $v0, 0x7
@ -606,9 +606,9 @@ continue:
/* Find the fastest supported CAS latency. */ /* Find the fastest supported CAS latency. */
bal read_spd bal read_spd
ori $a0, $zero, GRUB_SMBUS_SPD_MEMORY_CAS_LATENCY_ADDR ori $a0, $zero, VasEBoot_SMBUS_SPD_MEMORY_CAS_LATENCY_ADDR
ori $t0, $zero, GRUB_SMBUS_SPD_MEMORY_CAS_LATENCY_MIN_VALUE ori $t0, $zero, VasEBoot_SMBUS_SPD_MEMORY_CAS_LATENCY_MIN_VALUE
ori $t1, $zero, (1 << GRUB_SMBUS_SPD_MEMORY_CAS_LATENCY_MIN_VALUE) ori $t1, $zero, (1 << VasEBoot_SMBUS_SPD_MEMORY_CAS_LATENCY_MIN_VALUE)
2: 2:
and $t2, $t1, $v0 and $t2, $t1, $v0
bne $t2, $zero, 1f bne $t2, $zero, 1f
@ -624,7 +624,7 @@ continue:
or $t5, $t5, $t0 or $t5, $t5, $t0
bal read_spd bal read_spd
ori $a0, $zero, GRUB_SMBUS_SPD_MEMORY_NUM_COLUMNS_ADDR ori $a0, $zero, VasEBoot_SMBUS_SPD_MEMORY_NUM_COLUMNS_ADDR
/* $v0 = 15 - ($v0 + 1) = 14 - $v0. */ /* $v0 = 15 - ($v0 + 1) = 14 - $v0. */
addiu $v0, $v0, 1 addiu $v0, $v0, 1
xori $v0, $v0, 0xf xori $v0, $v0, 0xf
@ -633,112 +633,112 @@ continue:
or $t5, $t5, $v0 or $t5, $t5, $v0
sd $t5, 0 ($t4) sd $t5, 0 ($t4)
addiu $t4, $t4, GRUB_CPU_LOONGSON_DDR2_REG_STEP addiu $t4, $t4, VasEBoot_CPU_LOONGSON_DDR2_REG_STEP
ori $t7, $zero, 0x16 ori $t7, $zero, 0x16
1: 1:
ld $t2, 0($t6) ld $t2, 0($t6)
sd $t2, 0($t4) sd $t2, 0($t4)
addiu $t4, $t4, GRUB_CPU_LOONGSON_DDR2_REG_STEP addiu $t4, $t4, VasEBoot_CPU_LOONGSON_DDR2_REG_STEP
addiu $t7, $t7, -1 addiu $t7, $t7, -1
bne $t7, $zero, 1b bne $t7, $zero, 1b
addiu $t6, $t6, GRUB_CPU_LOONGSON_DDR2_REG_SIZE addiu $t6, $t6, VasEBoot_CPU_LOONGSON_DDR2_REG_SIZE
lui $t4, %hi(GRUB_CPU_LOONGSON_DDR2_BASE) lui $t4, %hi(VasEBoot_CPU_LOONGSON_DDR2_BASE)
ld $t5, (%lo(GRUB_CPU_LOONGSON_DDR2_BASE) + 0x30) ($t4) ld $t5, (%lo(VasEBoot_CPU_LOONGSON_DDR2_BASE) + 0x30) ($t4)
ori $t0, $zero, 1 ori $t0, $zero, 1
dsll $t0, $t0, 40 dsll $t0, $t0, 40
or $t5, $t5, $t0 or $t5, $t5, $t0
sd $t5, (%lo(GRUB_CPU_LOONGSON_DDR2_BASE) + 0x30) ($t4) sd $t5, (%lo(VasEBoot_CPU_LOONGSON_DDR2_BASE) + 0x30) ($t4)
/* Desactivate DDR2 registers. */ /* Desactivate DDR2 registers. */
lui $t0, %hi (GRUB_CPU_LOONGSON_CORECFG) lui $t0, %hi (VasEBoot_CPU_LOONGSON_CORECFG)
ld $t1, %lo (GRUB_CPU_LOONGSON_CORECFG) ($t0) ld $t1, %lo (VasEBoot_CPU_LOONGSON_CORECFG) ($t0)
ori $t1, $t1, GRUB_CPU_LOONGSON_CORECFG_DISABLE_DDR2_SPACE ori $t1, $t1, VasEBoot_CPU_LOONGSON_CORECFG_DISABLE_DDR2_SPACE
sd $t1, %lo (GRUB_CPU_LOONGSON_CORECFG) ($t0) sd $t1, %lo (VasEBoot_CPU_LOONGSON_CORECFG) ($t0)
/* Enable cache. */ /* Enable cache. */
mfc0 $t0, GRUB_CPU_LOONGSON_COP0_CACHE_CONFIG mfc0 $t0, VasEBoot_CPU_LOONGSON_COP0_CACHE_CONFIG
addiu $t1, $zero, ~GRUB_CPU_LOONGSON_CACHE_TYPE_MASK addiu $t1, $zero, ~VasEBoot_CPU_LOONGSON_CACHE_TYPE_MASK
and $t0, $t1, $t1 and $t0, $t1, $t1
/* Set line size to 32 bytes and disabled cache. */ /* Set line size to 32 bytes and disabled cache. */
ori $t0, $t0, (GRUB_CPU_LOONGSON_COP0_CACHE_CONFIG_ILINESIZE \ ori $t0, $t0, (VasEBoot_CPU_LOONGSON_COP0_CACHE_CONFIG_ILINESIZE \
| GRUB_CPU_LOONGSON_COP0_CACHE_CONFIG_DLINESIZE \ | VasEBoot_CPU_LOONGSON_COP0_CACHE_CONFIG_DLINESIZE \
| GRUB_CPU_LOONGSON_CACHE_ACCELERATED) | VasEBoot_CPU_LOONGSON_CACHE_ACCELERATED)
mtc0 $t0, GRUB_CPU_LOONGSON_COP0_CACHE_CONFIG mtc0 $t0, VasEBoot_CPU_LOONGSON_COP0_CACHE_CONFIG
/* Invalidate all I-cache entries. */ /* Invalidate all I-cache entries. */
srl $t1, $t0, GRUB_CPU_LOONGSON_COP0_CACHE_ISIZE_SHIFT srl $t1, $t0, VasEBoot_CPU_LOONGSON_COP0_CACHE_ISIZE_SHIFT
andi $t1, $t1, GRUB_CPU_LOONGSON_COP0_CACHE_SIZE_MASK andi $t1, $t1, VasEBoot_CPU_LOONGSON_COP0_CACHE_SIZE_MASK
ori $t2, $zero, (1 << (GRUB_CPU_LOONGSON_COP0_CACHE_SIZE_OFFSET \ ori $t2, $zero, (1 << (VasEBoot_CPU_LOONGSON_COP0_CACHE_SIZE_OFFSET \
- GRUB_CPU_LOONGSON_CACHE_LINE_SIZE_LOG_BIG \ - VasEBoot_CPU_LOONGSON_CACHE_LINE_SIZE_LOG_BIG \
- GRUB_CPU_LOONGSON_I_CACHE_LOG_WAYS)) - VasEBoot_CPU_LOONGSON_I_CACHE_LOG_WAYS))
sll $t1, $t2, $t1 sll $t1, $t2, $t1
lui $t2, 0x8000 lui $t2, 0x8000
1: 1:
cache GRUB_CPU_LOONGSON_COP0_I_INDEX_INVALIDATE, 0($t2) cache VasEBoot_CPU_LOONGSON_COP0_I_INDEX_INVALIDATE, 0($t2)
addiu $t1, $t1, -1 addiu $t1, $t1, -1
bne $t1, $zero, 1b bne $t1, $zero, 1b
addiu $t2, $t2, (1 << GRUB_CPU_LOONGSON_COP0_I_INDEX_BIT_OFFSET) addiu $t2, $t2, (1 << VasEBoot_CPU_LOONGSON_COP0_I_INDEX_BIT_OFFSET)
/* Invalidate all D-cache entries. */ /* Invalidate all D-cache entries. */
srl $t1, $t0, GRUB_CPU_LOONGSON_COP0_CACHE_DSIZE_SHIFT srl $t1, $t0, VasEBoot_CPU_LOONGSON_COP0_CACHE_DSIZE_SHIFT
andi $t1, $t1, GRUB_CPU_LOONGSON_COP0_CACHE_SIZE_MASK andi $t1, $t1, VasEBoot_CPU_LOONGSON_COP0_CACHE_SIZE_MASK
ori $t2, $zero, (1 << (GRUB_CPU_LOONGSON_COP0_CACHE_SIZE_OFFSET \ ori $t2, $zero, (1 << (VasEBoot_CPU_LOONGSON_COP0_CACHE_SIZE_OFFSET \
- GRUB_CPU_LOONGSON_CACHE_LINE_SIZE_LOG_BIG \ - VasEBoot_CPU_LOONGSON_CACHE_LINE_SIZE_LOG_BIG \
- GRUB_CPU_LOONGSON_D_CACHE_LOG_WAYS)) - VasEBoot_CPU_LOONGSON_D_CACHE_LOG_WAYS))
sll $t1, $t2, $t1 sll $t1, $t2, $t1
lui $t2, 0x8000 lui $t2, 0x8000
mtc0 $zero, GRUB_CPU_LOONGSON_COP0_CACHE_TAGLO mtc0 $zero, VasEBoot_CPU_LOONGSON_COP0_CACHE_TAGLO
mtc0 $zero, GRUB_CPU_LOONGSON_COP0_CACHE_TAGHI mtc0 $zero, VasEBoot_CPU_LOONGSON_COP0_CACHE_TAGHI
1: 1:
/* All four ways. */ /* All four ways. */
cache GRUB_CPU_LOONGSON_COP0_D_INDEX_TAG_STORE, 0($t2) cache VasEBoot_CPU_LOONGSON_COP0_D_INDEX_TAG_STORE, 0($t2)
cache GRUB_CPU_LOONGSON_COP0_D_INDEX_TAG_STORE, 1($t2) cache VasEBoot_CPU_LOONGSON_COP0_D_INDEX_TAG_STORE, 1($t2)
cache GRUB_CPU_LOONGSON_COP0_D_INDEX_TAG_STORE, 2($t2) cache VasEBoot_CPU_LOONGSON_COP0_D_INDEX_TAG_STORE, 2($t2)
cache GRUB_CPU_LOONGSON_COP0_D_INDEX_TAG_STORE, 3($t2) cache VasEBoot_CPU_LOONGSON_COP0_D_INDEX_TAG_STORE, 3($t2)
addiu $t1, $t1, -1 addiu $t1, $t1, -1
bne $t1, $zero, 1b bne $t1, $zero, 1b
addiu $t2, $t2, (1 << GRUB_CPU_LOONGSON_COP0_D_INDEX_BIT_OFFSET) addiu $t2, $t2, (1 << VasEBoot_CPU_LOONGSON_COP0_D_INDEX_BIT_OFFSET)
/* Invalidate all S-cache entries. */ /* Invalidate all S-cache entries. */
ori $t1, $zero, (1 << (GRUB_CPU_LOONGSON_SECONDARY_CACHE_LOG_SIZE \ ori $t1, $zero, (1 << (VasEBoot_CPU_LOONGSON_SECONDARY_CACHE_LOG_SIZE \
- GRUB_CPU_LOONGSON_CACHE_LINE_SIZE_LOG_BIG \ - VasEBoot_CPU_LOONGSON_CACHE_LINE_SIZE_LOG_BIG \
- GRUB_CPU_LOONGSON_S_CACHE_LOG_WAYS)) - VasEBoot_CPU_LOONGSON_S_CACHE_LOG_WAYS))
lui $t2, 0x8000 lui $t2, 0x8000
mtc0 $zero, GRUB_CPU_LOONGSON_COP0_CACHE_TAGLO mtc0 $zero, VasEBoot_CPU_LOONGSON_COP0_CACHE_TAGLO
mtc0 $zero, GRUB_CPU_LOONGSON_COP0_CACHE_TAGHI mtc0 $zero, VasEBoot_CPU_LOONGSON_COP0_CACHE_TAGHI
1: 1:
/* All four ways. */ /* All four ways. */
cache GRUB_CPU_LOONGSON_COP0_S_INDEX_TAG_STORE, 0($t2) cache VasEBoot_CPU_LOONGSON_COP0_S_INDEX_TAG_STORE, 0($t2)
cache GRUB_CPU_LOONGSON_COP0_S_INDEX_TAG_STORE, 1($t2) cache VasEBoot_CPU_LOONGSON_COP0_S_INDEX_TAG_STORE, 1($t2)
cache GRUB_CPU_LOONGSON_COP0_S_INDEX_TAG_STORE, 2($t2) cache VasEBoot_CPU_LOONGSON_COP0_S_INDEX_TAG_STORE, 2($t2)
cache GRUB_CPU_LOONGSON_COP0_S_INDEX_TAG_STORE, 3($t2) cache VasEBoot_CPU_LOONGSON_COP0_S_INDEX_TAG_STORE, 3($t2)
addiu $t1, $t1, -1 addiu $t1, $t1, -1
bne $t1, $zero, 1b bne $t1, $zero, 1b
addiu $t2, $t2, (1 << GRUB_CPU_LOONGSON_COP0_D_INDEX_BIT_OFFSET) addiu $t2, $t2, (1 << VasEBoot_CPU_LOONGSON_COP0_D_INDEX_BIT_OFFSET)
/* Finally enable cache. */ /* Finally enable cache. */
mfc0 $t0, GRUB_CPU_LOONGSON_COP0_CACHE_CONFIG mfc0 $t0, VasEBoot_CPU_LOONGSON_COP0_CACHE_CONFIG
addiu $t1, $zero, ~GRUB_CPU_LOONGSON_CACHE_TYPE_MASK addiu $t1, $zero, ~VasEBoot_CPU_LOONGSON_CACHE_TYPE_MASK
and $t0, $t1, $t1 and $t0, $t1, $t1
ori $t0, $t0, GRUB_CPU_LOONGSON_CACHE_CACHED ori $t0, $t0, VasEBoot_CPU_LOONGSON_CACHE_CACHED
mtc0 $t0, GRUB_CPU_LOONGSON_COP0_CACHE_CONFIG mtc0 $t0, VasEBoot_CPU_LOONGSON_COP0_CACHE_CONFIG
lui $a0, %hi(caches_enabled) lui $a0, %hi(caches_enabled)
bal message bal message
addiu $a0, $a0, %lo(caches_enabled) addiu $a0, $a0, %lo(caches_enabled)
/* Set ROM delay cycles to 1. */ /* Set ROM delay cycles to 1. */
lui $t0, %hi(GRUB_CPU_LOONGSON_LIOCFG) lui $t0, %hi(VasEBoot_CPU_LOONGSON_LIOCFG)
lw $t1, %lo(GRUB_CPU_LOONGSON_LIOCFG) ($t0) lw $t1, %lo(VasEBoot_CPU_LOONGSON_LIOCFG) ($t0)
addiu $t2, $zero, ~(GRUB_CPU_LOONGSON_ROM_DELAY_MASK \ addiu $t2, $zero, ~(VasEBoot_CPU_LOONGSON_ROM_DELAY_MASK \
<< GRUB_CPU_LOONGSON_ROM_DELAY_OFFSET) << VasEBoot_CPU_LOONGSON_ROM_DELAY_OFFSET)
and $t1, $t1, $t2 and $t1, $t1, $t2
ori $t1, $t1, (1 << GRUB_CPU_LOONGSON_ROM_DELAY_OFFSET) ori $t1, $t1, (1 << VasEBoot_CPU_LOONGSON_ROM_DELAY_OFFSET)
sw $t1, %lo(GRUB_CPU_LOONGSON_LIOCFG) ($t0) sw $t1, %lo(VasEBoot_CPU_LOONGSON_LIOCFG) ($t0)
addiu $a0, $zero, -1 addiu $a0, $zero, -1
addiu $a1, $zero, -1 addiu $a1, $zero, -1
@ -748,9 +748,9 @@ continue:
addiu $t0, $t0, %lo(cached_continue - 0x20000000) addiu $t0, $t0, %lo(cached_continue - 0x20000000)
jr $t0 jr $t0
#ifdef FULOONG2F #ifdef FULOONG2F
addiu $a2, $zero, -(1 + GRUB_ARCH_MACHINE_FULOONG2F) addiu $a2, $zero, -(1 + VasEBoot_ARCH_MACHINE_FULOONG2F)
#else #else
addiu $a2, $zero, -(1 + GRUB_ARCH_MACHINE_YEELOONG) addiu $a2, $zero, -(1 + VasEBoot_ARCH_MACHINE_YEELOONG)
#endif #endif
cached_continue: cached_continue:

View File

@ -1,28 +1,28 @@
/* startup.S - Startup code for the MIPS. */ /* startup.S - Startup code for the MIPS. */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc. * Copyright (C) 2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/symbol.h> #include <VasEBoot/symbol.h>
#include <grub/offsets.h> #include <VasEBoot/offsets.h>
#include <grub/machine/memory.h> #include <VasEBoot/machine/memory.h>
#include <grub/machine/kernel.h> #include <VasEBoot/machine/kernel.h>
#include <grub/offsets.h> #include <VasEBoot/offsets.h>
#include <grub/mips/asm.h> #include <VasEBoot/mips/asm.h>
#define BASE_ADDR 8 #define BASE_ADDR 8
@ -40,13 +40,13 @@ start:
bal codestart bal codestart
nop nop
base: base:
.org GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE .org VasEBoot_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE
compressed_size: compressed_size:
.long 0 .long 0
.org GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE .org VasEBoot_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE
uncompressed_size: uncompressed_size:
.long 0 .long 0
.org GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_ADDR .org VasEBoot_DECOMPRESSOR_MACHINE_UNCOMPRESSED_ADDR
uncompressed_addr: uncompressed_addr:
.long 0 .long 0
codestart: codestart:
@ -55,7 +55,7 @@ codestart:
/* Parse arguments. Has to be done before relocation. /* Parse arguments. Has to be done before relocation.
So need to do it in asm. */ So need to do it in asm. */
#ifdef GRUB_MACHINE_MIPS_QEMU_MIPS #ifdef VasEBoot_MACHINE_MIPS_QEMU_MIPS
lui $t0, %hi (((16 << 20) - 264 + 4) | 0x80000000) lui $t0, %hi (((16 << 20) - 264 + 4) | 0x80000000)
lw $t1, %lo (((16 << 20) - 264 + 4) | 0x80000000) ($t0) lw $t1, %lo (((16 << 20) - 264 + 4) | 0x80000000) ($t0)
@ -74,7 +74,7 @@ codestart:
2: 2:
#endif #endif
#ifdef GRUB_MACHINE_MIPS_LOONGSON #ifdef VasEBoot_MACHINE_MIPS_LOONGSON
move $s2, $zero move $s2, $zero
move $s3, $zero move $s3, $zero
move $s4, $zero move $s4, $zero
@ -110,8 +110,8 @@ argcont:
DO_PARSE (cpuclockstr, $s3) DO_PARSE (cpuclockstr, $s3)
DO_PARSE (memsizestr, $s4) DO_PARSE (memsizestr, $s4)
DO_PARSE (highmemsizestr, $s5) DO_PARSE (highmemsizestr, $s5)
DO_CHECKT1 (pmon_yeeloong_verstr, GRUB_ARCH_MACHINE_YEELOONG) DO_CHECKT1 (pmon_yeeloong_verstr, VasEBoot_ARCH_MACHINE_YEELOONG)
DO_CHECKT1 (pmon_fuloong2f_verstr, GRUB_ARCH_MACHINE_FULOONG2F) DO_CHECKT1 (pmon_fuloong2f_verstr, VasEBoot_ARCH_MACHINE_FULOONG2F)
2: 2:
b argcont b argcont
addiu $t0, $t0, 4 addiu $t0, $t0, 4
@ -119,32 +119,32 @@ parsestr:
move $v0, $zero move $v0, $zero
move $t3, $t1 move $t3, $t1
3: 3:
lb GRUB_ASM_T4, 0($t2) lb VasEBoot_ASM_T4, 0($t2)
lb GRUB_ASM_T5, 0($t3) lb VasEBoot_ASM_T5, 0($t3)
addiu $t2, $t2, 1 addiu $t2, $t2, 1
addiu $t3, $t3, 1 addiu $t3, $t3, 1
beq GRUB_ASM_T5, $zero, 1f beq VasEBoot_ASM_T5, $zero, 1f
nop nop
beq GRUB_ASM_T5, GRUB_ASM_T4, 3b beq VasEBoot_ASM_T5, VasEBoot_ASM_T4, 3b
nop nop
bne GRUB_ASM_T4, $zero, 1f bne VasEBoot_ASM_T4, $zero, 1f
nop nop
addiu $t3, $t3, 0xffff addiu $t3, $t3, 0xffff
digcont: digcont:
lb GRUB_ASM_T5, 0($t3) lb VasEBoot_ASM_T5, 0($t3)
/* Substract '0' from digit. */ /* Substract '0' from digit. */
addiu GRUB_ASM_T5, GRUB_ASM_T5, 0xffd0 addiu VasEBoot_ASM_T5, VasEBoot_ASM_T5, 0xffd0
bltz GRUB_ASM_T5, 1f bltz VasEBoot_ASM_T5, 1f
nop nop
addiu GRUB_ASM_T4, GRUB_ASM_T5, 0xfff7 addiu VasEBoot_ASM_T4, VasEBoot_ASM_T5, 0xfff7
bgtz GRUB_ASM_T4, 1f bgtz VasEBoot_ASM_T4, 1f
nop nop
/* Multiply $v0 by 10 with bitshifts. */ /* Multiply $v0 by 10 with bitshifts. */
sll $v0, $v0, 1 sll $v0, $v0, 1
sll GRUB_ASM_T4, $v0, 2 sll VasEBoot_ASM_T4, $v0, 2
addu $v0, $v0, GRUB_ASM_T4 addu $v0, $v0, VasEBoot_ASM_T4
addu $v0, $v0, GRUB_ASM_T5 addu $v0, $v0, VasEBoot_ASM_T5
addiu $t3, $t3, 1 addiu $t3, $t3, 1
b digcont b digcont
nop nop
@ -173,20 +173,20 @@ argdone:
addiu $t7, $s0, (str - base);\ addiu $t7, $s0, (str - base);\
bal do_check ;\ bal do_check ;\
li $t2, val li $t2, val
DO_CHECKA1 (machtype_yeeloong_str1, GRUB_ARCH_MACHINE_YEELOONG) DO_CHECKA1 (machtype_yeeloong_str1, VasEBoot_ARCH_MACHINE_YEELOONG)
DO_CHECKA1 (machtype_yeeloong_str2, GRUB_ARCH_MACHINE_YEELOONG) DO_CHECKA1 (machtype_yeeloong_str2, VasEBoot_ARCH_MACHINE_YEELOONG)
DO_CHECKA1 (pmon_yeeloong_str, GRUB_ARCH_MACHINE_YEELOONG) DO_CHECKA1 (pmon_yeeloong_str, VasEBoot_ARCH_MACHINE_YEELOONG)
DO_CHECKA1 (machtype_fuloong2f_str, GRUB_ARCH_MACHINE_FULOONG2F) DO_CHECKA1 (machtype_fuloong2f_str, VasEBoot_ARCH_MACHINE_FULOONG2F)
DO_CHECKA1 (machtype_fuloong2e_str, GRUB_ARCH_MACHINE_FULOONG2E) DO_CHECKA1 (machtype_fuloong2e_str, VasEBoot_ARCH_MACHINE_FULOONG2E)
DO_CHECKA1 (pmon_fuloong2f_str, GRUB_ARCH_MACHINE_FULOONG2F) DO_CHECKA1 (pmon_fuloong2f_str, VasEBoot_ARCH_MACHINE_FULOONG2F)
addiu $a0, $a0, -1 addiu $a0, $a0, -1
b argdone b argdone
addiu $a1, $a1, 4 addiu $a1, $a1, 4
do_check: do_check:
lb GRUB_ASM_T4, 0($t7) lb VasEBoot_ASM_T4, 0($t7)
beq GRUB_ASM_T4, $zero, 1f beq VasEBoot_ASM_T4, $zero, 1f
lb $t3, 0($t6) lb $t3, 0($t6)
bne $t3, GRUB_ASM_T4, 2f bne $t3, VasEBoot_ASM_T4, 2f
addiu $t6, $t6, 1 addiu $t6, $t6, 1
b do_check b do_check
addiu $t7, $t7, 1 addiu $t7, $t7, 1
@ -199,7 +199,7 @@ argfw:
not $s7, $a2 not $s7, $a2
cmdlinedone: cmdlinedone:
#endif #endif
#ifdef GRUB_MACHINE_ARC #ifdef VasEBoot_MACHINE_ARC
lui $t0, %hi(_start - 256) lui $t0, %hi(_start - 256)
addiu $t0, $t0, %lo(_start - 256) addiu $t0, $t0, %lo(_start - 256)
addiu $t3, $t0, 255 addiu $t3, $t0, 255
@ -223,8 +223,8 @@ cmdlinedone:
1: 1:
beq $t1, $t3, 2f beq $t1, $t3, 2f
lb GRUB_ASM_T4, 0($t2) lb VasEBoot_ASM_T4, 0($t2)
sb GRUB_ASM_T4, 0($t1) sb VasEBoot_ASM_T4, 0($t1)
addiu $t1, $t1, 1 addiu $t1, $t1, 1
b 1b b 1b
addiu $t2, $t2, 1 addiu $t2, $t2, 1
@ -258,9 +258,9 @@ cmdlinedone:
subu $a0, $a0, $t0 subu $a0, $a0, $t0
addu $a0, $a0, $s0 addu $a0, $a0, $s0
lw $a1, (GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_ADDR - BASE_ADDR)($s0) lw $a1, (VasEBoot_DECOMPRESSOR_MACHINE_UNCOMPRESSED_ADDR - BASE_ADDR)($s0)
lw $a2, (GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE - BASE_ADDR)($s0) lw $a2, (VasEBoot_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE - BASE_ADDR)($s0)
lw $a3, (GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE - BASE_ADDR)($s0) lw $a3, (VasEBoot_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE - BASE_ADDR)($s0)
move $s1, $a1 move $s1, $a1
/* $a0 contains source compressed address, $a1 is destination, /* $a0 contains source compressed address, $a1 is destination,
@ -268,10 +268,10 @@ cmdlinedone:
*/ */
move $s6, $a3 move $s6, $a3
lui $t9, %hi(EXT_C(grub_decompress_core)) lui $t9, %hi(EXT_C(VasEBoot_decompress_core))
addiu $t9, $t9, %lo(EXT_C(grub_decompress_core)) addiu $t9, $t9, %lo(EXT_C(VasEBoot_decompress_core))
#ifdef GRUB_MACHINE_ARC #ifdef VasEBoot_MACHINE_ARC
lui $sp, %hi(_start - 512) lui $sp, %hi(_start - 512)
jalr $t9 jalr $t9
addiu $sp, $sp, %lo(_start - 512) addiu $sp, $sp, %lo(_start - 512)
@ -285,8 +285,8 @@ cmdlinedone:
#include "../../kern/mips/cache_flush.S" #include "../../kern/mips/cache_flush.S"
lui $t1, %hi(GRUB_MACHINE_LINK_ADDR) lui $t1, %hi(VasEBoot_MACHINE_LINK_ADDR)
addiu $t1, %lo(GRUB_MACHINE_LINK_ADDR) addiu $t1, %lo(VasEBoot_MACHINE_LINK_ADDR)
jr $t1 jr $t1
nop nop

View File

@ -167,6 +167,6 @@ FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
</OS-BADGE-ICONS> </OS-BADGE-ICONS>
<BOOT-SCRIPT> <BOOT-SCRIPT>
boot &device;:&partition;,\System\Library\CoreServices\grub.elf boot &device;:&partition;,\System\Library\CoreServices\VasEBoot.elf
</BOOT-SCRIPT> </BOOT-SCRIPT>
</CHRP-BOOT> </CHRP-BOOT>

View File

@ -1,7 +1,7 @@
<chrp-boot> <chrp-boot>
<description>@PACKAGE@ @VERSION@</description> <description>@PACKAGE@ @VERSION@</description>
<os-name>@PACKAGE@ @VERSION@</os-name> <os-name>@PACKAGE@ @VERSION@</os-name>
<boot-script>boot &device;:\boot\grub\powerpc.elf</boot-script> <boot-script>boot &device;:\boot\VasEBoot\powerpc.elf</boot-script>
<icon size=64,64 color-space=3,3,2> <icon size=64,64 color-space=3,3,2>
<bitmap> <bitmap>
FF FF FF FF FF FF FF FF FF FF 92 6D 6D 6D 6D 6D 6D 6D 6D 6D DB FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF B6 92 6D 92 92 92 DB FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF 92 6D 6D 6D 6D 6D 6D 6D 6D 6D DB FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF FF B6 92 6D 92 92 92 DB FF FF FF FF FF FF FF FF FF FF

View File

@ -1,23 +1,23 @@
/* -*-Asm-*- */ /* -*-Asm-*- */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc. * Copyright (C) 2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/machine/boot.h> #include <VasEBoot/machine/boot.h>
.text .text
.align 4 .align 4
@ -30,32 +30,32 @@ pic_base:
#ifndef CDBOOT #ifndef CDBOOT
/* The offsets to these locations are defined by the /* The offsets to these locations are defined by the
* GRUB_BOOT_MACHINE_foo macros in include/grub/sparc/ieee1275/boot.h, * VasEBoot_BOOT_MACHINE_foo macros in include/VasEBoot/sparc/ieee1275/boot.h,
* and grub-setup uses this to patch these next three values as needed. * and VasEBoot-setup uses this to patch these next three values as needed.
* *
* The boot_path will be the OF device path of the partition where the * The boot_path will be the OF device path of the partition where the
* rest of the GRUB kernel image resides. kernel_sector will be set to * rest of the VasEBoot kernel image resides. kernel_sector will be set to
* the location of the first block of the GRUB kernel, and * the location of the first block of the VasEBoot kernel, and
* kernel_address is the location where we should load that first block. * kernel_address is the location where we should load that first block.
* *
* After loading in that block we will execute it by jumping to the * After loading in that block we will execute it by jumping to the
* load address plus the size of the prepended A.OUT header (32 bytes). * load address plus the size of the prepended A.OUT header (32 bytes).
*/ */
.org GRUB_BOOT_MACHINE_BOOT_DEVPATH .org VasEBoot_BOOT_MACHINE_BOOT_DEVPATH
boot_path: boot_path:
.org GRUB_BOOT_MACHINE_KERNEL_BYTE .org VasEBoot_BOOT_MACHINE_KERNEL_BYTE
boot_path_end: boot_path_end:
kernel_byte: .xword (2 << 9) kernel_byte: .xword (2 << 9)
kernel_address: .word GRUB_BOOT_MACHINE_KERNEL_ADDR kernel_address: .word VasEBoot_BOOT_MACHINE_KERNEL_ADDR
#else #else
#define boot_path (_start + 512 + SCRATCH_PAD_BOOT_SIZE) #define boot_path (_start + 512 + SCRATCH_PAD_BOOT_SIZE)
#define boot_path_end (_start + 1024) #define boot_path_end (_start + 1024)
#include <grub/offsets.h> #include <VasEBoot/offsets.h>
.org 8 .org 8
kernel_byte: .xword (2 << 9) kernel_byte: .xword (2 << 9)
kernel_size: .word 512 kernel_size: .word 512
kernel_address: .word GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS kernel_address: .word VasEBoot_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS
#endif #endif
prom_finddev_name: .asciz "finddevice" prom_finddev_name: .asciz "finddevice"
@ -68,8 +68,8 @@ prom_open_name: .asciz "open"
prom_seek_name: .asciz "seek" prom_seek_name: .asciz "seek"
prom_read_name: .asciz "read" prom_read_name: .asciz "read"
prom_exit_name: .asciz "exit" prom_exit_name: .asciz "exit"
grub_name: .asciz "GRUB " VasEBoot_name: .asciz "VasEBoot "
#define GRUB_NAME_LEN 5 #define VasEBoot_NAME_LEN 5
.align 4 .align 4
@ -167,10 +167,10 @@ boot_continue:
lduw [%l1 + 256], STDOUT_NODE_REG lduw [%l1 + 256], STDOUT_NODE_REG
brz,pn STDOUT_NODE_REG, prom_error brz,pn STDOUT_NODE_REG, prom_error
/* write(stdout_node, "GRUB ", strlen("GRUB ")) */ /* write(stdout_node, "VasEBoot ", strlen("VasEBoot ")) */
GET_ABS(grub_name, %o2) GET_ABS(VasEBoot_name, %o2)
call console_write call console_write
mov GRUB_NAME_LEN, %o3 mov VasEBoot_NAME_LEN, %o3
GET_ABS(boot_path, %o3) GET_ABS(boot_path, %o3)
#ifndef CDBOOT #ifndef CDBOOT
@ -186,7 +186,7 @@ boot_continue:
bootpath_known: bootpath_known:
/* Open up the boot_path, and use that handle to read the /* Open up the boot_path, and use that handle to read the
* first block of the GRUB kernel image. * first block of the VasEBoot kernel image.
* *
* bootdev_handle = open(boot_path) * bootdev_handle = open(boot_path)
*/ */
@ -224,7 +224,7 @@ bootpath_known:
#else #else
nop nop
#endif #endif
.org GRUB_BOOT_MACHINE_CODE_END .org VasEBoot_BOOT_MACHINE_CODE_END
/* the last 4 bytes in the sector 0 contain the signature */ /* the last 4 bytes in the sector 0 contain the signature */
.word GRUB_BOOT_MACHINE_SIGNATURE .word VasEBoot_BOOT_MACHINE_SIGNATURE

View File

@ -1,24 +1,24 @@
/* -*-Asm-*- */ /* -*-Asm-*- */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc. * Copyright (C) 2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/machine/boot.h> #include <VasEBoot/machine/boot.h>
#include <grub/offsets.h> #include <VasEBoot/offsets.h>
.text .text
.align 4 .align 4
@ -87,8 +87,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_SPARC64_IEEE1275_LIST_SIZE, %l2) GET_ABS(firstlist - VasEBoot_BOOT_SPARC64_IEEE1275_LIST_SIZE, %l2)
set GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS, %l3 set VasEBoot_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS, %l3
bootloop: bootloop:
lduw [%l2 + 0x08], %o0 lduw [%l2 + 0x08], %o0
brz %o0, bootit brz %o0, bootit
@ -115,7 +115,7 @@ bootloop:
mov NOTIFICATION_STEP_LEN, %o3 mov NOTIFICATION_STEP_LEN, %o3
ba bootloop ba bootloop
sub %l2, GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE, %l2 sub %l2, VasEBoot_BOOT_SPARC64_IEEE1275_LIST_SIZE, %l2
bootit: bootit:
GET_ABS(prom_close_name, %o0) GET_ABS(prom_close_name, %o0)
@ -127,8 +127,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_SPARC64_IEEE1275_IMAGE_ADDRESS), %o2 sethi %hi(VasEBoot_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS), %o2
jmpl %o2 + %lo(GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS), %o7 jmpl %o2 + %lo(VasEBoot_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS), %o7
mov CIF_REG, %o4 mov CIF_REG, %o4
1: ba,a 1b 1: ba,a 1b
@ -136,7 +136,7 @@ lastlist:
.word 0 .word 0
.word 0 .word 0
.org (0x200 - GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE) .org (0x200 - VasEBoot_BOOT_SPARC64_IEEE1275_LIST_SIZE)
blocklist_default_start: blocklist_default_start:
.word 0 .word 0
.word 2 .word 2

View File

@ -1,90 +1,90 @@
/* bonito.c - PCI bonito interface. */ /* bonito.c - PCI bonito interface. */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc. * Copyright (C) 2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/pci.h> #include <VasEBoot/pci.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
static grub_uint32_t base_win[GRUB_MACHINE_PCI_NUM_WIN]; static VasEBoot_uint32_t base_win[VasEBoot_MACHINE_PCI_NUM_WIN];
static const grub_size_t sizes_win[GRUB_MACHINE_PCI_NUM_WIN] = static const VasEBoot_size_t sizes_win[VasEBoot_MACHINE_PCI_NUM_WIN] =
{GRUB_MACHINE_PCI_WIN1_SIZE, GRUB_MACHINE_PCI_WIN_SIZE, {VasEBoot_MACHINE_PCI_WIN1_SIZE, VasEBoot_MACHINE_PCI_WIN_SIZE,
GRUB_MACHINE_PCI_WIN_SIZE}; VasEBoot_MACHINE_PCI_WIN_SIZE};
/* Usage counters. */ /* Usage counters. */
static int usage_win[GRUB_MACHINE_PCI_NUM_WIN]; static int usage_win[VasEBoot_MACHINE_PCI_NUM_WIN];
static grub_addr_t addr_win[GRUB_MACHINE_PCI_NUM_WIN] = static VasEBoot_addr_t addr_win[VasEBoot_MACHINE_PCI_NUM_WIN] =
{GRUB_MACHINE_PCI_WIN1_ADDR, GRUB_MACHINE_PCI_WIN2_ADDR, {VasEBoot_MACHINE_PCI_WIN1_ADDR, VasEBoot_MACHINE_PCI_WIN2_ADDR,
GRUB_MACHINE_PCI_WIN3_ADDR}; VasEBoot_MACHINE_PCI_WIN3_ADDR};
grub_bonito_type_t grub_bonito_type; VasEBoot_bonito_type_t VasEBoot_bonito_type;
static volatile void * static volatile void *
config_addr (grub_pci_address_t addr) config_addr (VasEBoot_pci_address_t addr)
{ {
if (grub_bonito_type == GRUB_BONITO_2F) if (VasEBoot_bonito_type == VasEBoot_BONITO_2F)
{ {
GRUB_MACHINE_PCI_CONF_CTRL_REG_2F = 1 << ((addr >> 11) & 0xf); VasEBoot_MACHINE_PCI_CONF_CTRL_REG_2F = 1 << ((addr >> 11) & 0xf);
return (volatile void *) (GRUB_MACHINE_PCI_CONFSPACE_2F return (volatile void *) (VasEBoot_MACHINE_PCI_CONFSPACE_2F
| (addr & 0x07ff)); | (addr & 0x07ff));
} }
else else
{ {
if (addr >> 16) if (addr >> 16)
return (volatile void *) (GRUB_MACHINE_PCI_CONFSPACE_3A_EXT | addr); return (volatile void *) (VasEBoot_MACHINE_PCI_CONFSPACE_3A_EXT | addr);
else else
return (volatile void *) (GRUB_MACHINE_PCI_CONFSPACE_3A | addr); return (volatile void *) (VasEBoot_MACHINE_PCI_CONFSPACE_3A | addr);
} }
} }
grub_uint32_t VasEBoot_uint32_t
grub_pci_read (grub_pci_address_t addr) VasEBoot_pci_read (VasEBoot_pci_address_t addr)
{ {
return *(volatile grub_uint32_t *) config_addr (addr); return *(volatile VasEBoot_uint32_t *) config_addr (addr);
} }
grub_uint16_t VasEBoot_uint16_t
grub_pci_read_word (grub_pci_address_t addr) VasEBoot_pci_read_word (VasEBoot_pci_address_t addr)
{ {
return *(volatile grub_uint16_t *) config_addr (addr); return *(volatile VasEBoot_uint16_t *) config_addr (addr);
} }
grub_uint8_t VasEBoot_uint8_t
grub_pci_read_byte (grub_pci_address_t addr) VasEBoot_pci_read_byte (VasEBoot_pci_address_t addr)
{ {
return *(volatile grub_uint8_t *) config_addr (addr); return *(volatile VasEBoot_uint8_t *) config_addr (addr);
} }
void void
grub_pci_write (grub_pci_address_t addr, grub_uint32_t data) VasEBoot_pci_write (VasEBoot_pci_address_t addr, VasEBoot_uint32_t data)
{ {
*(volatile grub_uint32_t *) config_addr (addr) = data; *(volatile VasEBoot_uint32_t *) config_addr (addr) = data;
} }
void void
grub_pci_write_word (grub_pci_address_t addr, grub_uint16_t data) VasEBoot_pci_write_word (VasEBoot_pci_address_t addr, VasEBoot_uint16_t data)
{ {
*(volatile grub_uint16_t *) config_addr (addr) = data; *(volatile VasEBoot_uint16_t *) config_addr (addr) = data;
} }
void void
grub_pci_write_byte (grub_pci_address_t addr, grub_uint8_t data) VasEBoot_pci_write_byte (VasEBoot_pci_address_t addr, VasEBoot_uint8_t data)
{ {
*(volatile grub_uint8_t *) config_addr (addr) = data; *(volatile VasEBoot_uint8_t *) config_addr (addr) = data;
} }
@ -92,35 +92,35 @@ static inline void
write_bases_2f (void) write_bases_2f (void)
{ {
int i; int i;
grub_uint32_t reg = 0; VasEBoot_uint32_t reg = 0;
for (i = 0; i < GRUB_MACHINE_PCI_NUM_WIN; i++) for (i = 0; i < VasEBoot_MACHINE_PCI_NUM_WIN; i++)
reg |= (((base_win[i] >> GRUB_MACHINE_PCI_WIN_SHIFT) reg |= (((base_win[i] >> VasEBoot_MACHINE_PCI_WIN_SHIFT)
& GRUB_MACHINE_PCI_WIN_MASK) & VasEBoot_MACHINE_PCI_WIN_MASK)
<< (i * GRUB_MACHINE_PCI_WIN_MASK_SIZE)); << (i * VasEBoot_MACHINE_PCI_WIN_MASK_SIZE));
GRUB_MACHINE_PCI_IO_CTRL_REG_2F = reg; VasEBoot_MACHINE_PCI_IO_CTRL_REG_2F = reg;
} }
volatile void * volatile void *
grub_pci_device_map_range (grub_pci_device_t dev __attribute__ ((unused)), VasEBoot_pci_device_map_range (VasEBoot_pci_device_t dev __attribute__ ((unused)),
grub_addr_t base, grub_size_t size) VasEBoot_addr_t base, VasEBoot_size_t size)
{ {
if (grub_bonito_type == GRUB_BONITO_2F) if (VasEBoot_bonito_type == VasEBoot_BONITO_2F)
{ {
int i; int i;
grub_addr_t newbase; VasEBoot_addr_t newbase;
/* First try already used registers. */ /* First try already used registers. */
for (i = 0; i < GRUB_MACHINE_PCI_NUM_WIN; i++) for (i = 0; i < VasEBoot_MACHINE_PCI_NUM_WIN; i++)
if (usage_win[i] && base_win[i] <= base if (usage_win[i] && base_win[i] <= base
&& base_win[i] + sizes_win[i] > base + size) && base_win[i] + sizes_win[i] > base + size)
{ {
usage_win[i]++; usage_win[i]++;
return (void *) return (void *)
(addr_win[i] | (base & GRUB_MACHINE_PCI_WIN_OFFSET_MASK)); (addr_win[i] | (base & VasEBoot_MACHINE_PCI_WIN_OFFSET_MASK));
} }
/* Map new register. */ /* Map new register. */
newbase = base & ~GRUB_MACHINE_PCI_WIN_OFFSET_MASK; newbase = base & ~VasEBoot_MACHINE_PCI_WIN_OFFSET_MASK;
for (i = 0; i < GRUB_MACHINE_PCI_NUM_WIN; i++) for (i = 0; i < VasEBoot_MACHINE_PCI_NUM_WIN; i++)
if (!usage_win[i] && newbase <= base if (!usage_win[i] && newbase <= base
&& newbase + sizes_win[i] > base + size) && newbase + sizes_win[i] > base + size)
{ {
@ -128,9 +128,9 @@ grub_pci_device_map_range (grub_pci_device_t dev __attribute__ ((unused)),
base_win[i] = newbase; base_win[i] = newbase;
write_bases_2f (); write_bases_2f ();
return (void *) return (void *)
(addr_win[i] | (base & GRUB_MACHINE_PCI_WIN_OFFSET_MASK)); (addr_win[i] | (base & VasEBoot_MACHINE_PCI_WIN_OFFSET_MASK));
} }
grub_fatal ("Out of PCI windows."); VasEBoot_fatal ("Out of PCI windows.");
} }
else else
{ {
@ -142,35 +142,35 @@ grub_pci_device_map_range (grub_pci_device_t dev __attribute__ ((unused)),
&& base + size <= 0x1f000000) && base + size <= 0x1f000000)
region = 2; region = 2;
if (region == 0) if (region == 0)
grub_fatal ("Attempt to map out of regions"); VasEBoot_fatal ("Attempt to map out of regions");
return (void *) (0xa0000000 | base); return (void *) (0xa0000000 | base);
} }
} }
void * void *
grub_pci_device_map_range_cached (grub_pci_device_t dev, VasEBoot_pci_device_map_range_cached (VasEBoot_pci_device_t dev,
grub_addr_t base, grub_size_t size) VasEBoot_addr_t base, VasEBoot_size_t size)
{ {
return (void *) (((grub_addr_t) grub_pci_device_map_range (dev, base, size)) return (void *) (((VasEBoot_addr_t) VasEBoot_pci_device_map_range (dev, base, size))
& ~0x20000000); & ~0x20000000);
} }
void void
grub_pci_device_unmap_range (grub_pci_device_t dev __attribute__ ((unused)), VasEBoot_pci_device_unmap_range (VasEBoot_pci_device_t dev __attribute__ ((unused)),
volatile void *mem, volatile void *mem,
grub_size_t size __attribute__ ((unused))) VasEBoot_size_t size __attribute__ ((unused)))
{ {
if (grub_bonito_type == GRUB_BONITO_2F) if (VasEBoot_bonito_type == VasEBoot_BONITO_2F)
{ {
int i; int i;
for (i = 0; i < GRUB_MACHINE_PCI_NUM_WIN; i++) for (i = 0; i < VasEBoot_MACHINE_PCI_NUM_WIN; i++)
if (usage_win[i] && addr_win[i] if (usage_win[i] && addr_win[i]
== (((grub_addr_t) mem | 0x20000000) == (((VasEBoot_addr_t) mem | 0x20000000)
& ~GRUB_MACHINE_PCI_WIN_OFFSET_MASK)) & ~VasEBoot_MACHINE_PCI_WIN_OFFSET_MASK))
{ {
usage_win[i]--; usage_win[i]--;
return; return;
} }
grub_fatal ("Tried to unmap not mapped region"); VasEBoot_fatal ("Tried to unmap not mapped region");
} }
} }

View File

@ -1,48 +1,48 @@
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2010 Free Software Foundation, Inc. * Copyright (C) 2010 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/types.h> #include <VasEBoot/types.h>
#include <grub/cs5536.h> #include <VasEBoot/cs5536.h>
#include <grub/pci.h> #include <VasEBoot/pci.h>
#include <grub/time.h> #include <VasEBoot/time.h>
#include <grub/ata.h> #include <VasEBoot/ata.h>
#ifdef GRUB_MACHINE_MIPS_LOONGSON #ifdef VasEBoot_MACHINE_MIPS_LOONGSON
#include <grub/machine/kernel.h> #include <VasEBoot/machine/kernel.h>
#endif #endif
#include <grub/dl.h> #include <VasEBoot/dl.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
/* Context for grub_cs5536_find. */ /* Context for VasEBoot_cs5536_find. */
struct grub_cs5536_find_ctx struct VasEBoot_cs5536_find_ctx
{ {
grub_pci_device_t *devp; VasEBoot_pci_device_t *devp;
int found; int found;
}; };
/* Helper for grub_cs5536_find. */ /* Helper for VasEBoot_cs5536_find. */
static int static int
grub_cs5536_find_iter (grub_pci_device_t dev, grub_pci_id_t pciid, void *data) VasEBoot_cs5536_find_iter (VasEBoot_pci_device_t dev, VasEBoot_pci_id_t pciid, void *data)
{ {
struct grub_cs5536_find_ctx *ctx = data; struct VasEBoot_cs5536_find_ctx *ctx = data;
if (pciid == GRUB_CS5536_PCIID) if (pciid == VasEBoot_CS5536_PCIID)
{ {
*ctx->devp = dev; *ctx->devp = dev;
ctx->found = 1; ctx->found = 1;
@ -52,330 +52,330 @@ grub_cs5536_find_iter (grub_pci_device_t dev, grub_pci_id_t pciid, void *data)
} }
int int
grub_cs5536_find (grub_pci_device_t *devp) VasEBoot_cs5536_find (VasEBoot_pci_device_t *devp)
{ {
struct grub_cs5536_find_ctx ctx = { struct VasEBoot_cs5536_find_ctx ctx = {
.devp = devp, .devp = devp,
.found = 0 .found = 0
}; };
grub_pci_iterate (grub_cs5536_find_iter, &ctx); VasEBoot_pci_iterate (VasEBoot_cs5536_find_iter, &ctx);
return ctx.found; return ctx.found;
} }
grub_uint64_t VasEBoot_uint64_t
grub_cs5536_read_msr (grub_pci_device_t dev, grub_uint32_t addr) VasEBoot_cs5536_read_msr (VasEBoot_pci_device_t dev, VasEBoot_uint32_t addr)
{ {
grub_uint64_t ret = 0; VasEBoot_uint64_t ret = 0;
grub_pci_write (grub_pci_make_address (dev, GRUB_CS5536_MSR_MAILBOX_ADDR), VasEBoot_pci_write (VasEBoot_pci_make_address (dev, VasEBoot_CS5536_MSR_MAILBOX_ADDR),
addr); addr);
ret = (grub_uint64_t) ret = (VasEBoot_uint64_t)
grub_pci_read (grub_pci_make_address (dev, GRUB_CS5536_MSR_MAILBOX_DATA0)); VasEBoot_pci_read (VasEBoot_pci_make_address (dev, VasEBoot_CS5536_MSR_MAILBOX_DATA0));
ret |= (((grub_uint64_t) ret |= (((VasEBoot_uint64_t)
grub_pci_read (grub_pci_make_address (dev, VasEBoot_pci_read (VasEBoot_pci_make_address (dev,
GRUB_CS5536_MSR_MAILBOX_DATA1))) VasEBoot_CS5536_MSR_MAILBOX_DATA1)))
<< 32); << 32);
return ret; return ret;
} }
void void
grub_cs5536_write_msr (grub_pci_device_t dev, grub_uint32_t addr, VasEBoot_cs5536_write_msr (VasEBoot_pci_device_t dev, VasEBoot_uint32_t addr,
grub_uint64_t val) VasEBoot_uint64_t val)
{ {
grub_pci_write (grub_pci_make_address (dev, GRUB_CS5536_MSR_MAILBOX_ADDR), VasEBoot_pci_write (VasEBoot_pci_make_address (dev, VasEBoot_CS5536_MSR_MAILBOX_ADDR),
addr); addr);
grub_pci_write (grub_pci_make_address (dev, GRUB_CS5536_MSR_MAILBOX_DATA0), VasEBoot_pci_write (VasEBoot_pci_make_address (dev, VasEBoot_CS5536_MSR_MAILBOX_DATA0),
val & 0xffffffff); val & 0xffffffff);
grub_pci_write (grub_pci_make_address (dev, GRUB_CS5536_MSR_MAILBOX_DATA1), VasEBoot_pci_write (VasEBoot_pci_make_address (dev, VasEBoot_CS5536_MSR_MAILBOX_DATA1),
val >> 32); val >> 32);
} }
grub_err_t VasEBoot_err_t
grub_cs5536_smbus_wait (grub_port_t smbbase) VasEBoot_cs5536_smbus_wait (VasEBoot_port_t smbbase)
{ {
grub_uint64_t start = grub_get_time_ms (); VasEBoot_uint64_t start = VasEBoot_get_time_ms ();
while (1) while (1)
{ {
grub_uint8_t status; VasEBoot_uint8_t status;
status = grub_inb (smbbase + GRUB_CS5536_SMB_REG_STATUS); status = VasEBoot_inb (smbbase + VasEBoot_CS5536_SMB_REG_STATUS);
if (status & GRUB_CS5536_SMB_REG_STATUS_SDAST) if (status & VasEBoot_CS5536_SMB_REG_STATUS_SDAST)
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
if (status & GRUB_CS5536_SMB_REG_STATUS_BER) if (status & VasEBoot_CS5536_SMB_REG_STATUS_BER)
return grub_error (GRUB_ERR_IO, "SM bus error"); return VasEBoot_error (VasEBoot_ERR_IO, "SM bus error");
if (status & GRUB_CS5536_SMB_REG_STATUS_NACK) if (status & VasEBoot_CS5536_SMB_REG_STATUS_NACK)
return grub_error (GRUB_ERR_IO, "NACK received"); return VasEBoot_error (VasEBoot_ERR_IO, "NACK received");
if (grub_get_time_ms () > start + 40) if (VasEBoot_get_time_ms () > start + 40)
return grub_error (GRUB_ERR_IO, "SM stalled"); return VasEBoot_error (VasEBoot_ERR_IO, "SM stalled");
} }
} }
grub_err_t VasEBoot_err_t
grub_cs5536_read_spd_byte (grub_port_t smbbase, grub_uint8_t dev, VasEBoot_cs5536_read_spd_byte (VasEBoot_port_t smbbase, VasEBoot_uint8_t dev,
grub_uint8_t addr, grub_uint8_t *res) VasEBoot_uint8_t addr, VasEBoot_uint8_t *res)
{ {
grub_err_t err; VasEBoot_err_t err;
/* Send START. */ /* Send START. */
grub_outb (grub_inb (smbbase + GRUB_CS5536_SMB_REG_CTRL1) VasEBoot_outb (VasEBoot_inb (smbbase + VasEBoot_CS5536_SMB_REG_CTRL1)
| GRUB_CS5536_SMB_REG_CTRL1_START, | VasEBoot_CS5536_SMB_REG_CTRL1_START,
smbbase + GRUB_CS5536_SMB_REG_CTRL1); smbbase + VasEBoot_CS5536_SMB_REG_CTRL1);
/* Send device address. */ /* Send device address. */
err = grub_cs5536_smbus_wait (smbbase); err = VasEBoot_cs5536_smbus_wait (smbbase);
if (err) if (err)
return err; return err;
grub_outb (dev << 1, smbbase + GRUB_CS5536_SMB_REG_DATA); VasEBoot_outb (dev << 1, smbbase + VasEBoot_CS5536_SMB_REG_DATA);
/* Send ACK. */ /* Send ACK. */
err = grub_cs5536_smbus_wait (smbbase); err = VasEBoot_cs5536_smbus_wait (smbbase);
if (err) if (err)
return err; return err;
grub_outb (grub_inb (smbbase + GRUB_CS5536_SMB_REG_CTRL1) VasEBoot_outb (VasEBoot_inb (smbbase + VasEBoot_CS5536_SMB_REG_CTRL1)
| GRUB_CS5536_SMB_REG_CTRL1_ACK, | VasEBoot_CS5536_SMB_REG_CTRL1_ACK,
smbbase + GRUB_CS5536_SMB_REG_CTRL1); smbbase + VasEBoot_CS5536_SMB_REG_CTRL1);
/* Send byte address. */ /* Send byte address. */
grub_outb (addr, smbbase + GRUB_CS5536_SMB_REG_DATA); VasEBoot_outb (addr, smbbase + VasEBoot_CS5536_SMB_REG_DATA);
/* Send START. */ /* Send START. */
err = grub_cs5536_smbus_wait (smbbase); err = VasEBoot_cs5536_smbus_wait (smbbase);
if (err) if (err)
return err; return err;
grub_outb (grub_inb (smbbase + GRUB_CS5536_SMB_REG_CTRL1) VasEBoot_outb (VasEBoot_inb (smbbase + VasEBoot_CS5536_SMB_REG_CTRL1)
| GRUB_CS5536_SMB_REG_CTRL1_START, | VasEBoot_CS5536_SMB_REG_CTRL1_START,
smbbase + GRUB_CS5536_SMB_REG_CTRL1); smbbase + VasEBoot_CS5536_SMB_REG_CTRL1);
/* Send device address. */ /* Send device address. */
err = grub_cs5536_smbus_wait (smbbase); err = VasEBoot_cs5536_smbus_wait (smbbase);
if (err) if (err)
return err; return err;
grub_outb ((dev << 1) | 1, smbbase + GRUB_CS5536_SMB_REG_DATA); VasEBoot_outb ((dev << 1) | 1, smbbase + VasEBoot_CS5536_SMB_REG_DATA);
/* Send STOP. */ /* Send STOP. */
err = grub_cs5536_smbus_wait (smbbase); err = VasEBoot_cs5536_smbus_wait (smbbase);
if (err) if (err)
return err; return err;
grub_outb (grub_inb (smbbase + GRUB_CS5536_SMB_REG_CTRL1) VasEBoot_outb (VasEBoot_inb (smbbase + VasEBoot_CS5536_SMB_REG_CTRL1)
| GRUB_CS5536_SMB_REG_CTRL1_STOP, | VasEBoot_CS5536_SMB_REG_CTRL1_STOP,
smbbase + GRUB_CS5536_SMB_REG_CTRL1); smbbase + VasEBoot_CS5536_SMB_REG_CTRL1);
err = grub_cs5536_smbus_wait (smbbase); err = VasEBoot_cs5536_smbus_wait (smbbase);
if (err) if (err)
return err; return err;
*res = grub_inb (smbbase + GRUB_CS5536_SMB_REG_DATA); *res = VasEBoot_inb (smbbase + VasEBoot_CS5536_SMB_REG_DATA);
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
} }
grub_err_t VasEBoot_err_t
grub_cs5536_init_smbus (grub_pci_device_t dev, grub_uint16_t divisor, VasEBoot_cs5536_init_smbus (VasEBoot_pci_device_t dev, VasEBoot_uint16_t divisor,
grub_port_t *smbbase) VasEBoot_port_t *smbbase)
{ {
grub_uint64_t smbbar; VasEBoot_uint64_t smbbar;
smbbar = grub_cs5536_read_msr (dev, GRUB_CS5536_MSR_SMB_BAR); smbbar = VasEBoot_cs5536_read_msr (dev, VasEBoot_CS5536_MSR_SMB_BAR);
/* FIXME */ /* FIXME */
if (!(smbbar & GRUB_CS5536_LBAR_ENABLE)) if (!(smbbar & VasEBoot_CS5536_LBAR_ENABLE))
return grub_error(GRUB_ERR_IO, "SMB controller not enabled\n"); return VasEBoot_error(VasEBoot_ERR_IO, "SMB controller not enabled\n");
*smbbase = (smbbar & GRUB_CS5536_LBAR_ADDR_MASK) + GRUB_MACHINE_PCI_IO_BASE; *smbbase = (smbbar & VasEBoot_CS5536_LBAR_ADDR_MASK) + VasEBoot_MACHINE_PCI_IO_BASE;
if (divisor < 8) if (divisor < 8)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid divisor"); return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, "invalid divisor");
/* Disable SMB. */ /* Disable SMB. */
grub_outb (0, *smbbase + GRUB_CS5536_SMB_REG_CTRL2); VasEBoot_outb (0, *smbbase + VasEBoot_CS5536_SMB_REG_CTRL2);
/* Disable interrupts. */ /* Disable interrupts. */
grub_outb (0, *smbbase + GRUB_CS5536_SMB_REG_CTRL1); VasEBoot_outb (0, *smbbase + VasEBoot_CS5536_SMB_REG_CTRL1);
/* Set as master. */ /* Set as master. */
grub_outb (GRUB_CS5536_SMB_REG_ADDR_MASTER, VasEBoot_outb (VasEBoot_CS5536_SMB_REG_ADDR_MASTER,
*smbbase + GRUB_CS5536_SMB_REG_ADDR); *smbbase + VasEBoot_CS5536_SMB_REG_ADDR);
/* Launch. */ /* Launch. */
grub_outb (((divisor >> 7) & 0xff), *smbbase + GRUB_CS5536_SMB_REG_CTRL3); VasEBoot_outb (((divisor >> 7) & 0xff), *smbbase + VasEBoot_CS5536_SMB_REG_CTRL3);
grub_outb (((divisor << 1) & 0xfe) | GRUB_CS5536_SMB_REG_CTRL2_ENABLE, VasEBoot_outb (((divisor << 1) & 0xfe) | VasEBoot_CS5536_SMB_REG_CTRL2_ENABLE,
*smbbase + GRUB_CS5536_SMB_REG_CTRL2); *smbbase + VasEBoot_CS5536_SMB_REG_CTRL2);
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
} }
grub_err_t VasEBoot_err_t
grub_cs5536_read_spd (grub_port_t smbbase, grub_uint8_t dev, VasEBoot_cs5536_read_spd (VasEBoot_port_t smbbase, VasEBoot_uint8_t dev,
struct grub_smbus_spd *res) struct VasEBoot_smbus_spd *res)
{ {
grub_err_t err; VasEBoot_err_t err;
grub_size_t size; VasEBoot_size_t size;
grub_uint8_t b; VasEBoot_uint8_t b;
grub_size_t ptr; VasEBoot_size_t ptr;
err = grub_cs5536_read_spd_byte (smbbase, dev, 0, &b); err = VasEBoot_cs5536_read_spd_byte (smbbase, dev, 0, &b);
if (err) if (err)
return err; return err;
if (b == 0) if (b == 0)
return grub_error (GRUB_ERR_IO, "no SPD found"); return VasEBoot_error (VasEBoot_ERR_IO, "no SPD found");
size = b; size = b;
((grub_uint8_t *) res)[0] = b; ((VasEBoot_uint8_t *) res)[0] = b;
for (ptr = 1; ptr < size; ptr++) for (ptr = 1; ptr < size; ptr++)
{ {
err = grub_cs5536_read_spd_byte (smbbase, dev, ptr, err = VasEBoot_cs5536_read_spd_byte (smbbase, dev, ptr,
&((grub_uint8_t *) res)[ptr]); &((VasEBoot_uint8_t *) res)[ptr]);
if (err) if (err)
return err; return err;
} }
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
} }
static inline void static inline void
set_io_space (grub_pci_device_t dev, int num, grub_uint16_t start, set_io_space (VasEBoot_pci_device_t dev, int num, VasEBoot_uint16_t start,
grub_uint16_t len) VasEBoot_uint16_t len)
{ {
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_GL_REGIONS_START + num, VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_GL_REGIONS_START + num,
((((grub_uint64_t) start + len - 4) ((((VasEBoot_uint64_t) start + len - 4)
<< GRUB_CS5536_MSR_GL_REGION_IO_TOP_SHIFT) << VasEBoot_CS5536_MSR_GL_REGION_IO_TOP_SHIFT)
& GRUB_CS5536_MSR_GL_REGION_TOP_MASK) & VasEBoot_CS5536_MSR_GL_REGION_TOP_MASK)
| (((grub_uint64_t) start | (((VasEBoot_uint64_t) start
<< GRUB_CS5536_MSR_GL_REGION_IO_BASE_SHIFT) << VasEBoot_CS5536_MSR_GL_REGION_IO_BASE_SHIFT)
& GRUB_CS5536_MSR_GL_REGION_BASE_MASK) & VasEBoot_CS5536_MSR_GL_REGION_BASE_MASK)
| GRUB_CS5536_MSR_GL_REGION_IO | VasEBoot_CS5536_MSR_GL_REGION_IO
| GRUB_CS5536_MSR_GL_REGION_ENABLE); | VasEBoot_CS5536_MSR_GL_REGION_ENABLE);
} }
static inline void static inline void
set_iod (grub_pci_device_t dev, int num, int dest, int start, int mask) set_iod (VasEBoot_pci_device_t dev, int num, int dest, int start, int mask)
{ {
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_GL_IOD_START + num, VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_GL_IOD_START + num,
((grub_uint64_t) dest << GRUB_CS5536_IOD_DEST_SHIFT) ((VasEBoot_uint64_t) dest << VasEBoot_CS5536_IOD_DEST_SHIFT)
| (((grub_uint64_t) start & GRUB_CS5536_IOD_ADDR_MASK) | (((VasEBoot_uint64_t) start & VasEBoot_CS5536_IOD_ADDR_MASK)
<< GRUB_CS5536_IOD_BASE_SHIFT) << VasEBoot_CS5536_IOD_BASE_SHIFT)
| ((mask & GRUB_CS5536_IOD_ADDR_MASK) | ((mask & VasEBoot_CS5536_IOD_ADDR_MASK)
<< GRUB_CS5536_IOD_MASK_SHIFT)); << VasEBoot_CS5536_IOD_MASK_SHIFT));
} }
static inline void static inline void
set_p2d (grub_pci_device_t dev, int num, int dest, grub_uint32_t start) set_p2d (VasEBoot_pci_device_t dev, int num, int dest, VasEBoot_uint32_t start)
{ {
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_GL_P2D_START + num, VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_GL_P2D_START + num,
(((grub_uint64_t) dest) << GRUB_CS5536_P2D_DEST_SHIFT) (((VasEBoot_uint64_t) dest) << VasEBoot_CS5536_P2D_DEST_SHIFT)
| ((grub_uint64_t) (start >> GRUB_CS5536_P2D_LOG_ALIGN) | ((VasEBoot_uint64_t) (start >> VasEBoot_CS5536_P2D_LOG_ALIGN)
<< GRUB_CS5536_P2D_BASE_SHIFT) << VasEBoot_CS5536_P2D_BASE_SHIFT)
| (((1 << (32 - GRUB_CS5536_P2D_LOG_ALIGN)) - 1) | (((1 << (32 - VasEBoot_CS5536_P2D_LOG_ALIGN)) - 1)
<< GRUB_CS5536_P2D_MASK_SHIFT)); << VasEBoot_CS5536_P2D_MASK_SHIFT));
} }
void void
grub_cs5536_init_geode (grub_pci_device_t dev) VasEBoot_cs5536_init_geode (VasEBoot_pci_device_t dev)
{ {
/* Enable more BARs. */ /* Enable more BARs. */
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_IRQ_MAP_BAR, VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_IRQ_MAP_BAR,
GRUB_CS5536_LBAR_TURN_ON | GRUB_CS5536_LBAR_IRQ_MAP); VasEBoot_CS5536_LBAR_TURN_ON | VasEBoot_CS5536_LBAR_IRQ_MAP);
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_MFGPT_BAR, VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_MFGPT_BAR,
GRUB_CS5536_LBAR_TURN_ON | GRUB_CS5536_LBAR_MFGPT); VasEBoot_CS5536_LBAR_TURN_ON | VasEBoot_CS5536_LBAR_MFGPT);
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_ACPI_BAR, VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_ACPI_BAR,
GRUB_CS5536_LBAR_TURN_ON | GRUB_CS5536_LBAR_ACPI); VasEBoot_CS5536_LBAR_TURN_ON | VasEBoot_CS5536_LBAR_ACPI);
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_PM_BAR, VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_PM_BAR,
GRUB_CS5536_LBAR_TURN_ON | GRUB_CS5536_LBAR_PM); VasEBoot_CS5536_LBAR_TURN_ON | VasEBoot_CS5536_LBAR_PM);
/* Setup DIVIL. */ /* Setup DIVIL. */
#ifdef GRUB_MACHINE_MIPS_LOONGSON #ifdef VasEBoot_MACHINE_MIPS_LOONGSON
switch (grub_arch_machine) switch (VasEBoot_arch_machine)
{ {
case GRUB_ARCH_MACHINE_YEELOONG: case VasEBoot_ARCH_MACHINE_YEELOONG:
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_DIVIL_LEG_IO, VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_DIVIL_LEG_IO,
GRUB_CS5536_MSR_DIVIL_LEG_IO_MODE_X86 VasEBoot_CS5536_MSR_DIVIL_LEG_IO_MODE_X86
| GRUB_CS5536_MSR_DIVIL_LEG_IO_F_REMAP | VasEBoot_CS5536_MSR_DIVIL_LEG_IO_F_REMAP
| GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE0 | VasEBoot_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE0
| GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE1); | VasEBoot_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE1);
break; break;
case GRUB_ARCH_MACHINE_FULOONG2F: case VasEBoot_ARCH_MACHINE_FULOONG2F:
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_DIVIL_LEG_IO, VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_DIVIL_LEG_IO,
GRUB_CS5536_MSR_DIVIL_LEG_IO_UART2_COM3 VasEBoot_CS5536_MSR_DIVIL_LEG_IO_UART2_COM3
| GRUB_CS5536_MSR_DIVIL_LEG_IO_UART1_COM1 | VasEBoot_CS5536_MSR_DIVIL_LEG_IO_UART1_COM1
| GRUB_CS5536_MSR_DIVIL_LEG_IO_MODE_X86 | VasEBoot_CS5536_MSR_DIVIL_LEG_IO_MODE_X86
| GRUB_CS5536_MSR_DIVIL_LEG_IO_F_REMAP | VasEBoot_CS5536_MSR_DIVIL_LEG_IO_F_REMAP
| GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE0 | VasEBoot_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE0
| GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE1); | VasEBoot_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE1);
break; break;
} }
#endif #endif
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_DIVIL_IRQ_MAPPER_PRIMARY_MASK, VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_DIVIL_IRQ_MAPPER_PRIMARY_MASK,
(~GRUB_CS5536_DIVIL_LPC_INTERRUPTS) & 0xffff); (~VasEBoot_CS5536_DIVIL_LPC_INTERRUPTS) & 0xffff);
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_DIVIL_IRQ_MAPPER_LPC_MASK, VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_DIVIL_IRQ_MAPPER_LPC_MASK,
GRUB_CS5536_DIVIL_LPC_INTERRUPTS); VasEBoot_CS5536_DIVIL_LPC_INTERRUPTS);
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_DIVIL_LPC_SERIAL_IRQ_CONTROL, VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_DIVIL_LPC_SERIAL_IRQ_CONTROL,
GRUB_CS5536_MSR_DIVIL_LPC_SERIAL_IRQ_CONTROL_ENABLE); VasEBoot_CS5536_MSR_DIVIL_LPC_SERIAL_IRQ_CONTROL_ENABLE);
/* Initialise USB controller. */ /* Initialise USB controller. */
/* FIXME: assign adresses dynamically. */ /* FIXME: assign adresses dynamically. */
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_USB_OHCI_BASE, VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_USB_OHCI_BASE,
GRUB_CS5536_MSR_USB_BASE_BUS_MASTER VasEBoot_CS5536_MSR_USB_BASE_BUS_MASTER
| GRUB_CS5536_MSR_USB_BASE_MEMORY_ENABLE | VasEBoot_CS5536_MSR_USB_BASE_MEMORY_ENABLE
| 0x05024000); | 0x05024000);
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_USB_EHCI_BASE, VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_USB_EHCI_BASE,
GRUB_CS5536_MSR_USB_BASE_BUS_MASTER VasEBoot_CS5536_MSR_USB_BASE_BUS_MASTER
| GRUB_CS5536_MSR_USB_BASE_MEMORY_ENABLE | VasEBoot_CS5536_MSR_USB_BASE_MEMORY_ENABLE
| (0x20ULL << GRUB_CS5536_MSR_USB_EHCI_BASE_FLDJ_SHIFT) | (0x20ULL << VasEBoot_CS5536_MSR_USB_EHCI_BASE_FLDJ_SHIFT)
| 0x05023000); | 0x05023000);
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_USB_CONTROLLER_BASE, VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_USB_CONTROLLER_BASE,
GRUB_CS5536_MSR_USB_BASE_BUS_MASTER VasEBoot_CS5536_MSR_USB_BASE_BUS_MASTER
| GRUB_CS5536_MSR_USB_BASE_MEMORY_ENABLE | 0x05020000); | VasEBoot_CS5536_MSR_USB_BASE_MEMORY_ENABLE | 0x05020000);
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_USB_OPTION_CONTROLLER_BASE, VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_USB_OPTION_CONTROLLER_BASE,
GRUB_CS5536_MSR_USB_BASE_MEMORY_ENABLE | 0x05022000); VasEBoot_CS5536_MSR_USB_BASE_MEMORY_ENABLE | 0x05022000);
set_p2d (dev, 0, GRUB_CS5536_DESTINATION_USB, 0x05020000); set_p2d (dev, 0, VasEBoot_CS5536_DESTINATION_USB, 0x05020000);
set_p2d (dev, 1, GRUB_CS5536_DESTINATION_USB, 0x05022000); set_p2d (dev, 1, VasEBoot_CS5536_DESTINATION_USB, 0x05022000);
set_p2d (dev, 5, GRUB_CS5536_DESTINATION_USB, 0x05024000); set_p2d (dev, 5, VasEBoot_CS5536_DESTINATION_USB, 0x05024000);
set_p2d (dev, 6, GRUB_CS5536_DESTINATION_USB, 0x05023000); set_p2d (dev, 6, VasEBoot_CS5536_DESTINATION_USB, 0x05023000);
{ {
volatile grub_uint32_t *oc; volatile VasEBoot_uint32_t *oc;
oc = grub_pci_device_map_range (dev, 0x05022000, oc = VasEBoot_pci_device_map_range (dev, 0x05022000,
GRUB_CS5536_USB_OPTION_REGS_SIZE); VasEBoot_CS5536_USB_OPTION_REGS_SIZE);
oc[GRUB_CS5536_USB_OPTION_REG_UOCMUX] = oc[VasEBoot_CS5536_USB_OPTION_REG_UOCMUX] =
(oc[GRUB_CS5536_USB_OPTION_REG_UOCMUX] (oc[VasEBoot_CS5536_USB_OPTION_REG_UOCMUX]
& ~GRUB_CS5536_USB_OPTION_REG_UOCMUX_PMUX_MASK) & ~VasEBoot_CS5536_USB_OPTION_REG_UOCMUX_PMUX_MASK)
| GRUB_CS5536_USB_OPTION_REG_UOCMUX_PMUX_HC; | VasEBoot_CS5536_USB_OPTION_REG_UOCMUX_PMUX_HC;
grub_pci_device_unmap_range (dev, oc, GRUB_CS5536_USB_OPTION_REGS_SIZE); VasEBoot_pci_device_unmap_range (dev, oc, VasEBoot_CS5536_USB_OPTION_REGS_SIZE);
} }
/* Setup IDE controller. */ /* Setup IDE controller. */
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_IDE_IO_BAR, VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_IDE_IO_BAR,
GRUB_CS5536_LBAR_IDE VasEBoot_CS5536_LBAR_IDE
| GRUB_CS5536_MSR_IDE_IO_BAR_UNITS); | VasEBoot_CS5536_MSR_IDE_IO_BAR_UNITS);
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_IDE_CFG, VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_IDE_CFG,
GRUB_CS5536_MSR_IDE_CFG_CHANNEL_ENABLE); VasEBoot_CS5536_MSR_IDE_CFG_CHANNEL_ENABLE);
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_IDE_TIMING, VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_IDE_TIMING,
(GRUB_CS5536_MSR_IDE_TIMING_PIO0 (VasEBoot_CS5536_MSR_IDE_TIMING_PIO0
<< GRUB_CS5536_MSR_IDE_TIMING_DRIVE0_SHIFT) << VasEBoot_CS5536_MSR_IDE_TIMING_DRIVE0_SHIFT)
| (GRUB_CS5536_MSR_IDE_TIMING_PIO0 | (VasEBoot_CS5536_MSR_IDE_TIMING_PIO0
<< GRUB_CS5536_MSR_IDE_TIMING_DRIVE1_SHIFT)); << VasEBoot_CS5536_MSR_IDE_TIMING_DRIVE1_SHIFT));
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_IDE_CAS_TIMING, VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_IDE_CAS_TIMING,
(GRUB_CS5536_MSR_IDE_CAS_TIMING_CMD_PIO0 (VasEBoot_CS5536_MSR_IDE_CAS_TIMING_CMD_PIO0
<< GRUB_CS5536_MSR_IDE_CAS_TIMING_CMD_SHIFT) << VasEBoot_CS5536_MSR_IDE_CAS_TIMING_CMD_SHIFT)
| (GRUB_CS5536_MSR_IDE_CAS_TIMING_PIO0 | (VasEBoot_CS5536_MSR_IDE_CAS_TIMING_PIO0
<< GRUB_CS5536_MSR_IDE_CAS_TIMING_DRIVE0_SHIFT) << VasEBoot_CS5536_MSR_IDE_CAS_TIMING_DRIVE0_SHIFT)
| (GRUB_CS5536_MSR_IDE_CAS_TIMING_PIO0 | (VasEBoot_CS5536_MSR_IDE_CAS_TIMING_PIO0
<< GRUB_CS5536_MSR_IDE_CAS_TIMING_DRIVE1_SHIFT)); << VasEBoot_CS5536_MSR_IDE_CAS_TIMING_DRIVE1_SHIFT));
/* Setup Geodelink PCI. */ /* Setup Geodelink PCI. */
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_GL_PCI_CTRL, VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_GL_PCI_CTRL,
(4ULL << GRUB_CS5536_MSR_GL_PCI_CTRL_OUT_THR_SHIFT) (4ULL << VasEBoot_CS5536_MSR_GL_PCI_CTRL_OUT_THR_SHIFT)
| (4ULL << GRUB_CS5536_MSR_GL_PCI_CTRL_IN_THR_SHIFT) | (4ULL << VasEBoot_CS5536_MSR_GL_PCI_CTRL_IN_THR_SHIFT)
| (8ULL << GRUB_CS5536_MSR_GL_PCI_CTRL_LATENCY_SHIFT) | (8ULL << VasEBoot_CS5536_MSR_GL_PCI_CTRL_LATENCY_SHIFT)
| GRUB_CS5536_MSR_GL_PCI_CTRL_IO_ENABLE | VasEBoot_CS5536_MSR_GL_PCI_CTRL_IO_ENABLE
| GRUB_CS5536_MSR_GL_PCI_CTRL_MEMORY_ENABLE); | VasEBoot_CS5536_MSR_GL_PCI_CTRL_MEMORY_ENABLE);
/* Setup windows. */ /* Setup windows. */
set_io_space (dev, 0, GRUB_CS5536_LBAR_SMBUS, GRUB_CS5536_SMBUS_REGS_SIZE); set_io_space (dev, 0, VasEBoot_CS5536_LBAR_SMBUS, VasEBoot_CS5536_SMBUS_REGS_SIZE);
set_io_space (dev, 1, GRUB_CS5536_LBAR_GPIO, GRUB_CS5536_GPIO_REGS_SIZE); set_io_space (dev, 1, VasEBoot_CS5536_LBAR_GPIO, VasEBoot_CS5536_GPIO_REGS_SIZE);
set_io_space (dev, 2, GRUB_CS5536_LBAR_MFGPT, GRUB_CS5536_MFGPT_REGS_SIZE); set_io_space (dev, 2, VasEBoot_CS5536_LBAR_MFGPT, VasEBoot_CS5536_MFGPT_REGS_SIZE);
set_io_space (dev, 3, GRUB_CS5536_LBAR_IRQ_MAP, GRUB_CS5536_IRQ_MAP_REGS_SIZE); set_io_space (dev, 3, VasEBoot_CS5536_LBAR_IRQ_MAP, VasEBoot_CS5536_IRQ_MAP_REGS_SIZE);
set_io_space (dev, 4, GRUB_CS5536_LBAR_PM, GRUB_CS5536_PM_REGS_SIZE); set_io_space (dev, 4, VasEBoot_CS5536_LBAR_PM, VasEBoot_CS5536_PM_REGS_SIZE);
set_io_space (dev, 5, GRUB_CS5536_LBAR_ACPI, GRUB_CS5536_ACPI_REGS_SIZE); set_io_space (dev, 5, VasEBoot_CS5536_LBAR_ACPI, VasEBoot_CS5536_ACPI_REGS_SIZE);
set_iod (dev, 0, GRUB_CS5536_DESTINATION_IDE, GRUB_ATA_CH0_PORT1, 0xffff8); set_iod (dev, 0, VasEBoot_CS5536_DESTINATION_IDE, VasEBoot_ATA_CH0_PORT1, 0xffff8);
set_iod (dev, 1, GRUB_CS5536_DESTINATION_ACC, GRUB_CS5536_LBAR_ACC, 0xfff80); set_iod (dev, 1, VasEBoot_CS5536_DESTINATION_ACC, VasEBoot_CS5536_LBAR_ACC, 0xfff80);
set_iod (dev, 2, GRUB_CS5536_DESTINATION_IDE, GRUB_CS5536_LBAR_IDE, 0xffff0); set_iod (dev, 2, VasEBoot_CS5536_DESTINATION_IDE, VasEBoot_CS5536_LBAR_IDE, 0xffff0);
} }

View File

@ -1,38 +1,38 @@
/* pci.c - Generic PCI interfaces. */ /* pci.c - Generic PCI interfaces. */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2007,2009 Free Software Foundation, Inc. * Copyright (C) 2007,2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/pci.h> #include <VasEBoot/pci.h>
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/emu/misc.h> #include <VasEBoot/emu/misc.h>
#include <grub/util/misc.h> #include <VasEBoot/util/misc.h>
grub_pci_address_t VasEBoot_pci_address_t
grub_pci_make_address (grub_pci_device_t dev, int reg) VasEBoot_pci_make_address (VasEBoot_pci_device_t dev, int reg)
{ {
grub_pci_address_t ret; VasEBoot_pci_address_t ret;
ret.dev = dev; ret.dev = dev;
ret.pos = reg; ret.pos = reg;
return ret; return ret;
} }
void void
grub_pci_iterate (grub_pci_iteratefunc_t hook, void *hook_data) VasEBoot_pci_iterate (VasEBoot_pci_iteratefunc_t hook, void *hook_data)
{ {
struct pci_device_iterator *iter; struct pci_device_iterator *iter;
struct pci_slot_match slot; struct pci_slot_match slot;
@ -48,31 +48,31 @@ grub_pci_iterate (grub_pci_iteratefunc_t hook, void *hook_data)
} }
void * void *
grub_pci_device_map_range (grub_pci_device_t dev, grub_addr_t base, VasEBoot_pci_device_map_range (VasEBoot_pci_device_t dev, VasEBoot_addr_t base,
grub_size_t size) VasEBoot_size_t size)
{ {
void *addr; void *addr;
int err; int err;
err = pci_device_map_range (dev, base, size, PCI_DEV_MAP_FLAG_WRITABLE, &addr); err = pci_device_map_range (dev, base, size, PCI_DEV_MAP_FLAG_WRITABLE, &addr);
if (err) if (err)
grub_util_error ("mapping 0x%llx failed (error %d)", VasEBoot_util_error ("mapping 0x%llx failed (error %d)",
(unsigned long long) base, err); (unsigned long long) base, err);
return addr; return addr;
} }
void void
grub_pci_device_unmap_range (grub_pci_device_t dev, void *mem, VasEBoot_pci_device_unmap_range (VasEBoot_pci_device_t dev, void *mem,
grub_size_t size) VasEBoot_size_t size)
{ {
pci_device_unmap_range (dev, mem, size); pci_device_unmap_range (dev, mem, size);
} }
GRUB_MOD_INIT (emupci) VasEBoot_MOD_INIT (emupci)
{ {
pci_system_init (); pci_system_init ();
} }
GRUB_MOD_FINI (emupci) VasEBoot_MOD_FINI (emupci)
{ {
pci_system_cleanup (); pci_system_cleanup ();
} }

View File

@ -1,42 +1,42 @@
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2013 Free Software Foundation, Inc. * Copyright (C) 2013 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/pci.h> #include <VasEBoot/pci.h>
#include <grub/mm.h> #include <VasEBoot/mm.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/ieee1275/ieee1275.h> #include <VasEBoot/ieee1275/ieee1275.h>
volatile void * volatile void *
grub_pci_device_map_range (grub_pci_device_t dev __attribute__ ((unused)), VasEBoot_pci_device_map_range (VasEBoot_pci_device_t dev __attribute__ ((unused)),
grub_addr_t base, VasEBoot_addr_t base,
grub_size_t size) VasEBoot_size_t size)
{ {
if (grub_ieee1275_test_flag (GRUB_IEEE1275_FLAG_REAL_MODE)) if (VasEBoot_ieee1275_test_flag (VasEBoot_IEEE1275_FLAG_REAL_MODE))
return (volatile void *) base; return (volatile void *) base;
if (grub_ieee1275_map (base, base, size, 7)) if (VasEBoot_ieee1275_map (base, base, size, 7))
grub_fatal ("couldn't map 0x%lx", base); VasEBoot_fatal ("couldn't map 0x%lx", base);
return (volatile void *) base; return (volatile void *) base;
} }
void void
grub_pci_device_unmap_range (grub_pci_device_t dev __attribute__ ((unused)), VasEBoot_pci_device_unmap_range (VasEBoot_pci_device_t dev __attribute__ ((unused)),
volatile void *mem __attribute__ ((unused)), volatile void *mem __attribute__ ((unused)),
grub_size_t size __attribute__ ((unused))) VasEBoot_size_t size __attribute__ ((unused)))
{ {
} }

View File

@ -1,118 +1,118 @@
/* pci.c - Generic PCI interfaces. */ /* pci.c - Generic PCI interfaces. */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2007,2009 Free Software Foundation, Inc. * Copyright (C) 2007,2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/pci.h> #include <VasEBoot/pci.h>
#include <grub/mm.h> #include <VasEBoot/mm.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/mm_private.h> #include <VasEBoot/mm_private.h>
#include <grub/cache.h> #include <VasEBoot/cache.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
/* FIXME: correctly support 64-bit architectures. */ /* FIXME: correctly support 64-bit architectures. */
/* #if GRUB_TARGET_SIZEOF_VOID_P == 4 */ /* #if VasEBoot_TARGET_SIZEOF_VOID_P == 4 */
struct grub_pci_dma_chunk * struct VasEBoot_pci_dma_chunk *
grub_memalign_dma32 (grub_size_t align, grub_size_t size) VasEBoot_memalign_dma32 (VasEBoot_size_t align, VasEBoot_size_t size)
{ {
void *ret; void *ret;
if (align < 64) if (align < 64)
align = 64; align = 64;
size = ALIGN_UP (size, align); size = ALIGN_UP (size, align);
ret = grub_memalign (align, size); ret = VasEBoot_memalign (align, size);
#if GRUB_CPU_SIZEOF_VOID_P == 8 #if VasEBoot_CPU_SIZEOF_VOID_P == 8
if ((grub_addr_t) ret >> 32) if ((VasEBoot_addr_t) ret >> 32)
{ {
/* Shouldn't happend since the only platform in this case is /* Shouldn't happend since the only platform in this case is
x86_64-efi and it skips any regions > 4GiB because x86_64-efi and it skips any regions > 4GiB because
of EFI bugs anyway. */ of EFI bugs anyway. */
grub_error (GRUB_ERR_BUG, "allocation outside 32-bit range"); VasEBoot_error (VasEBoot_ERR_BUG, "allocation outside 32-bit range");
return 0; return 0;
} }
#endif #endif
if (!ret) if (!ret)
return 0; return 0;
grub_arch_sync_dma_caches (ret, size); VasEBoot_arch_sync_dma_caches (ret, size);
return ret; return ret;
} }
/* FIXME: evil. */ /* FIXME: evil. */
void void
grub_dma_free (struct grub_pci_dma_chunk *ch) VasEBoot_dma_free (struct VasEBoot_pci_dma_chunk *ch)
{ {
grub_size_t size = (((struct grub_mm_header *) ch) - 1)->size * GRUB_MM_ALIGN; VasEBoot_size_t size = (((struct VasEBoot_mm_header *) ch) - 1)->size * VasEBoot_MM_ALIGN;
grub_arch_sync_dma_caches (ch, size); VasEBoot_arch_sync_dma_caches (ch, size);
grub_free (ch); VasEBoot_free (ch);
} }
/* #endif */ /* #endif */
#ifdef GRUB_MACHINE_MIPS_LOONGSON #ifdef VasEBoot_MACHINE_MIPS_LOONGSON
volatile void * volatile void *
grub_dma_get_virt (struct grub_pci_dma_chunk *ch) VasEBoot_dma_get_virt (struct VasEBoot_pci_dma_chunk *ch)
{ {
return (void *) ((((grub_uint32_t) ch) & 0x1fffffff) | 0xa0000000); return (void *) ((((VasEBoot_uint32_t) ch) & 0x1fffffff) | 0xa0000000);
} }
grub_uint32_t VasEBoot_uint32_t
grub_dma_get_phys (struct grub_pci_dma_chunk *ch) VasEBoot_dma_get_phys (struct VasEBoot_pci_dma_chunk *ch)
{ {
return (((grub_uint32_t) ch) & 0x1fffffff) | 0x80000000; return (((VasEBoot_uint32_t) ch) & 0x1fffffff) | 0x80000000;
} }
#else #else
volatile void * volatile void *
grub_dma_get_virt (struct grub_pci_dma_chunk *ch) VasEBoot_dma_get_virt (struct VasEBoot_pci_dma_chunk *ch)
{ {
return (void *) ch; return (void *) ch;
} }
grub_uint32_t VasEBoot_uint32_t
grub_dma_get_phys (struct grub_pci_dma_chunk *ch) VasEBoot_dma_get_phys (struct VasEBoot_pci_dma_chunk *ch)
{ {
return (grub_uint32_t) (grub_addr_t) ch; return (VasEBoot_uint32_t) (VasEBoot_addr_t) ch;
} }
#endif #endif
grub_pci_address_t VasEBoot_pci_address_t
grub_pci_make_address (grub_pci_device_t dev, int reg) VasEBoot_pci_make_address (VasEBoot_pci_device_t dev, int reg)
{ {
return (1 << 31) | (dev.bus << 16) | (dev.device << 11) return (1 << 31) | (dev.bus << 16) | (dev.device << 11)
| (dev.function << 8) | reg; | (dev.function << 8) | reg;
} }
void void
grub_pci_iterate (grub_pci_iteratefunc_t hook, void *hook_data) VasEBoot_pci_iterate (VasEBoot_pci_iteratefunc_t hook, void *hook_data)
{ {
grub_pci_device_t dev; VasEBoot_pci_device_t dev;
grub_pci_address_t addr; VasEBoot_pci_address_t addr;
grub_pci_id_t id; VasEBoot_pci_id_t id;
grub_uint32_t hdr; VasEBoot_uint32_t hdr;
for (dev.bus = 0; dev.bus < GRUB_PCI_NUM_BUS; dev.bus++) for (dev.bus = 0; dev.bus < VasEBoot_PCI_NUM_BUS; dev.bus++)
{ {
for (dev.device = 0; dev.device < GRUB_PCI_NUM_DEVICES; dev.device++) for (dev.device = 0; dev.device < VasEBoot_PCI_NUM_DEVICES; dev.device++)
{ {
for (dev.function = 0; dev.function < 8; dev.function++) for (dev.function = 0; dev.function < 8; dev.function++)
{ {
addr = grub_pci_make_address (dev, GRUB_PCI_REG_PCI_ID); addr = VasEBoot_pci_make_address (dev, VasEBoot_PCI_REG_PCI_ID);
id = grub_pci_read (addr); id = VasEBoot_pci_read (addr);
/* Check if there is a device present. */ /* Check if there is a device present. */
if (id >> 16 == 0xFFFF) if (id >> 16 == 0xFFFF)
@ -131,8 +131,8 @@ grub_pci_iterate (grub_pci_iteratefunc_t hook, void *hook_data)
/* Probe only func = 0 if the device if not multifunction */ /* Probe only func = 0 if the device if not multifunction */
if (dev.function == 0) if (dev.function == 0)
{ {
addr = grub_pci_make_address (dev, GRUB_PCI_REG_CACHELINE); addr = VasEBoot_pci_make_address (dev, VasEBoot_PCI_REG_CACHELINE);
hdr = grub_pci_read (addr); hdr = VasEBoot_pci_read (addr);
if (!(hdr & 0x800000)) if (!(hdr & 0x800000))
break; break;
} }
@ -141,26 +141,26 @@ grub_pci_iterate (grub_pci_iteratefunc_t hook, void *hook_data)
} }
} }
grub_uint8_t VasEBoot_uint8_t
grub_pci_find_capability (grub_pci_device_t dev, grub_uint8_t cap) VasEBoot_pci_find_capability (VasEBoot_pci_device_t dev, VasEBoot_uint8_t cap)
{ {
grub_uint8_t pos = 0x34; VasEBoot_uint8_t pos = 0x34;
int ttl = 48; int ttl = 48;
while (ttl--) while (ttl--)
{ {
grub_uint8_t id; VasEBoot_uint8_t id;
grub_pci_address_t addr; VasEBoot_pci_address_t addr;
addr = grub_pci_make_address (dev, pos); addr = VasEBoot_pci_make_address (dev, pos);
pos = grub_pci_read_byte (addr); pos = VasEBoot_pci_read_byte (addr);
if (pos < 0x40) if (pos < 0x40)
break; break;
pos &= ~3; pos &= ~3;
addr = grub_pci_make_address (dev, pos); addr = VasEBoot_pci_make_address (dev, pos);
id = grub_pci_read_byte (addr); id = VasEBoot_pci_read_byte (addr);
if (id == 0xff) if (id == 0xff)
break; break;

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -1,69 +1,69 @@
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2000,2001,2002,2003,2004,2005,2007,2008,2009,2010 Free Software Foundation, Inc. * Copyright (C) 2000,2001,2002,2003,2004,2005,2007,2008,2009,2010 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/serial.h> #include <VasEBoot/serial.h>
#include <grub/usbserial.h> #include <VasEBoot/usbserial.h>
#include <grub/dl.h> #include <VasEBoot/dl.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
void void
grub_usbserial_fini (struct grub_serial_port *port) VasEBoot_usbserial_fini (struct VasEBoot_serial_port *port)
{ {
port->usbdev->config[port->configno].interf[port->interfno].detach_hook = 0; port->usbdev->config[port->configno].interf[port->interfno].detach_hook = 0;
port->usbdev->config[port->configno].interf[port->interfno].attached = 0; port->usbdev->config[port->configno].interf[port->interfno].attached = 0;
} }
void void
grub_usbserial_detach (grub_usb_device_t usbdev, int configno, int interfno) VasEBoot_usbserial_detach (VasEBoot_usb_device_t usbdev, int configno, int interfno)
{ {
static struct grub_serial_port *port; static struct VasEBoot_serial_port *port;
port = usbdev->config[configno].interf[interfno].detach_data; port = usbdev->config[configno].interf[interfno].detach_data;
grub_serial_unregister (port); VasEBoot_serial_unregister (port);
} }
static int usbnum = 0; static int usbnum = 0;
int int
grub_usbserial_attach (grub_usb_device_t usbdev, int configno, int interfno, VasEBoot_usbserial_attach (VasEBoot_usb_device_t usbdev, int configno, int interfno,
struct grub_serial_driver *driver, int in_endp, struct VasEBoot_serial_driver *driver, int in_endp,
int out_endp) int out_endp)
{ {
struct grub_serial_port *port; struct VasEBoot_serial_port *port;
int j; int j;
struct grub_usb_desc_if *interf; struct VasEBoot_usb_desc_if *interf;
grub_usb_err_t err = GRUB_USB_ERR_NONE; VasEBoot_usb_err_t err = VasEBoot_USB_ERR_NONE;
interf = usbdev->config[configno].interf[interfno].descif; interf = usbdev->config[configno].interf[interfno].descif;
port = grub_zalloc (sizeof (*port)); port = VasEBoot_zalloc (sizeof (*port));
if (!port) if (!port)
{ {
grub_print_error (); VasEBoot_print_error ();
return 0; return 0;
} }
port->name = grub_xasprintf ("usb%d", usbnum++); port->name = VasEBoot_xasprintf ("usb%d", usbnum++);
if (!port->name) if (!port->name)
{ {
grub_free (port); VasEBoot_free (port);
grub_print_error (); VasEBoot_print_error ();
return 0; return 0;
} }
@ -71,18 +71,18 @@ grub_usbserial_attach (grub_usb_device_t usbdev, int configno, int interfno,
port->driver = driver; port->driver = driver;
for (j = 0; j < interf->endpointcnt; j++) for (j = 0; j < interf->endpointcnt; j++)
{ {
struct grub_usb_desc_endp *endp; struct VasEBoot_usb_desc_endp *endp;
endp = &usbdev->config[0].interf[interfno].descendp[j]; endp = &usbdev->config[0].interf[interfno].descendp[j];
if ((endp->endp_addr & 128) && (endp->attrib & 3) == 2 if ((endp->endp_addr & 128) && (endp->attrib & 3) == 2
&& (in_endp == GRUB_USB_SERIAL_ENDPOINT_LAST_MATCHING && (in_endp == VasEBoot_USB_SERIAL_ENDPOINT_LAST_MATCHING
|| in_endp == endp->endp_addr)) || in_endp == endp->endp_addr))
{ {
/* Bulk IN endpoint. */ /* Bulk IN endpoint. */
port->in_endp = endp; port->in_endp = endp;
} }
else if (!(endp->endp_addr & 128) && (endp->attrib & 3) == 2 else if (!(endp->endp_addr & 128) && (endp->attrib & 3) == 2
&& (out_endp == GRUB_USB_SERIAL_ENDPOINT_LAST_MATCHING && (out_endp == VasEBoot_USB_SERIAL_ENDPOINT_LAST_MATCHING
|| out_endp == endp->endp_addr)) || out_endp == endp->endp_addr))
{ {
/* Bulk OUT endpoint. */ /* Bulk OUT endpoint. */
@ -92,23 +92,23 @@ grub_usbserial_attach (grub_usb_device_t usbdev, int configno, int interfno,
/* Configure device */ /* Configure device */
if (port->out_endp && port->in_endp) if (port->out_endp && port->in_endp)
err = grub_usb_set_configuration (usbdev, configno + 1); err = VasEBoot_usb_set_configuration (usbdev, configno + 1);
if (!port->out_endp || !port->in_endp || err) if (!port->out_endp || !port->in_endp || err)
{ {
grub_free (port->name); VasEBoot_free (port->name);
grub_free (port); VasEBoot_free (port);
return 0; return 0;
} }
port->configno = configno; port->configno = configno;
port->interfno = interfno; port->interfno = interfno;
grub_serial_config_defaults (port); VasEBoot_serial_config_defaults (port);
grub_serial_register (port); VasEBoot_serial_register (port);
port->usbdev->config[port->configno].interf[port->interfno].detach_hook port->usbdev->config[port->configno].interf[port->interfno].detach_hook
= grub_usbserial_detach; = VasEBoot_usbserial_detach;
port->usbdev->config[port->configno].interf[port->interfno].detach_data port->usbdev->config[port->configno].interf[port->interfno].detach_data
= port; = port;
@ -116,18 +116,18 @@ grub_usbserial_attach (grub_usb_device_t usbdev, int configno, int interfno,
} }
int int
grub_usbserial_fetch (struct grub_serial_port *port, grub_size_t header_size) VasEBoot_usbserial_fetch (struct VasEBoot_serial_port *port, VasEBoot_size_t header_size)
{ {
grub_usb_err_t err; VasEBoot_usb_err_t err;
grub_size_t actual; VasEBoot_size_t actual;
if (port->bufstart < port->bufend) if (port->bufstart < port->bufend)
return port->buf[port->bufstart++]; return port->buf[port->bufstart++];
err = grub_usb_bulk_read_extended (port->usbdev, port->in_endp, err = VasEBoot_usb_bulk_read_extended (port->usbdev, port->in_endp,
sizeof (port->buf), port->buf, 10, sizeof (port->buf), port->buf, 10,
&actual); &actual);
if (err != GRUB_USB_ERR_NONE) if (err != VasEBoot_USB_ERR_NONE)
return -1; return -1;
port->bufstart = header_size; port->bufstart = header_size;

View File

@ -1,45 +1,45 @@
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2000,2001,2002,2003,2004,2005,2007,2008,2009,2010 Free Software Foundation, Inc. * Copyright (C) 2000,2001,2002,2003,2004,2005,2007,2008,2009,2010 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/serial.h> #include <VasEBoot/serial.h>
#include <grub/types.h> #include <VasEBoot/types.h>
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/mm.h> #include <VasEBoot/mm.h>
#include <grub/usb.h> #include <VasEBoot/usb.h>
#include <grub/usbserial.h> #include <VasEBoot/usbserial.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
enum enum
{ {
GRUB_FTDI_MODEM_CTRL = 0x01, VasEBoot_FTDI_MODEM_CTRL = 0x01,
GRUB_FTDI_FLOW_CTRL = 0x02, VasEBoot_FTDI_FLOW_CTRL = 0x02,
GRUB_FTDI_SPEED_CTRL = 0x03, VasEBoot_FTDI_SPEED_CTRL = 0x03,
GRUB_FTDI_DATA_CTRL = 0x04 VasEBoot_FTDI_DATA_CTRL = 0x04
}; };
#define GRUB_FTDI_MODEM_CTRL_DTRRTS 3 #define VasEBoot_FTDI_MODEM_CTRL_DTRRTS 3
#define GRUB_FTDI_FLOW_CTRL_DTRRTS 3 #define VasEBoot_FTDI_FLOW_CTRL_DTRRTS 3
/* Convert speed to divisor. */ /* Convert speed to divisor. */
static grub_uint32_t static VasEBoot_uint32_t
get_divisor (unsigned int speed) get_divisor (unsigned int speed)
{ {
unsigned int i; unsigned int i;
@ -48,7 +48,7 @@ get_divisor (unsigned int speed)
struct divisor struct divisor
{ {
unsigned int speed; unsigned int speed;
grub_uint32_t div; VasEBoot_uint32_t div;
}; };
/* The table which lists common configurations. */ /* The table which lists common configurations. */
@ -72,40 +72,40 @@ get_divisor (unsigned int speed)
} }
static void static void
real_config (struct grub_serial_port *port) real_config (struct VasEBoot_serial_port *port)
{ {
grub_uint32_t divisor; VasEBoot_uint32_t divisor;
const grub_uint16_t parities[] = { const VasEBoot_uint16_t parities[] = {
[GRUB_SERIAL_PARITY_NONE] = 0x0000, [VasEBoot_SERIAL_PARITY_NONE] = 0x0000,
[GRUB_SERIAL_PARITY_ODD] = 0x0100, [VasEBoot_SERIAL_PARITY_ODD] = 0x0100,
[GRUB_SERIAL_PARITY_EVEN] = 0x0200 [VasEBoot_SERIAL_PARITY_EVEN] = 0x0200
}; };
const grub_uint16_t stop_bits[] = { const VasEBoot_uint16_t stop_bits[] = {
[GRUB_SERIAL_STOP_BITS_1] = 0x0000, [VasEBoot_SERIAL_STOP_BITS_1] = 0x0000,
[GRUB_SERIAL_STOP_BITS_1_5] = 0x0800, [VasEBoot_SERIAL_STOP_BITS_1_5] = 0x0800,
[GRUB_SERIAL_STOP_BITS_2] = 0x1000, [VasEBoot_SERIAL_STOP_BITS_2] = 0x1000,
}; };
if (port->configured) if (port->configured)
return; return;
grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, VasEBoot_usb_control_msg (port->usbdev, VasEBoot_USB_REQTYPE_VENDOR_OUT,
GRUB_FTDI_MODEM_CTRL, VasEBoot_FTDI_MODEM_CTRL,
port->config.rtscts ? GRUB_FTDI_MODEM_CTRL_DTRRTS : 0, port->config.rtscts ? VasEBoot_FTDI_MODEM_CTRL_DTRRTS : 0,
0, 0, 0); 0, 0, 0);
grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, VasEBoot_usb_control_msg (port->usbdev, VasEBoot_USB_REQTYPE_VENDOR_OUT,
GRUB_FTDI_FLOW_CTRL, VasEBoot_FTDI_FLOW_CTRL,
port->config.rtscts ? GRUB_FTDI_FLOW_CTRL_DTRRTS : 0, port->config.rtscts ? VasEBoot_FTDI_FLOW_CTRL_DTRRTS : 0,
0, 0, 0); 0, 0, 0);
divisor = get_divisor (port->config.speed); divisor = get_divisor (port->config.speed);
grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, VasEBoot_usb_control_msg (port->usbdev, VasEBoot_USB_REQTYPE_VENDOR_OUT,
GRUB_FTDI_SPEED_CTRL, VasEBoot_FTDI_SPEED_CTRL,
divisor & 0xffff, divisor >> 16, 0, 0); divisor & 0xffff, divisor >> 16, 0, 0);
grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, VasEBoot_usb_control_msg (port->usbdev, VasEBoot_USB_REQTYPE_VENDOR_OUT,
GRUB_FTDI_DATA_CTRL, VasEBoot_FTDI_DATA_CTRL,
parities[port->config.parity] parities[port->config.parity]
| stop_bits[port->config.stop_bits] | stop_bits[port->config.stop_bits]
| port->config.word_len, 0, 0, 0); | port->config.word_len, 0, 0, 0);
@ -115,75 +115,75 @@ real_config (struct grub_serial_port *port)
/* Fetch a key. */ /* Fetch a key. */
static int static int
ftdi_hw_fetch (struct grub_serial_port *port) ftdi_hw_fetch (struct VasEBoot_serial_port *port)
{ {
real_config (port); real_config (port);
return grub_usbserial_fetch (port, 2); return VasEBoot_usbserial_fetch (port, 2);
} }
/* Put a character. */ /* Put a character. */
static void static void
ftdi_hw_put (struct grub_serial_port *port, const int c) ftdi_hw_put (struct VasEBoot_serial_port *port, const int c)
{ {
char cc = c; char cc = c;
real_config (port); real_config (port);
grub_usb_bulk_write (port->usbdev, port->out_endp, 1, &cc); VasEBoot_usb_bulk_write (port->usbdev, port->out_endp, 1, &cc);
} }
static grub_err_t static VasEBoot_err_t
ftdi_hw_configure (struct grub_serial_port *port, ftdi_hw_configure (struct VasEBoot_serial_port *port,
struct grub_serial_config *config) struct VasEBoot_serial_config *config)
{ {
grub_uint16_t divisor; VasEBoot_uint16_t divisor;
divisor = get_divisor (config->speed); divisor = get_divisor (config->speed);
if (divisor == 0) if (divisor == 0)
return grub_error (GRUB_ERR_BAD_ARGUMENT, return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT,
N_("unsupported serial port speed")); N_("unsupported serial port speed"));
if (config->parity != GRUB_SERIAL_PARITY_NONE if (config->parity != VasEBoot_SERIAL_PARITY_NONE
&& config->parity != GRUB_SERIAL_PARITY_ODD && config->parity != VasEBoot_SERIAL_PARITY_ODD
&& config->parity != GRUB_SERIAL_PARITY_EVEN) && config->parity != VasEBoot_SERIAL_PARITY_EVEN)
return grub_error (GRUB_ERR_BAD_ARGUMENT, return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT,
N_("unsupported serial port parity")); N_("unsupported serial port parity"));
if (config->stop_bits != GRUB_SERIAL_STOP_BITS_1 if (config->stop_bits != VasEBoot_SERIAL_STOP_BITS_1
&& config->stop_bits != GRUB_SERIAL_STOP_BITS_1_5 && config->stop_bits != VasEBoot_SERIAL_STOP_BITS_1_5
&& config->stop_bits != GRUB_SERIAL_STOP_BITS_2) && config->stop_bits != VasEBoot_SERIAL_STOP_BITS_2)
return grub_error (GRUB_ERR_BAD_ARGUMENT, return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT,
N_("unsupported serial port stop bits number")); N_("unsupported serial port stop bits number"));
if (config->word_len < 5 || config->word_len > 8) if (config->word_len < 5 || config->word_len > 8)
return grub_error (GRUB_ERR_BAD_ARGUMENT, return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT,
N_("unsupported serial port word length")); N_("unsupported serial port word length"));
port->config = *config; port->config = *config;
port->configured = 0; port->configured = 0;
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
} }
static struct grub_serial_driver grub_ftdi_driver = static struct VasEBoot_serial_driver VasEBoot_ftdi_driver =
{ {
.configure = ftdi_hw_configure, .configure = ftdi_hw_configure,
.fetch = ftdi_hw_fetch, .fetch = ftdi_hw_fetch,
.put = ftdi_hw_put, .put = ftdi_hw_put,
.fini = grub_usbserial_fini .fini = VasEBoot_usbserial_fini
}; };
static const struct static const struct
{ {
grub_uint16_t vendor, product; VasEBoot_uint16_t vendor, product;
} products[] = } products[] =
{ {
{0x0403, 0x6001} /* QEMU virtual USBserial. */ {0x0403, 0x6001} /* QEMU virtual USBserial. */
}; };
static int static int
grub_ftdi_attach (grub_usb_device_t usbdev, int configno, int interfno) VasEBoot_ftdi_attach (VasEBoot_usb_device_t usbdev, int configno, int interfno)
{ {
unsigned j; unsigned j;
@ -194,25 +194,25 @@ grub_ftdi_attach (grub_usb_device_t usbdev, int configno, int interfno)
if (j == ARRAY_SIZE (products)) if (j == ARRAY_SIZE (products))
return 0; return 0;
return grub_usbserial_attach (usbdev, configno, interfno, return VasEBoot_usbserial_attach (usbdev, configno, interfno,
&grub_ftdi_driver, &VasEBoot_ftdi_driver,
GRUB_USB_SERIAL_ENDPOINT_LAST_MATCHING, VasEBoot_USB_SERIAL_ENDPOINT_LAST_MATCHING,
GRUB_USB_SERIAL_ENDPOINT_LAST_MATCHING); VasEBoot_USB_SERIAL_ENDPOINT_LAST_MATCHING);
} }
static struct grub_usb_attach_desc attach_hook = static struct VasEBoot_usb_attach_desc attach_hook =
{ {
.class = 0xff, .class = 0xff,
.hook = grub_ftdi_attach .hook = VasEBoot_ftdi_attach
}; };
GRUB_MOD_INIT(usbserial_ftdi) VasEBoot_MOD_INIT(usbserial_ftdi)
{ {
grub_usb_register_attach_hook_class (&attach_hook); VasEBoot_usb_register_attach_hook_class (&attach_hook);
} }
GRUB_MOD_FINI(usbserial_ftdi) VasEBoot_MOD_FINI(usbserial_ftdi)
{ {
grub_serial_unregister_driver (&grub_ftdi_driver); VasEBoot_serial_unregister_driver (&VasEBoot_ftdi_driver);
grub_usb_unregister_attach_hook_class (&attach_hook); VasEBoot_usb_unregister_attach_hook_class (&attach_hook);
} }

View File

@ -1,34 +1,34 @@
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2000,2001,2002,2003,2004,2005,2007,2008,2009,2010 Free Software Foundation, Inc. * Copyright (C) 2000,2001,2002,2003,2004,2005,2007,2008,2009,2010 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/serial.h> #include <VasEBoot/serial.h>
#include <grub/types.h> #include <VasEBoot/types.h>
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/mm.h> #include <VasEBoot/mm.h>
#include <grub/usb.h> #include <VasEBoot/usb.h>
#include <grub/usbserial.h> #include <VasEBoot/usbserial.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
/* Convert speed to divisor. */ /* Convert speed to divisor. */
static grub_uint32_t static VasEBoot_uint32_t
is_speed_supported (unsigned int speed) is_speed_supported (unsigned int speed)
{ {
unsigned int i; unsigned int i;
@ -40,163 +40,163 @@ is_speed_supported (unsigned int speed)
return 0; return 0;
} }
#define GRUB_PL2303_REQUEST_SET_CONFIG 0x20 #define VasEBoot_PL2303_REQUEST_SET_CONFIG 0x20
#define GRUB_PL2303_STOP_BITS_1 0x0 #define VasEBoot_PL2303_STOP_BITS_1 0x0
#define GRUB_PL2303_STOP_BITS_1_5 0x1 #define VasEBoot_PL2303_STOP_BITS_1_5 0x1
#define GRUB_PL2303_STOP_BITS_2 0x2 #define VasEBoot_PL2303_STOP_BITS_2 0x2
#define GRUB_PL2303_PARITY_NONE 0 #define VasEBoot_PL2303_PARITY_NONE 0
#define GRUB_PL2303_PARITY_ODD 1 #define VasEBoot_PL2303_PARITY_ODD 1
#define GRUB_PL2303_PARITY_EVEN 2 #define VasEBoot_PL2303_PARITY_EVEN 2
struct grub_pl2303_config struct VasEBoot_pl2303_config
{ {
grub_uint32_t speed; VasEBoot_uint32_t speed;
grub_uint8_t stop_bits; VasEBoot_uint8_t stop_bits;
grub_uint8_t parity; VasEBoot_uint8_t parity;
grub_uint8_t word_len; VasEBoot_uint8_t word_len;
} GRUB_PACKED; } VasEBoot_PACKED;
static void static void
real_config (struct grub_serial_port *port) real_config (struct VasEBoot_serial_port *port)
{ {
struct grub_pl2303_config config_pl2303; struct VasEBoot_pl2303_config config_pl2303;
char xx; char xx;
if (port->configured) if (port->configured)
return; return;
grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_IN, VasEBoot_usb_control_msg (port->usbdev, VasEBoot_USB_REQTYPE_VENDOR_IN,
1, 0x8484, 0, 1, &xx); 1, 0x8484, 0, 1, &xx);
grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, VasEBoot_usb_control_msg (port->usbdev, VasEBoot_USB_REQTYPE_VENDOR_OUT,
1, 0x0404, 0, 0, 0); 1, 0x0404, 0, 0, 0);
grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_IN, VasEBoot_usb_control_msg (port->usbdev, VasEBoot_USB_REQTYPE_VENDOR_IN,
1, 0x8484, 0, 1, &xx); 1, 0x8484, 0, 1, &xx);
grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_IN, VasEBoot_usb_control_msg (port->usbdev, VasEBoot_USB_REQTYPE_VENDOR_IN,
1, 0x8383, 0, 1, &xx); 1, 0x8383, 0, 1, &xx);
grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_IN, VasEBoot_usb_control_msg (port->usbdev, VasEBoot_USB_REQTYPE_VENDOR_IN,
1, 0x8484, 0, 1, &xx); 1, 0x8484, 0, 1, &xx);
grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, VasEBoot_usb_control_msg (port->usbdev, VasEBoot_USB_REQTYPE_VENDOR_OUT,
1, 0x0404, 1, 0, 0); 1, 0x0404, 1, 0, 0);
grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_IN, VasEBoot_usb_control_msg (port->usbdev, VasEBoot_USB_REQTYPE_VENDOR_IN,
1, 0x8484, 0, 1, &xx); 1, 0x8484, 0, 1, &xx);
grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_IN, VasEBoot_usb_control_msg (port->usbdev, VasEBoot_USB_REQTYPE_VENDOR_IN,
1, 0x8383, 0, 1, &xx); 1, 0x8383, 0, 1, &xx);
grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, VasEBoot_usb_control_msg (port->usbdev, VasEBoot_USB_REQTYPE_VENDOR_OUT,
1, 0, 1, 0, 0); 1, 0, 1, 0, 0);
grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, VasEBoot_usb_control_msg (port->usbdev, VasEBoot_USB_REQTYPE_VENDOR_OUT,
1, 1, 0, 0, 0); 1, 1, 0, 0, 0);
grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, VasEBoot_usb_control_msg (port->usbdev, VasEBoot_USB_REQTYPE_VENDOR_OUT,
1, 2, 0x44, 0, 0); 1, 2, 0x44, 0, 0);
grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, VasEBoot_usb_control_msg (port->usbdev, VasEBoot_USB_REQTYPE_VENDOR_OUT,
1, 8, 0, 0, 0); 1, 8, 0, 0, 0);
grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, VasEBoot_usb_control_msg (port->usbdev, VasEBoot_USB_REQTYPE_VENDOR_OUT,
1, 9, 0, 0, 0); 1, 9, 0, 0, 0);
if (port->config.stop_bits == GRUB_SERIAL_STOP_BITS_2) if (port->config.stop_bits == VasEBoot_SERIAL_STOP_BITS_2)
config_pl2303.stop_bits = GRUB_PL2303_STOP_BITS_2; config_pl2303.stop_bits = VasEBoot_PL2303_STOP_BITS_2;
else if (port->config.stop_bits == GRUB_SERIAL_STOP_BITS_1_5) else if (port->config.stop_bits == VasEBoot_SERIAL_STOP_BITS_1_5)
config_pl2303.stop_bits = GRUB_PL2303_STOP_BITS_1_5; config_pl2303.stop_bits = VasEBoot_PL2303_STOP_BITS_1_5;
else else
config_pl2303.stop_bits = GRUB_PL2303_STOP_BITS_1; config_pl2303.stop_bits = VasEBoot_PL2303_STOP_BITS_1;
switch (port->config.parity) switch (port->config.parity)
{ {
case GRUB_SERIAL_PARITY_NONE: case VasEBoot_SERIAL_PARITY_NONE:
config_pl2303.parity = GRUB_PL2303_PARITY_NONE; config_pl2303.parity = VasEBoot_PL2303_PARITY_NONE;
break; break;
case GRUB_SERIAL_PARITY_ODD: case VasEBoot_SERIAL_PARITY_ODD:
config_pl2303.parity = GRUB_PL2303_PARITY_ODD; config_pl2303.parity = VasEBoot_PL2303_PARITY_ODD;
break; break;
case GRUB_SERIAL_PARITY_EVEN: case VasEBoot_SERIAL_PARITY_EVEN:
config_pl2303.parity = GRUB_PL2303_PARITY_EVEN; config_pl2303.parity = VasEBoot_PL2303_PARITY_EVEN;
break; break;
} }
config_pl2303.word_len = port->config.word_len; config_pl2303.word_len = port->config.word_len;
config_pl2303.speed = port->config.speed; config_pl2303.speed = port->config.speed;
grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_CLASS_INTERFACE_OUT, VasEBoot_usb_control_msg (port->usbdev, VasEBoot_USB_REQTYPE_CLASS_INTERFACE_OUT,
GRUB_PL2303_REQUEST_SET_CONFIG, 0, 0, VasEBoot_PL2303_REQUEST_SET_CONFIG, 0, 0,
sizeof (config_pl2303), (char *) &config_pl2303); sizeof (config_pl2303), (char *) &config_pl2303);
grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_CLASS_INTERFACE_OUT, VasEBoot_usb_control_msg (port->usbdev, VasEBoot_USB_REQTYPE_CLASS_INTERFACE_OUT,
0x22, 3, 0, 0, 0); 0x22, 3, 0, 0, 0);
grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT, VasEBoot_usb_control_msg (port->usbdev, VasEBoot_USB_REQTYPE_VENDOR_OUT,
1, 0, port->config.rtscts ? 0x61 : 0, 0, 0); 1, 0, port->config.rtscts ? 0x61 : 0, 0, 0);
port->configured = 1; port->configured = 1;
} }
/* Fetch a key. */ /* Fetch a key. */
static int static int
pl2303_hw_fetch (struct grub_serial_port *port) pl2303_hw_fetch (struct VasEBoot_serial_port *port)
{ {
real_config (port); real_config (port);
return grub_usbserial_fetch (port, 0); return VasEBoot_usbserial_fetch (port, 0);
} }
/* Put a character. */ /* Put a character. */
static void static void
pl2303_hw_put (struct grub_serial_port *port, const int c) pl2303_hw_put (struct VasEBoot_serial_port *port, const int c)
{ {
char cc = c; char cc = c;
real_config (port); real_config (port);
grub_usb_bulk_write (port->usbdev, port->out_endp, 1, &cc); VasEBoot_usb_bulk_write (port->usbdev, port->out_endp, 1, &cc);
} }
static grub_err_t static VasEBoot_err_t
pl2303_hw_configure (struct grub_serial_port *port, pl2303_hw_configure (struct VasEBoot_serial_port *port,
struct grub_serial_config *config) struct VasEBoot_serial_config *config)
{ {
if (!is_speed_supported (config->speed)) if (!is_speed_supported (config->speed))
return grub_error (GRUB_ERR_BAD_ARGUMENT, return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT,
N_("unsupported serial port speed")); N_("unsupported serial port speed"));
if (config->parity != GRUB_SERIAL_PARITY_NONE if (config->parity != VasEBoot_SERIAL_PARITY_NONE
&& config->parity != GRUB_SERIAL_PARITY_ODD && config->parity != VasEBoot_SERIAL_PARITY_ODD
&& config->parity != GRUB_SERIAL_PARITY_EVEN) && config->parity != VasEBoot_SERIAL_PARITY_EVEN)
return grub_error (GRUB_ERR_BAD_ARGUMENT, return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT,
N_("unsupported serial port parity")); N_("unsupported serial port parity"));
if (config->stop_bits != GRUB_SERIAL_STOP_BITS_1 if (config->stop_bits != VasEBoot_SERIAL_STOP_BITS_1
&& config->stop_bits != GRUB_SERIAL_STOP_BITS_1_5 && config->stop_bits != VasEBoot_SERIAL_STOP_BITS_1_5
&& config->stop_bits != GRUB_SERIAL_STOP_BITS_2) && config->stop_bits != VasEBoot_SERIAL_STOP_BITS_2)
return grub_error (GRUB_ERR_BAD_ARGUMENT, return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT,
N_("unsupported serial port stop bits number")); N_("unsupported serial port stop bits number"));
if (config->word_len < 5 || config->word_len > 8) if (config->word_len < 5 || config->word_len > 8)
return grub_error (GRUB_ERR_BAD_ARGUMENT, return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT,
N_("unsupported serial port word length")); N_("unsupported serial port word length"));
port->config = *config; port->config = *config;
port->configured = 0; port->configured = 0;
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
} }
static struct grub_serial_driver grub_pl2303_driver = static struct VasEBoot_serial_driver VasEBoot_pl2303_driver =
{ {
.configure = pl2303_hw_configure, .configure = pl2303_hw_configure,
.fetch = pl2303_hw_fetch, .fetch = pl2303_hw_fetch,
.put = pl2303_hw_put, .put = pl2303_hw_put,
.fini = grub_usbserial_fini .fini = VasEBoot_usbserial_fini
}; };
static const struct static const struct
{ {
grub_uint16_t vendor, product; VasEBoot_uint16_t vendor, product;
} products[] = } products[] =
{ {
{0x067b, 0x2303} {0x067b, 0x2303}
}; };
static int static int
grub_pl2303_attach (grub_usb_device_t usbdev, int configno, int interfno) VasEBoot_pl2303_attach (VasEBoot_usb_device_t usbdev, int configno, int interfno)
{ {
unsigned j; unsigned j;
@ -207,25 +207,25 @@ grub_pl2303_attach (grub_usb_device_t usbdev, int configno, int interfno)
if (j == ARRAY_SIZE (products)) if (j == ARRAY_SIZE (products))
return 0; return 0;
return grub_usbserial_attach (usbdev, configno, interfno, return VasEBoot_usbserial_attach (usbdev, configno, interfno,
&grub_pl2303_driver, &VasEBoot_pl2303_driver,
GRUB_USB_SERIAL_ENDPOINT_LAST_MATCHING, VasEBoot_USB_SERIAL_ENDPOINT_LAST_MATCHING,
GRUB_USB_SERIAL_ENDPOINT_LAST_MATCHING); VasEBoot_USB_SERIAL_ENDPOINT_LAST_MATCHING);
} }
static struct grub_usb_attach_desc attach_hook = static struct VasEBoot_usb_attach_desc attach_hook =
{ {
.class = 0xff, .class = 0xff,
.hook = grub_pl2303_attach .hook = VasEBoot_pl2303_attach
}; };
GRUB_MOD_INIT(usbserial_pl2303) VasEBoot_MOD_INIT(usbserial_pl2303)
{ {
grub_usb_register_attach_hook_class (&attach_hook); VasEBoot_usb_register_attach_hook_class (&attach_hook);
} }
GRUB_MOD_FINI(usbserial_pl2303) VasEBoot_MOD_FINI(usbserial_pl2303)
{ {
grub_serial_unregister_driver (&grub_pl2303_driver); VasEBoot_serial_unregister_driver (&VasEBoot_pl2303_driver);
grub_usb_unregister_attach_hook_class (&attach_hook); VasEBoot_usb_unregister_attach_hook_class (&attach_hook);
} }

View File

@ -1,93 +1,93 @@
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2000,2001,2002,2003,2004,2005,2007,2008,2009,2010,2013 Free Software Foundation, Inc. * Copyright (C) 2000,2001,2002,2003,2004,2005,2007,2008,2009,2010,2013 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/serial.h> #include <VasEBoot/serial.h>
#include <grub/types.h> #include <VasEBoot/types.h>
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/mm.h> #include <VasEBoot/mm.h>
#include <grub/usb.h> #include <VasEBoot/usb.h>
#include <grub/usbserial.h> #include <VasEBoot/usbserial.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
/* Fetch a key. */ /* Fetch a key. */
static int static int
usbdebug_late_hw_fetch (struct grub_serial_port *port) usbdebug_late_hw_fetch (struct VasEBoot_serial_port *port)
{ {
return grub_usbserial_fetch (port, 0); return VasEBoot_usbserial_fetch (port, 0);
} }
/* Put a character. */ /* Put a character. */
static void static void
usbdebug_late_hw_put (struct grub_serial_port *port, const int c) usbdebug_late_hw_put (struct VasEBoot_serial_port *port, const int c)
{ {
char cc = c; char cc = c;
grub_usb_bulk_write (port->usbdev, port->out_endp, 1, &cc); VasEBoot_usb_bulk_write (port->usbdev, port->out_endp, 1, &cc);
} }
static grub_err_t static VasEBoot_err_t
usbdebug_late_hw_configure (struct grub_serial_port *port __attribute__ ((unused)), usbdebug_late_hw_configure (struct VasEBoot_serial_port *port __attribute__ ((unused)),
struct grub_serial_config *config __attribute__ ((unused))) struct VasEBoot_serial_config *config __attribute__ ((unused)))
{ {
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
} }
static struct grub_serial_driver grub_usbdebug_late_driver = static struct VasEBoot_serial_driver VasEBoot_usbdebug_late_driver =
{ {
.configure = usbdebug_late_hw_configure, .configure = usbdebug_late_hw_configure,
.fetch = usbdebug_late_hw_fetch, .fetch = usbdebug_late_hw_fetch,
.put = usbdebug_late_hw_put, .put = usbdebug_late_hw_put,
.fini = grub_usbserial_fini .fini = VasEBoot_usbserial_fini
}; };
static int static int
grub_usbdebug_late_attach (grub_usb_device_t usbdev, int configno, int interfno) VasEBoot_usbdebug_late_attach (VasEBoot_usb_device_t usbdev, int configno, int interfno)
{ {
grub_usb_err_t err; VasEBoot_usb_err_t err;
struct grub_usb_desc_debug debugdesc; struct VasEBoot_usb_desc_debug debugdesc;
err = grub_usb_get_descriptor (usbdev, GRUB_USB_DESCRIPTOR_DEBUG, configno, err = VasEBoot_usb_get_descriptor (usbdev, VasEBoot_USB_DESCRIPTOR_DEBUG, configno,
sizeof (debugdesc), (char *) &debugdesc); sizeof (debugdesc), (char *) &debugdesc);
if (err) if (err)
return 0; return 0;
return grub_usbserial_attach (usbdev, configno, interfno, return VasEBoot_usbserial_attach (usbdev, configno, interfno,
&grub_usbdebug_late_driver, &VasEBoot_usbdebug_late_driver,
debugdesc.in_endp, debugdesc.out_endp); debugdesc.in_endp, debugdesc.out_endp);
} }
static struct grub_usb_attach_desc attach_hook = static struct VasEBoot_usb_attach_desc attach_hook =
{ {
.class = 0xff, .class = 0xff,
.hook = grub_usbdebug_late_attach .hook = VasEBoot_usbdebug_late_attach
}; };
GRUB_MOD_INIT(usbserial_usbdebug_late) VasEBoot_MOD_INIT(usbserial_usbdebug_late)
{ {
grub_usb_register_attach_hook_class (&attach_hook); VasEBoot_usb_register_attach_hook_class (&attach_hook);
} }
GRUB_MOD_FINI(usbserial_usbdebug_late) VasEBoot_MOD_FINI(usbserial_usbdebug_late)
{ {
grub_serial_unregister_driver (&grub_usbdebug_late_driver); VasEBoot_serial_unregister_driver (&VasEBoot_usbdebug_late_driver);
grub_usb_unregister_attach_hook_class (&attach_hook); VasEBoot_usb_unregister_attach_hook_class (&attach_hook);
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,47 +1,47 @@
/* usb.c - Generic USB interfaces. */ /* usb.c - Generic USB interfaces. */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2008 Free Software Foundation, Inc. * Copyright (C) 2008 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/mm.h> #include <VasEBoot/mm.h>
#include <grub/usb.h> #include <VasEBoot/usb.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/list.h> #include <VasEBoot/list.h>
#include <grub/term.h> #include <VasEBoot/term.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static struct grub_usb_attach_desc *attach_hooks; static struct VasEBoot_usb_attach_desc *attach_hooks;
#if 0 #if 0
/* Context for grub_usb_controller_iterate. */ /* Context for VasEBoot_usb_controller_iterate. */
struct grub_usb_controller_iterate_ctx struct VasEBoot_usb_controller_iterate_ctx
{ {
grub_usb_controller_iterate_hook_t hook; VasEBoot_usb_controller_iterate_hook_t hook;
void *hook_data; void *hook_data;
grub_usb_controller_dev_t p; VasEBoot_usb_controller_dev_t p;
}; };
/* Helper for grub_usb_controller_iterate. */ /* Helper for VasEBoot_usb_controller_iterate. */
static int static int
grub_usb_controller_iterate_iter (grub_usb_controller_t dev, void *data) VasEBoot_usb_controller_iterate_iter (VasEBoot_usb_controller_t dev, void *data)
{ {
struct grub_usb_controller_iterate_ctx *ctx = data; struct VasEBoot_usb_controller_iterate_ctx *ctx = data;
dev->dev = ctx->p; dev->dev = ctx->p;
if (ctx->hook (dev, ctx->hook_data)) if (ctx->hook (dev, ctx->hook_data))
@ -50,20 +50,20 @@ grub_usb_controller_iterate_iter (grub_usb_controller_t dev, void *data)
} }
int int
grub_usb_controller_iterate (grub_usb_controller_iterate_hook_t hook, VasEBoot_usb_controller_iterate (VasEBoot_usb_controller_iterate_hook_t hook,
void *hook_data) void *hook_data)
{ {
struct grub_usb_controller_iterate_ctx ctx = { struct VasEBoot_usb_controller_iterate_ctx ctx = {
.hook = hook, .hook = hook,
.hook_data = hook_data .hook_data = hook_data
}; };
/* Iterate over all controller drivers. */ /* Iterate over all controller drivers. */
for (ctx.p = grub_usb_list; ctx.p; ctx.p = ctx.p->next) for (ctx.p = VasEBoot_usb_list; ctx.p; ctx.p = ctx.p->next)
{ {
/* Iterate over the busses of the controllers. XXX: Actually, a /* Iterate over the busses of the controllers. XXX: Actually, a
hub driver should do this. */ hub driver should do this. */
if (ctx.p->iterate (grub_usb_controller_iterate_iter, &ctx)) if (ctx.p->iterate (VasEBoot_usb_controller_iterate_iter, &ctx))
return 1; return 1;
} }
@ -72,63 +72,63 @@ grub_usb_controller_iterate (grub_usb_controller_iterate_hook_t hook,
#endif #endif
grub_usb_err_t VasEBoot_usb_err_t
grub_usb_clear_halt (grub_usb_device_t dev, int endpoint) VasEBoot_usb_clear_halt (VasEBoot_usb_device_t dev, int endpoint)
{ {
dev->toggle[endpoint] = 0; dev->toggle[endpoint] = 0;
return grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_OUT return VasEBoot_usb_control_msg (dev, (VasEBoot_USB_REQTYPE_OUT
| GRUB_USB_REQTYPE_STANDARD | VasEBoot_USB_REQTYPE_STANDARD
| GRUB_USB_REQTYPE_TARGET_ENDP), | VasEBoot_USB_REQTYPE_TARGET_ENDP),
GRUB_USB_REQ_CLEAR_FEATURE, VasEBoot_USB_REQ_CLEAR_FEATURE,
GRUB_USB_FEATURE_ENDP_HALT, VasEBoot_USB_FEATURE_ENDP_HALT,
endpoint, 0, 0); endpoint, 0, 0);
} }
grub_usb_err_t VasEBoot_usb_err_t
grub_usb_set_configuration (grub_usb_device_t dev, int configuration) VasEBoot_usb_set_configuration (VasEBoot_usb_device_t dev, int configuration)
{ {
grub_memset (dev->toggle, 0, sizeof (dev->toggle)); VasEBoot_memset (dev->toggle, 0, sizeof (dev->toggle));
return grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_OUT return VasEBoot_usb_control_msg (dev, (VasEBoot_USB_REQTYPE_OUT
| GRUB_USB_REQTYPE_STANDARD | VasEBoot_USB_REQTYPE_STANDARD
| GRUB_USB_REQTYPE_TARGET_DEV), | VasEBoot_USB_REQTYPE_TARGET_DEV),
GRUB_USB_REQ_SET_CONFIGURATION, configuration, VasEBoot_USB_REQ_SET_CONFIGURATION, configuration,
0, 0, NULL); 0, 0, NULL);
} }
grub_usb_err_t VasEBoot_usb_err_t
grub_usb_get_descriptor (grub_usb_device_t dev, VasEBoot_usb_get_descriptor (VasEBoot_usb_device_t dev,
grub_uint8_t type, grub_uint8_t index, VasEBoot_uint8_t type, VasEBoot_uint8_t index,
grub_size_t size, char *data) VasEBoot_size_t size, char *data)
{ {
return grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_IN return VasEBoot_usb_control_msg (dev, (VasEBoot_USB_REQTYPE_IN
| GRUB_USB_REQTYPE_STANDARD | VasEBoot_USB_REQTYPE_STANDARD
| GRUB_USB_REQTYPE_TARGET_DEV), | VasEBoot_USB_REQTYPE_TARGET_DEV),
GRUB_USB_REQ_GET_DESCRIPTOR, VasEBoot_USB_REQ_GET_DESCRIPTOR,
(type << 8) | index, (type << 8) | index,
0, size, data); 0, size, data);
} }
grub_usb_err_t VasEBoot_usb_err_t
grub_usb_device_initialize (grub_usb_device_t dev) VasEBoot_usb_device_initialize (VasEBoot_usb_device_t dev)
{ {
struct grub_usb_desc_device *descdev; struct VasEBoot_usb_desc_device *descdev;
struct grub_usb_desc_config config; struct VasEBoot_usb_desc_config config;
grub_usb_err_t err; VasEBoot_usb_err_t err;
int i; int i;
/* First we have to read first 8 bytes only and determine /* First we have to read first 8 bytes only and determine
* max. size of packet */ * max. size of packet */
dev->descdev.maxsize0 = 0; /* invalidating, for safety only, can be removed if it is sure it is zero here */ 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, err = VasEBoot_usb_get_descriptor (dev, VasEBoot_USB_DESCRIPTOR_DEVICE,
0, 8, (char *) &dev->descdev); 0, 8, (char *) &dev->descdev);
if (err) if (err)
return err; return err;
/* Now we have valid value in dev->descdev.maxsize0, /* Now we have valid value in dev->descdev.maxsize0,
* so we can read whole device descriptor */ * so we can read whole device descriptor */
err = grub_usb_get_descriptor (dev, GRUB_USB_DESCRIPTOR_DEVICE, err = VasEBoot_usb_get_descriptor (dev, VasEBoot_USB_DESCRIPTOR_DEVICE,
0, sizeof (struct grub_usb_desc_device), 0, sizeof (struct VasEBoot_usb_desc_device),
(char *) &dev->descdev); (char *) &dev->descdev);
if (err) if (err)
return err; return err;
@ -139,7 +139,7 @@ grub_usb_device_initialize (grub_usb_device_t dev)
if (descdev->configcnt == 0) if (descdev->configcnt == 0)
{ {
err = GRUB_USB_ERR_BADDEVICE; err = VasEBoot_USB_ERR_BADDEVICE;
goto fail; goto fail;
} }
@ -148,23 +148,23 @@ grub_usb_device_initialize (grub_usb_device_t dev)
int pos; int pos;
int currif; int currif;
char *data; char *data;
struct grub_usb_desc *desc; struct VasEBoot_usb_desc *desc;
/* First just read the first 4 bytes of the configuration /* First just read the first 4 bytes of the configuration
descriptor, after that it is known how many bytes really have descriptor, after that it is known how many bytes really have
to be read. */ to be read. */
err = grub_usb_get_descriptor (dev, GRUB_USB_DESCRIPTOR_CONFIG, i, 4, err = VasEBoot_usb_get_descriptor (dev, VasEBoot_USB_DESCRIPTOR_CONFIG, i, 4,
(char *) &config); (char *) &config);
data = grub_malloc (config.totallen); data = VasEBoot_malloc (config.totallen);
if (! data) if (! data)
{ {
err = GRUB_USB_ERR_INTERNAL; err = VasEBoot_USB_ERR_INTERNAL;
goto fail; goto fail;
} }
dev->config[i].descconf = (struct grub_usb_desc_config *) data; dev->config[i].descconf = (struct VasEBoot_usb_desc_config *) data;
err = grub_usb_get_descriptor (dev, GRUB_USB_DESCRIPTOR_CONFIG, i, err = VasEBoot_usb_get_descriptor (dev, VasEBoot_USB_DESCRIPTOR_CONFIG, i,
config.totallen, data); config.totallen, data);
if (err) if (err)
goto fail; goto fail;
@ -177,29 +177,29 @@ grub_usb_device_initialize (grub_usb_device_t dev)
{ {
while (pos < config.totallen) while (pos < config.totallen)
{ {
desc = (struct grub_usb_desc *)&data[pos]; desc = (struct VasEBoot_usb_desc *)&data[pos];
if (desc->type == GRUB_USB_DESCRIPTOR_INTERFACE) if (desc->type == VasEBoot_USB_DESCRIPTOR_INTERFACE)
break; break;
if (!desc->length) if (!desc->length)
{ {
err = GRUB_USB_ERR_BADDEVICE; err = VasEBoot_USB_ERR_BADDEVICE;
goto fail; goto fail;
} }
pos += desc->length; pos += desc->length;
} }
dev->config[i].interf[currif].descif dev->config[i].interf[currif].descif
= (struct grub_usb_desc_if *) &data[pos]; = (struct VasEBoot_usb_desc_if *) &data[pos];
pos += dev->config[i].interf[currif].descif->length; pos += dev->config[i].interf[currif].descif->length;
while (pos < config.totallen) while (pos < config.totallen)
{ {
desc = (struct grub_usb_desc *)&data[pos]; desc = (struct VasEBoot_usb_desc *)&data[pos];
if (desc->type == GRUB_USB_DESCRIPTOR_ENDPOINT) if (desc->type == VasEBoot_USB_DESCRIPTOR_ENDPOINT)
break; break;
if (!desc->length) if (!desc->length)
{ {
err = GRUB_USB_ERR_BADDEVICE; err = VasEBoot_USB_ERR_BADDEVICE;
goto fail; goto fail;
} }
pos += desc->length; pos += desc->length;
@ -207,35 +207,35 @@ grub_usb_device_initialize (grub_usb_device_t dev)
/* Point to the first endpoint. */ /* Point to the first endpoint. */
dev->config[i].interf[currif].descendp dev->config[i].interf[currif].descendp
= (struct grub_usb_desc_endp *) &data[pos]; = (struct VasEBoot_usb_desc_endp *) &data[pos];
pos += (sizeof (struct grub_usb_desc_endp) pos += (sizeof (struct VasEBoot_usb_desc_endp)
* dev->config[i].interf[currif].descif->endpointcnt); * dev->config[i].interf[currif].descif->endpointcnt);
} }
} }
return GRUB_USB_ERR_NONE; return VasEBoot_USB_ERR_NONE;
fail: fail:
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
grub_free (dev->config[i].descconf); VasEBoot_free (dev->config[i].descconf);
return err; return err;
} }
void grub_usb_device_attach (grub_usb_device_t dev) void VasEBoot_usb_device_attach (VasEBoot_usb_device_t dev)
{ {
int i; int i;
/* XXX: Just check configuration 0 for now. */ /* XXX: Just check configuration 0 for now. */
for (i = 0; i < dev->config[0].descconf->numif; i++) for (i = 0; i < dev->config[0].descconf->numif; i++)
{ {
struct grub_usb_desc_if *interf; struct VasEBoot_usb_desc_if *interf;
struct grub_usb_attach_desc *desc; struct VasEBoot_usb_attach_desc *desc;
interf = dev->config[0].interf[i].descif; interf = dev->config[0].interf[i].descif;
grub_dprintf ("usb", "iterate: interf=%d, class=%d, subclass=%d, protocol=%d\n", VasEBoot_dprintf ("usb", "iterate: interf=%d, class=%d, subclass=%d, protocol=%d\n",
i, interf->class, interf->subclass, interf->protocol); i, interf->class, interf->subclass, interf->protocol);
if (dev->config[0].interf[i].attached) if (dev->config[0].interf[i].attached)
@ -244,10 +244,10 @@ void grub_usb_device_attach (grub_usb_device_t dev)
for (desc = attach_hooks; desc; desc = desc->next) for (desc = attach_hooks; desc; desc = desc->next)
if (interf->class == desc->class) if (interf->class == desc->class)
{ {
grub_boot_time ("Probing USB device driver class %x", desc->class); VasEBoot_boot_time ("Probing USB device driver class %x", desc->class);
if (desc->hook (dev, 0, i)) if (desc->hook (dev, 0, i))
dev->config[0].interf[i].attached = 1; dev->config[0].interf[i].attached = 1;
grub_boot_time ("Probed USB device driver class %x", desc->class); VasEBoot_boot_time ("Probed USB device driver class %x", desc->class);
} }
if (dev->config[0].interf[i].attached) if (dev->config[0].interf[i].attached)
@ -255,33 +255,33 @@ void grub_usb_device_attach (grub_usb_device_t dev)
switch (interf->class) switch (interf->class)
{ {
case GRUB_USB_CLASS_MASS_STORAGE: case VasEBoot_USB_CLASS_MASS_STORAGE:
grub_dl_load ("usbms"); VasEBoot_dl_load ("usbms");
grub_print_error (); VasEBoot_print_error ();
break; break;
case GRUB_USB_CLASS_HID: case VasEBoot_USB_CLASS_HID:
grub_dl_load ("usb_keyboard"); VasEBoot_dl_load ("usb_keyboard");
grub_print_error (); VasEBoot_print_error ();
break; break;
case 0xff: case 0xff:
/* FIXME: don't load useless modules. */ /* FIXME: don't load useless modules. */
grub_dl_load ("usbserial_ftdi"); VasEBoot_dl_load ("usbserial_ftdi");
grub_print_error (); VasEBoot_print_error ();
grub_dl_load ("usbserial_pl2303"); VasEBoot_dl_load ("usbserial_pl2303");
grub_print_error (); VasEBoot_print_error ();
grub_dl_load ("usbserial_usbdebug"); VasEBoot_dl_load ("usbserial_usbdebug");
grub_print_error (); VasEBoot_print_error ();
break; break;
} }
} }
} }
/* Helper for grub_usb_register_attach_hook_class. */ /* Helper for VasEBoot_usb_register_attach_hook_class. */
static int static int
grub_usb_register_attach_hook_class_iter (grub_usb_device_t usbdev, void *data) VasEBoot_usb_register_attach_hook_class_iter (VasEBoot_usb_device_t usbdev, void *data)
{ {
struct grub_usb_attach_desc *desc = data; struct VasEBoot_usb_attach_desc *desc = data;
struct grub_usb_desc_device *descdev = &usbdev->descdev; struct VasEBoot_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
@ -291,11 +291,11 @@ grub_usb_register_attach_hook_class_iter (grub_usb_device_t usbdev, void *data)
/* XXX: Just check configuration 0 for now. */ /* XXX: Just check configuration 0 for now. */
for (i = 0; i < usbdev->config[0].descconf->numif; i++) for (i = 0; i < usbdev->config[0].descconf->numif; i++)
{ {
struct grub_usb_desc_if *interf; struct VasEBoot_usb_desc_if *interf;
interf = usbdev->config[0].interf[i].descif; interf = usbdev->config[0].interf[i].descif;
grub_dprintf ("usb", "iterate: interf=%d, class=%d, subclass=%d, protocol=%d\n", VasEBoot_dprintf ("usb", "iterate: interf=%d, class=%d, subclass=%d, protocol=%d\n",
i, interf->class, interf->subclass, interf->protocol); i, interf->class, interf->subclass, interf->protocol);
if (usbdev->config[0].interf[i].attached) if (usbdev->config[0].interf[i].attached)
@ -311,27 +311,27 @@ grub_usb_register_attach_hook_class_iter (grub_usb_device_t usbdev, void *data)
} }
void void
grub_usb_register_attach_hook_class (struct grub_usb_attach_desc *desc) VasEBoot_usb_register_attach_hook_class (struct VasEBoot_usb_attach_desc *desc)
{ {
desc->next = attach_hooks; desc->next = attach_hooks;
attach_hooks = desc; attach_hooks = desc;
grub_usb_iterate (grub_usb_register_attach_hook_class_iter, desc); VasEBoot_usb_iterate (VasEBoot_usb_register_attach_hook_class_iter, desc);
} }
void void
grub_usb_unregister_attach_hook_class (struct grub_usb_attach_desc *desc) VasEBoot_usb_unregister_attach_hook_class (struct VasEBoot_usb_attach_desc *desc)
{ {
grub_list_remove (GRUB_AS_LIST (desc)); VasEBoot_list_remove (VasEBoot_AS_LIST (desc));
} }
GRUB_MOD_INIT(usb) VasEBoot_MOD_INIT(usb)
{ {
grub_term_poll_usb = grub_usb_poll_devices; VasEBoot_term_poll_usb = VasEBoot_usb_poll_devices;
} }
GRUB_MOD_FINI(usb) VasEBoot_MOD_FINI(usb)
{ {
grub_term_poll_usb = NULL; VasEBoot_term_poll_usb = NULL;
} }

View File

@ -1,63 +1,63 @@
/* usb.c - USB Hub Support. */ /* usb.c - USB Hub Support. */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2008 Free Software Foundation, Inc. * Copyright (C) 2008 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/mm.h> #include <VasEBoot/mm.h>
#include <grub/usb.h> #include <VasEBoot/usb.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/time.h> #include <VasEBoot/time.h>
#define GRUB_USBHUB_MAX_DEVICES 128 #define VasEBoot_USBHUB_MAX_DEVICES 128
/* USB Supports 127 devices, with device 0 as special case. */ /* USB Supports 127 devices, with device 0 as special case. */
static struct grub_usb_device *grub_usb_devs[GRUB_USBHUB_MAX_DEVICES]; static struct VasEBoot_usb_device *VasEBoot_usb_devs[VasEBoot_USBHUB_MAX_DEVICES];
static int rescan = 0; static int rescan = 0;
static int npending = 0; static int npending = 0;
struct grub_usb_hub struct VasEBoot_usb_hub
{ {
struct grub_usb_hub *next; struct VasEBoot_usb_hub *next;
grub_usb_controller_t controller; VasEBoot_usb_controller_t controller;
int nports; int nports;
struct grub_usb_device **devices; struct VasEBoot_usb_device **devices;
struct grub_usb_hub_port *ports; struct VasEBoot_usb_hub_port *ports;
grub_usb_device_t dev; VasEBoot_usb_device_t dev;
}; };
static struct grub_usb_hub *hubs; static struct VasEBoot_usb_hub *hubs;
static grub_usb_controller_dev_t grub_usb_list; static VasEBoot_usb_controller_dev_t VasEBoot_usb_list;
/* Add a device that currently has device number 0 and resides on /* Add a device that currently has device number 0 and resides on
CONTROLLER, the Hub reported that the device speed is SPEED. */ CONTROLLER, the Hub reported that the device speed is SPEED. */
static grub_usb_device_t static VasEBoot_usb_device_t
grub_usb_hub_add_dev (grub_usb_controller_t controller, VasEBoot_usb_hub_add_dev (VasEBoot_usb_controller_t controller,
grub_usb_speed_t speed, VasEBoot_usb_speed_t speed,
int split_hubport, int split_hubaddr) int split_hubport, int split_hubaddr)
{ {
grub_usb_device_t dev; VasEBoot_usb_device_t dev;
int i; int i;
grub_usb_err_t err; VasEBoot_usb_err_t err;
grub_boot_time ("Attaching USB device"); VasEBoot_boot_time ("Attaching USB device");
dev = grub_zalloc (sizeof (struct grub_usb_device)); dev = VasEBoot_zalloc (sizeof (struct VasEBoot_usb_device));
if (! dev) if (! dev)
return NULL; return NULL;
@ -66,108 +66,108 @@ grub_usb_hub_add_dev (grub_usb_controller_t controller,
dev->split_hubport = split_hubport; dev->split_hubport = split_hubport;
dev->split_hubaddr = split_hubaddr; dev->split_hubaddr = split_hubaddr;
err = grub_usb_device_initialize (dev); err = VasEBoot_usb_device_initialize (dev);
if (err) if (err)
{ {
grub_free (dev); VasEBoot_free (dev);
return NULL; return NULL;
} }
/* Assign a new address to the device. */ /* Assign a new address to the device. */
for (i = 1; i < GRUB_USBHUB_MAX_DEVICES; i++) for (i = 1; i < VasEBoot_USBHUB_MAX_DEVICES; i++)
{ {
if (! grub_usb_devs[i]) if (! VasEBoot_usb_devs[i])
break; break;
} }
if (i == GRUB_USBHUB_MAX_DEVICES) if (i == VasEBoot_USBHUB_MAX_DEVICES)
{ {
grub_error (GRUB_ERR_IO, "can't assign address to USB device"); VasEBoot_error (VasEBoot_ERR_IO, "can't assign address to USB device");
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
grub_free (dev->config[i].descconf); VasEBoot_free (dev->config[i].descconf);
grub_free (dev); VasEBoot_free (dev);
return NULL; return NULL;
} }
err = grub_usb_control_msg (dev, err = VasEBoot_usb_control_msg (dev,
(GRUB_USB_REQTYPE_OUT (VasEBoot_USB_REQTYPE_OUT
| GRUB_USB_REQTYPE_STANDARD | VasEBoot_USB_REQTYPE_STANDARD
| GRUB_USB_REQTYPE_TARGET_DEV), | VasEBoot_USB_REQTYPE_TARGET_DEV),
GRUB_USB_REQ_SET_ADDRESS, VasEBoot_USB_REQ_SET_ADDRESS,
i, 0, 0, NULL); i, 0, 0, NULL);
if (err) if (err)
{ {
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
grub_free (dev->config[i].descconf); VasEBoot_free (dev->config[i].descconf);
grub_free (dev); VasEBoot_free (dev);
return NULL; return NULL;
} }
dev->addr = i; dev->addr = i;
dev->initialized = 1; dev->initialized = 1;
grub_usb_devs[i] = dev; VasEBoot_usb_devs[i] = dev;
grub_dprintf ("usb", "Added new usb device: %p, addr=%d\n", VasEBoot_dprintf ("usb", "Added new usb device: %p, addr=%d\n",
dev, i); dev, i);
grub_dprintf ("usb", "speed=%d, split_hubport=%d, split_hubaddr=%d\n", VasEBoot_dprintf ("usb", "speed=%d, split_hubport=%d, split_hubaddr=%d\n",
speed, split_hubport, split_hubaddr); speed, split_hubport, split_hubaddr);
/* Wait "recovery interval", spec. says 2ms */ /* Wait "recovery interval", spec. says 2ms */
grub_millisleep (2); VasEBoot_millisleep (2);
grub_boot_time ("Probing USB device driver"); VasEBoot_boot_time ("Probing USB device driver");
grub_usb_device_attach (dev); VasEBoot_usb_device_attach (dev);
grub_boot_time ("Attached USB device"); VasEBoot_boot_time ("Attached USB device");
return dev; return dev;
} }
static grub_usb_err_t static VasEBoot_usb_err_t
grub_usb_add_hub (grub_usb_device_t dev) VasEBoot_usb_add_hub (VasEBoot_usb_device_t dev)
{ {
struct grub_usb_usb_hubdesc hubdesc; struct VasEBoot_usb_usb_hubdesc hubdesc;
grub_usb_err_t err; VasEBoot_usb_err_t err;
int i; int i;
err = grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_IN err = VasEBoot_usb_control_msg (dev, (VasEBoot_USB_REQTYPE_IN
| GRUB_USB_REQTYPE_CLASS | VasEBoot_USB_REQTYPE_CLASS
| GRUB_USB_REQTYPE_TARGET_DEV), | VasEBoot_USB_REQTYPE_TARGET_DEV),
GRUB_USB_REQ_GET_DESCRIPTOR, VasEBoot_USB_REQ_GET_DESCRIPTOR,
(GRUB_USB_DESCRIPTOR_HUB << 8) | 0, (VasEBoot_USB_DESCRIPTOR_HUB << 8) | 0,
0, sizeof (hubdesc), (char *) &hubdesc); 0, sizeof (hubdesc), (char *) &hubdesc);
if (err) if (err)
return err; return err;
grub_dprintf ("usb", "Hub descriptor:\n\t\t len:%d, typ:0x%02x, cnt:%d, char:0x%02x, pwg:%d, curr:%d\n", VasEBoot_dprintf ("usb", "Hub descriptor:\n\t\t len:%d, typ:0x%02x, cnt:%d, char:0x%02x, pwg:%d, curr:%d\n",
hubdesc.length, hubdesc.type, hubdesc.portcnt, hubdesc.length, hubdesc.type, hubdesc.portcnt,
hubdesc.characteristics, hubdesc.pwdgood, hubdesc.characteristics, hubdesc.pwdgood,
hubdesc.current); hubdesc.current);
/* Activate the first configuration. Hubs should have only one conf. */ /* Activate the first configuration. Hubs should have only one conf. */
grub_dprintf ("usb", "Hub set configuration\n"); VasEBoot_dprintf ("usb", "Hub set configuration\n");
grub_usb_set_configuration (dev, 1); VasEBoot_usb_set_configuration (dev, 1);
dev->nports = hubdesc.portcnt; dev->nports = hubdesc.portcnt;
dev->children = grub_zalloc (hubdesc.portcnt * sizeof (dev->children[0])); dev->children = VasEBoot_zalloc (hubdesc.portcnt * sizeof (dev->children[0]));
dev->ports = grub_zalloc (dev->nports * sizeof (dev->ports[0])); dev->ports = VasEBoot_zalloc (dev->nports * sizeof (dev->ports[0]));
if (!dev->children || !dev->ports) if (!dev->children || !dev->ports)
{ {
grub_free (dev->children); VasEBoot_free (dev->children);
grub_free (dev->ports); VasEBoot_free (dev->ports);
return GRUB_USB_ERR_INTERNAL; return VasEBoot_USB_ERR_INTERNAL;
} }
/* Power on all Hub ports. */ /* Power on all Hub ports. */
for (i = 1; i <= hubdesc.portcnt; i++) for (i = 1; i <= hubdesc.portcnt; i++)
{ {
grub_dprintf ("usb", "Power on - port %d\n", i); VasEBoot_dprintf ("usb", "Power on - port %d\n", i);
/* Power on the port and wait for possible device connect */ /* Power on the port and wait for possible device connect */
grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_OUT VasEBoot_usb_control_msg (dev, (VasEBoot_USB_REQTYPE_OUT
| GRUB_USB_REQTYPE_CLASS | VasEBoot_USB_REQTYPE_CLASS
| GRUB_USB_REQTYPE_TARGET_OTHER), | VasEBoot_USB_REQTYPE_TARGET_OTHER),
GRUB_USB_REQ_SET_FEATURE, VasEBoot_USB_REQ_SET_FEATURE,
GRUB_USB_HUB_FEATURE_PORT_POWER, VasEBoot_USB_HUB_FEATURE_PORT_POWER,
i, 0, NULL); i, 0, NULL);
} }
@ -175,19 +175,19 @@ grub_usb_add_hub (grub_usb_device_t dev)
for (i = 0; i < dev->config[0].interf[0].descif->endpointcnt; for (i = 0; i < dev->config[0].interf[0].descif->endpointcnt;
i++) i++)
{ {
struct grub_usb_desc_endp *endp = NULL; struct VasEBoot_usb_desc_endp *endp = NULL;
endp = &dev->config[0].interf[0].descendp[i]; endp = &dev->config[0].interf[0].descendp[i];
if ((endp->endp_addr & 128) && grub_usb_get_ep_type(endp) if ((endp->endp_addr & 128) && VasEBoot_usb_get_ep_type(endp)
== GRUB_USB_EP_INTERRUPT) == VasEBoot_USB_EP_INTERRUPT)
{ {
grub_size_t len; VasEBoot_size_t len;
dev->hub_endpoint = endp; dev->hub_endpoint = endp;
len = endp->maxpacket; len = endp->maxpacket;
if (len > sizeof (dev->statuschange)) if (len > sizeof (dev->statuschange))
len = sizeof (dev->statuschange); len = sizeof (dev->statuschange);
dev->hub_transfer dev->hub_transfer
= grub_usb_bulk_read_background (dev, endp, len, = VasEBoot_usb_bulk_read_background (dev, endp, len,
(char *) &dev->statuschange); (char *) &dev->statuschange);
break; break;
} }
@ -195,28 +195,28 @@ grub_usb_add_hub (grub_usb_device_t dev)
rescan = 1; rescan = 1;
return GRUB_USB_ERR_NONE; return VasEBoot_USB_ERR_NONE;
} }
static void static void
attach_root_port (struct grub_usb_hub *hub, int portno, attach_root_port (struct VasEBoot_usb_hub *hub, int portno,
grub_usb_speed_t speed) VasEBoot_usb_speed_t speed)
{ {
grub_usb_device_t dev; VasEBoot_usb_device_t dev;
grub_usb_err_t err; VasEBoot_usb_err_t err;
grub_boot_time ("After detect_dev"); VasEBoot_boot_time ("After detect_dev");
/* Enable the port. */ /* Enable the port. */
err = hub->controller->dev->portstatus (hub->controller, portno, 1); err = hub->controller->dev->portstatus (hub->controller, portno, 1);
if (err) if (err)
return; return;
hub->controller->dev->pending_reset = grub_get_time_ms () + 5000; hub->controller->dev->pending_reset = VasEBoot_get_time_ms () + 5000;
npending++; npending++;
grub_millisleep (10); VasEBoot_millisleep (10);
grub_boot_time ("Port enabled"); VasEBoot_boot_time ("Port enabled");
/* Enable the port and create a device. */ /* Enable the port and create a device. */
/* High speed device needs not transaction translation /* High speed device needs not transaction translation
@ -224,7 +224,7 @@ attach_root_port (struct grub_usb_hub *hub, int portno,
and full/low speed device connected to OHCI/UHCI needs not and full/low speed device connected to OHCI/UHCI needs not
transaction translation - e.g. hubport and hubaddr should be transaction translation - e.g. hubport and hubaddr should be
always none (zero) for any device connected to any root hub. */ always none (zero) for any device connected to any root hub. */
dev = grub_usb_hub_add_dev (hub->controller, speed, 0, 0); dev = VasEBoot_usb_hub_add_dev (hub->controller, speed, 0, 0);
hub->controller->dev->pending_reset = 0; hub->controller->dev->pending_reset = 0;
npending--; npending--;
if (! dev) if (! dev)
@ -234,49 +234,49 @@ attach_root_port (struct grub_usb_hub *hub, int portno,
/* If the device is a Hub, scan it for more devices. */ /* If the device is a Hub, scan it for more devices. */
if (dev->descdev.class == 0x09) if (dev->descdev.class == 0x09)
grub_usb_add_hub (dev); VasEBoot_usb_add_hub (dev);
grub_boot_time ("Attached root port"); VasEBoot_boot_time ("Attached root port");
} }
/* Iterate over all controllers found by the driver. */ /* Iterate over all controllers found by the driver. */
static int static int
grub_usb_controller_dev_register_iter (grub_usb_controller_t controller, void *data) VasEBoot_usb_controller_dev_register_iter (VasEBoot_usb_controller_t controller, void *data)
{ {
grub_usb_controller_dev_t usb = data; VasEBoot_usb_controller_dev_t usb = data;
struct grub_usb_hub *hub; struct VasEBoot_usb_hub *hub;
controller->dev = usb; controller->dev = usb;
grub_boot_time ("Registering USB root hub"); VasEBoot_boot_time ("Registering USB root hub");
hub = grub_malloc (sizeof (*hub)); hub = VasEBoot_malloc (sizeof (*hub));
if (!hub) if (!hub)
return GRUB_USB_ERR_INTERNAL; return VasEBoot_USB_ERR_INTERNAL;
hub->next = hubs; hub->next = hubs;
hubs = hub; hubs = hub;
hub->controller = grub_malloc (sizeof (*controller)); hub->controller = VasEBoot_malloc (sizeof (*controller));
if (!hub->controller) if (!hub->controller)
{ {
grub_free (hub); VasEBoot_free (hub);
return GRUB_USB_ERR_INTERNAL; return VasEBoot_USB_ERR_INTERNAL;
} }
grub_memcpy (hub->controller, controller, sizeof (*controller)); VasEBoot_memcpy (hub->controller, controller, sizeof (*controller));
hub->dev = 0; hub->dev = 0;
/* Query the number of ports the root Hub has. */ /* Query the number of ports the root Hub has. */
hub->nports = controller->dev->hubports (controller); hub->nports = controller->dev->hubports (controller);
hub->devices = grub_zalloc (sizeof (hub->devices[0]) * hub->nports); hub->devices = VasEBoot_zalloc (sizeof (hub->devices[0]) * hub->nports);
hub->ports = grub_zalloc (sizeof (hub->ports[0]) * hub->nports); hub->ports = VasEBoot_zalloc (sizeof (hub->ports[0]) * hub->nports);
if (!hub->devices || !hub->ports) if (!hub->devices || !hub->ports)
{ {
grub_free (hub->devices); VasEBoot_free (hub->devices);
grub_free (hub->ports); VasEBoot_free (hub->ports);
grub_free (hub->controller); VasEBoot_free (hub->controller);
grub_free (hub); VasEBoot_free (hub);
grub_print_error (); VasEBoot_print_error ();
return 0; return 0;
} }
@ -284,11 +284,11 @@ grub_usb_controller_dev_register_iter (grub_usb_controller_t controller, void *d
} }
void void
grub_usb_controller_dev_unregister (grub_usb_controller_dev_t usb) VasEBoot_usb_controller_dev_unregister (VasEBoot_usb_controller_dev_t usb)
{ {
grub_usb_controller_dev_t *p, q; VasEBoot_usb_controller_dev_t *p, q;
for (p = &grub_usb_list, q = *p; q; p = &(q->next), q = q->next) for (p = &VasEBoot_usb_list, q = *p; q; p = &(q->next), q = q->next)
if (q == usb) if (q == usb)
{ {
*p = q->next; *p = q->next;
@ -297,19 +297,19 @@ grub_usb_controller_dev_unregister (grub_usb_controller_dev_t usb)
} }
void void
grub_usb_controller_dev_register (grub_usb_controller_dev_t usb) VasEBoot_usb_controller_dev_register (VasEBoot_usb_controller_dev_t usb)
{ {
int portno; int portno;
int continue_waiting = 0; int continue_waiting = 0;
struct grub_usb_hub *hub; struct VasEBoot_usb_hub *hub;
usb->next = grub_usb_list; usb->next = VasEBoot_usb_list;
grub_usb_list = usb; VasEBoot_usb_list = usb;
if (usb->iterate) if (usb->iterate)
usb->iterate (grub_usb_controller_dev_register_iter, usb); usb->iterate (VasEBoot_usb_controller_dev_register_iter, usb);
grub_boot_time ("waiting for stable power on USB root\n"); VasEBoot_boot_time ("waiting for stable power on USB root\n");
while (1) while (1)
{ {
@ -323,41 +323,41 @@ grub_usb_controller_dev_register (grub_usb_controller_dev_t usb)
* it - but prevent deadlock in case when device is too faulty... */ * it - but prevent deadlock in case when device is too faulty... */
for (portno = 0; portno < hub->nports; portno++) for (portno = 0; portno < hub->nports; portno++)
{ {
grub_usb_speed_t speed; VasEBoot_usb_speed_t speed;
int changed = 0; int changed = 0;
speed = hub->controller->dev->detect_dev (hub->controller, portno, speed = hub->controller->dev->detect_dev (hub->controller, portno,
&changed); &changed);
if (hub->ports[portno].state == PORT_STATE_NORMAL if (hub->ports[portno].state == PORT_STATE_NORMAL
&& speed != GRUB_USB_SPEED_NONE) && speed != VasEBoot_USB_SPEED_NONE)
{ {
hub->ports[portno].soft_limit_time = grub_get_time_ms () + 250; hub->ports[portno].soft_limit_time = VasEBoot_get_time_ms () + 250;
hub->ports[portno].hard_limit_time = hub->ports[portno].soft_limit_time + 1750; hub->ports[portno].hard_limit_time = hub->ports[portno].soft_limit_time + 1750;
hub->ports[portno].state = PORT_STATE_WAITING_FOR_STABLE_POWER; hub->ports[portno].state = PORT_STATE_WAITING_FOR_STABLE_POWER;
grub_boot_time ("Scheduling stable power wait for port %p:%d", VasEBoot_boot_time ("Scheduling stable power wait for port %p:%d",
usb, portno); usb, portno);
continue_waiting++; continue_waiting++;
continue; continue;
} }
if (hub->ports[portno].state == PORT_STATE_WAITING_FOR_STABLE_POWER if (hub->ports[portno].state == PORT_STATE_WAITING_FOR_STABLE_POWER
&& speed == GRUB_USB_SPEED_NONE) && speed == VasEBoot_USB_SPEED_NONE)
{ {
hub->ports[portno].soft_limit_time = grub_get_time_ms () + 250; hub->ports[portno].soft_limit_time = VasEBoot_get_time_ms () + 250;
continue; continue;
} }
if (hub->ports[portno].state == PORT_STATE_WAITING_FOR_STABLE_POWER if (hub->ports[portno].state == PORT_STATE_WAITING_FOR_STABLE_POWER
&& grub_get_time_ms () > hub->ports[portno].soft_limit_time) && VasEBoot_get_time_ms () > hub->ports[portno].soft_limit_time)
{ {
hub->ports[portno].state = PORT_STATE_STABLE_POWER; hub->ports[portno].state = PORT_STATE_STABLE_POWER;
grub_boot_time ("Got stable power wait for port %p:%d", VasEBoot_boot_time ("Got stable power wait for port %p:%d",
usb, portno); usb, portno);
continue_waiting--; continue_waiting--;
continue; continue;
} }
if (hub->ports[portno].state == PORT_STATE_WAITING_FOR_STABLE_POWER if (hub->ports[portno].state == PORT_STATE_WAITING_FOR_STABLE_POWER
&& grub_get_time_ms () > hub->ports[portno].hard_limit_time) && VasEBoot_get_time_ms () > hub->ports[portno].hard_limit_time)
{ {
hub->ports[portno].state = PORT_STATE_FAILED_DEVICE; hub->ports[portno].state = PORT_STATE_FAILED_DEVICE;
continue_waiting--; continue_waiting--;
@ -367,73 +367,73 @@ grub_usb_controller_dev_register (grub_usb_controller_dev_t usb)
} }
if (!continue_waiting) if (!continue_waiting)
break; break;
grub_millisleep (1); VasEBoot_millisleep (1);
} }
grub_boot_time ("After the stable power wait on USB root"); VasEBoot_boot_time ("After the stable power wait on USB root");
for (hub = hubs; hub; hub = hub->next) for (hub = hubs; hub; hub = hub->next)
if (hub->controller->dev == usb) if (hub->controller->dev == usb)
for (portno = 0; portno < hub->nports; portno++) for (portno = 0; portno < hub->nports; portno++)
if (hub->ports[portno].state == PORT_STATE_STABLE_POWER) if (hub->ports[portno].state == PORT_STATE_STABLE_POWER)
{ {
grub_usb_speed_t speed; VasEBoot_usb_speed_t speed;
int changed = 0; int changed = 0;
hub->ports[portno].state = PORT_STATE_NORMAL; hub->ports[portno].state = PORT_STATE_NORMAL;
speed = hub->controller->dev->detect_dev (hub->controller, portno, &changed); speed = hub->controller->dev->detect_dev (hub->controller, portno, &changed);
attach_root_port (hub, portno, speed); attach_root_port (hub, portno, speed);
} }
grub_boot_time ("USB root hub registered"); VasEBoot_boot_time ("USB root hub registered");
} }
static void detach_device (grub_usb_device_t dev); static void detach_device (VasEBoot_usb_device_t dev);
static void static void
detach_device (grub_usb_device_t dev) detach_device (VasEBoot_usb_device_t dev)
{ {
unsigned i; unsigned i;
int k; int k;
if (!dev) if (!dev)
return; return;
if (dev->descdev.class == GRUB_USB_CLASS_HUB) if (dev->descdev.class == VasEBoot_USB_CLASS_HUB)
{ {
if (dev->hub_transfer) if (dev->hub_transfer)
grub_usb_cancel_transfer (dev->hub_transfer); VasEBoot_usb_cancel_transfer (dev->hub_transfer);
for (i = 0; i < dev->nports; i++) for (i = 0; i < dev->nports; i++)
detach_device (dev->children[i]); detach_device (dev->children[i]);
grub_free (dev->children); VasEBoot_free (dev->children);
} }
for (i = 0; i < ARRAY_SIZE (dev->config); i++) for (i = 0; i < ARRAY_SIZE (dev->config); i++)
if (dev->config[i].descconf) if (dev->config[i].descconf)
for (k = 0; k < dev->config[i].descconf->numif; k++) for (k = 0; k < dev->config[i].descconf->numif; k++)
{ {
struct grub_usb_interface *inter = &dev->config[i].interf[k]; struct VasEBoot_usb_interface *inter = &dev->config[i].interf[k];
if (inter && inter->detach_hook) if (inter && inter->detach_hook)
inter->detach_hook (dev, i, k); inter->detach_hook (dev, i, k);
} }
grub_usb_devs[dev->addr] = 0; VasEBoot_usb_devs[dev->addr] = 0;
} }
static int static int
wait_power_nonroot_hub (grub_usb_device_t dev) wait_power_nonroot_hub (VasEBoot_usb_device_t dev)
{ {
grub_usb_err_t err; VasEBoot_usb_err_t err;
int continue_waiting = 0; int continue_waiting = 0;
unsigned i; unsigned i;
for (i = 1; i <= dev->nports; i++) for (i = 1; i <= dev->nports; i++)
if (dev->ports[i - 1].state == PORT_STATE_WAITING_FOR_STABLE_POWER) if (dev->ports[i - 1].state == PORT_STATE_WAITING_FOR_STABLE_POWER)
{ {
grub_uint64_t tm; VasEBoot_uint64_t tm;
grub_uint32_t current_status = 0; VasEBoot_uint32_t current_status = 0;
/* Get the port status. */ /* Get the port status. */
err = grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_IN err = VasEBoot_usb_control_msg (dev, (VasEBoot_USB_REQTYPE_IN
| GRUB_USB_REQTYPE_CLASS | VasEBoot_USB_REQTYPE_CLASS
| GRUB_USB_REQTYPE_TARGET_OTHER), | VasEBoot_USB_REQTYPE_TARGET_OTHER),
GRUB_USB_REQ_GET_STATUS, VasEBoot_USB_REQ_GET_STATUS,
0, i, 0, i,
sizeof (current_status), sizeof (current_status),
(char *) &current_status); (char *) &current_status);
@ -442,22 +442,22 @@ wait_power_nonroot_hub (grub_usb_device_t dev)
dev->ports[i - 1].state = PORT_STATE_FAILED_DEVICE; dev->ports[i - 1].state = PORT_STATE_FAILED_DEVICE;
continue; continue;
} }
tm = grub_get_time_ms (); tm = VasEBoot_get_time_ms ();
if (!(current_status & GRUB_USB_HUB_STATUS_PORT_CONNECTED)) if (!(current_status & VasEBoot_USB_HUB_STATUS_PORT_CONNECTED))
dev->ports[i - 1].soft_limit_time = tm + 250; dev->ports[i - 1].soft_limit_time = tm + 250;
if (tm >= dev->ports[i - 1].soft_limit_time) if (tm >= dev->ports[i - 1].soft_limit_time)
{ {
if (dev->controller.dev->pending_reset) if (dev->controller.dev->pending_reset)
continue; continue;
/* Now do reset of port. */ /* Now do reset of port. */
grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_OUT VasEBoot_usb_control_msg (dev, (VasEBoot_USB_REQTYPE_OUT
| GRUB_USB_REQTYPE_CLASS | VasEBoot_USB_REQTYPE_CLASS
| GRUB_USB_REQTYPE_TARGET_OTHER), | VasEBoot_USB_REQTYPE_TARGET_OTHER),
GRUB_USB_REQ_SET_FEATURE, VasEBoot_USB_REQ_SET_FEATURE,
GRUB_USB_HUB_FEATURE_PORT_RESET, VasEBoot_USB_HUB_FEATURE_PORT_RESET,
i, 0, 0); i, 0, 0);
dev->ports[i - 1].state = PORT_STATE_NORMAL; dev->ports[i - 1].state = PORT_STATE_NORMAL;
grub_boot_time ("Resetting port %p:%d", dev, i - 1); VasEBoot_boot_time ("Resetting port %p:%d", dev, i - 1);
rescan = 1; rescan = 1;
/* We cannot reset more than one device at the same time ! /* We cannot reset more than one device at the same time !
@ -467,7 +467,7 @@ wait_power_nonroot_hub (grub_usb_device_t dev)
* Additionaly, we cannot perform another reset * Additionaly, we cannot perform another reset
* anywhere on the same OHCI controller until * anywhere on the same OHCI controller until
* we will finish addressing of reseted device ! */ * we will finish addressing of reseted device ! */
dev->controller.dev->pending_reset = grub_get_time_ms () + 5000; dev->controller.dev->pending_reset = VasEBoot_get_time_ms () + 5000;
npending++; npending++;
continue; continue;
} }
@ -482,19 +482,19 @@ wait_power_nonroot_hub (grub_usb_device_t dev)
} }
static void static void
poll_nonroot_hub (grub_usb_device_t dev) poll_nonroot_hub (VasEBoot_usb_device_t dev)
{ {
grub_usb_err_t err; VasEBoot_usb_err_t err;
unsigned i; unsigned i;
grub_uint32_t changed; VasEBoot_uint32_t changed;
grub_size_t actual, len; VasEBoot_size_t actual, len;
if (!dev->hub_transfer) if (!dev->hub_transfer)
return; return;
err = grub_usb_check_transfer (dev->hub_transfer, &actual); err = VasEBoot_usb_check_transfer (dev->hub_transfer, &actual);
if (err == GRUB_USB_ERR_WAIT) if (err == VasEBoot_USB_ERR_WAIT)
return; return;
changed = dev->statuschange; changed = dev->statuschange;
@ -503,7 +503,7 @@ poll_nonroot_hub (grub_usb_device_t dev)
if (len > sizeof (dev->statuschange)) if (len > sizeof (dev->statuschange))
len = sizeof (dev->statuschange); len = sizeof (dev->statuschange);
dev->hub_transfer dev->hub_transfer
= grub_usb_bulk_read_background (dev, dev->hub_endpoint, len, = VasEBoot_usb_bulk_read_background (dev, dev->hub_endpoint, len,
(char *) &dev->statuschange); (char *) &dev->statuschange);
if (err || actual == 0 || changed == 0) if (err || actual == 0 || changed == 0)
@ -512,111 +512,111 @@ poll_nonroot_hub (grub_usb_device_t dev)
/* Iterate over the Hub ports. */ /* Iterate over the Hub ports. */
for (i = 1; i <= dev->nports; i++) for (i = 1; i <= dev->nports; i++)
{ {
grub_uint32_t status; VasEBoot_uint32_t status;
if (!(changed & (1 << i)) if (!(changed & (1 << i))
|| dev->ports[i - 1].state == PORT_STATE_WAITING_FOR_STABLE_POWER) || dev->ports[i - 1].state == PORT_STATE_WAITING_FOR_STABLE_POWER)
continue; continue;
/* Get the port status. */ /* Get the port status. */
err = grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_IN err = VasEBoot_usb_control_msg (dev, (VasEBoot_USB_REQTYPE_IN
| GRUB_USB_REQTYPE_CLASS | VasEBoot_USB_REQTYPE_CLASS
| GRUB_USB_REQTYPE_TARGET_OTHER), | VasEBoot_USB_REQTYPE_TARGET_OTHER),
GRUB_USB_REQ_GET_STATUS, VasEBoot_USB_REQ_GET_STATUS,
0, i, sizeof (status), (char *) &status); 0, i, sizeof (status), (char *) &status);
grub_dprintf ("usb", "dev = %p, i = %d, status = %08x\n", VasEBoot_dprintf ("usb", "dev = %p, i = %d, status = %08x\n",
dev, i, status); dev, i, status);
if (err) if (err)
continue; continue;
/* FIXME: properly handle these conditions. */ /* FIXME: properly handle these conditions. */
if (status & GRUB_USB_HUB_STATUS_C_PORT_ENABLED) if (status & VasEBoot_USB_HUB_STATUS_C_PORT_ENABLED)
grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_OUT VasEBoot_usb_control_msg (dev, (VasEBoot_USB_REQTYPE_OUT
| GRUB_USB_REQTYPE_CLASS | VasEBoot_USB_REQTYPE_CLASS
| GRUB_USB_REQTYPE_TARGET_OTHER), | VasEBoot_USB_REQTYPE_TARGET_OTHER),
GRUB_USB_REQ_CLEAR_FEATURE, VasEBoot_USB_REQ_CLEAR_FEATURE,
GRUB_USB_HUB_FEATURE_C_PORT_ENABLED, i, 0, 0); VasEBoot_USB_HUB_FEATURE_C_PORT_ENABLED, i, 0, 0);
if (status & GRUB_USB_HUB_STATUS_C_PORT_SUSPEND) if (status & VasEBoot_USB_HUB_STATUS_C_PORT_SUSPEND)
grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_OUT VasEBoot_usb_control_msg (dev, (VasEBoot_USB_REQTYPE_OUT
| GRUB_USB_REQTYPE_CLASS | VasEBoot_USB_REQTYPE_CLASS
| GRUB_USB_REQTYPE_TARGET_OTHER), | VasEBoot_USB_REQTYPE_TARGET_OTHER),
GRUB_USB_REQ_CLEAR_FEATURE, VasEBoot_USB_REQ_CLEAR_FEATURE,
GRUB_USB_HUB_FEATURE_C_PORT_SUSPEND, i, 0, 0); VasEBoot_USB_HUB_FEATURE_C_PORT_SUSPEND, i, 0, 0);
if (status & GRUB_USB_HUB_STATUS_C_PORT_OVERCURRENT) if (status & VasEBoot_USB_HUB_STATUS_C_PORT_OVERCURRENT)
grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_OUT VasEBoot_usb_control_msg (dev, (VasEBoot_USB_REQTYPE_OUT
| GRUB_USB_REQTYPE_CLASS | VasEBoot_USB_REQTYPE_CLASS
| GRUB_USB_REQTYPE_TARGET_OTHER), | VasEBoot_USB_REQTYPE_TARGET_OTHER),
GRUB_USB_REQ_CLEAR_FEATURE, VasEBoot_USB_REQ_CLEAR_FEATURE,
GRUB_USB_HUB_FEATURE_C_PORT_OVERCURRENT, i, 0, 0); VasEBoot_USB_HUB_FEATURE_C_PORT_OVERCURRENT, i, 0, 0);
if (!dev->controller.dev->pending_reset && if (!dev->controller.dev->pending_reset &&
(status & GRUB_USB_HUB_STATUS_C_PORT_CONNECTED)) (status & VasEBoot_USB_HUB_STATUS_C_PORT_CONNECTED))
{ {
grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_OUT VasEBoot_usb_control_msg (dev, (VasEBoot_USB_REQTYPE_OUT
| GRUB_USB_REQTYPE_CLASS | VasEBoot_USB_REQTYPE_CLASS
| GRUB_USB_REQTYPE_TARGET_OTHER), | VasEBoot_USB_REQTYPE_TARGET_OTHER),
GRUB_USB_REQ_CLEAR_FEATURE, VasEBoot_USB_REQ_CLEAR_FEATURE,
GRUB_USB_HUB_FEATURE_C_PORT_CONNECTED, i, 0, 0); VasEBoot_USB_HUB_FEATURE_C_PORT_CONNECTED, i, 0, 0);
detach_device (dev->children[i - 1]); detach_device (dev->children[i - 1]);
dev->children[i - 1] = NULL; dev->children[i - 1] = NULL;
/* Connected and status of connection changed ? */ /* Connected and status of connection changed ? */
if (status & GRUB_USB_HUB_STATUS_PORT_CONNECTED) if (status & VasEBoot_USB_HUB_STATUS_PORT_CONNECTED)
{ {
grub_boot_time ("Before the stable power wait portno=%d", i); VasEBoot_boot_time ("Before the stable power wait portno=%d", i);
/* A device is actually connected to this port. */ /* A device is actually connected to this port. */
/* Wait for completion of insertion and stable power (USB spec.) /* Wait for completion of insertion and stable power (USB spec.)
* Should be at least 100ms, some devices requires more... * Should be at least 100ms, some devices requires more...
* There is also another thing - some devices have worse contacts * There is also another thing - some devices have worse contacts
* and connected signal is unstable for some time - we should handle * and connected signal is unstable for some time - we should handle
* it - but prevent deadlock in case when device is too faulty... */ * it - but prevent deadlock in case when device is too faulty... */
dev->ports[i - 1].soft_limit_time = grub_get_time_ms () + 250; dev->ports[i - 1].soft_limit_time = VasEBoot_get_time_ms () + 250;
dev->ports[i - 1].hard_limit_time = dev->ports[i - 1].soft_limit_time + 1750; dev->ports[i - 1].hard_limit_time = dev->ports[i - 1].soft_limit_time + 1750;
dev->ports[i - 1].state = PORT_STATE_WAITING_FOR_STABLE_POWER; dev->ports[i - 1].state = PORT_STATE_WAITING_FOR_STABLE_POWER;
grub_boot_time ("Scheduling stable power wait for port %p:%d", VasEBoot_boot_time ("Scheduling stable power wait for port %p:%d",
dev, i - 1); dev, i - 1);
continue; continue;
} }
} }
if (status & GRUB_USB_HUB_STATUS_C_PORT_RESET) if (status & VasEBoot_USB_HUB_STATUS_C_PORT_RESET)
{ {
grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_OUT VasEBoot_usb_control_msg (dev, (VasEBoot_USB_REQTYPE_OUT
| GRUB_USB_REQTYPE_CLASS | VasEBoot_USB_REQTYPE_CLASS
| GRUB_USB_REQTYPE_TARGET_OTHER), | VasEBoot_USB_REQTYPE_TARGET_OTHER),
GRUB_USB_REQ_CLEAR_FEATURE, VasEBoot_USB_REQ_CLEAR_FEATURE,
GRUB_USB_HUB_FEATURE_C_PORT_RESET, i, 0, 0); VasEBoot_USB_HUB_FEATURE_C_PORT_RESET, i, 0, 0);
grub_boot_time ("Port %d reset", i); VasEBoot_boot_time ("Port %d reset", i);
if (status & GRUB_USB_HUB_STATUS_PORT_CONNECTED) if (status & VasEBoot_USB_HUB_STATUS_PORT_CONNECTED)
{ {
grub_usb_speed_t speed; VasEBoot_usb_speed_t speed;
grub_usb_device_t next_dev; VasEBoot_usb_device_t next_dev;
int split_hubport = 0; int split_hubport = 0;
int split_hubaddr = 0; int split_hubaddr = 0;
/* Determine the device speed. */ /* Determine the device speed. */
if (status & GRUB_USB_HUB_STATUS_PORT_LOWSPEED) if (status & VasEBoot_USB_HUB_STATUS_PORT_LOWSPEED)
speed = GRUB_USB_SPEED_LOW; speed = VasEBoot_USB_SPEED_LOW;
else else
{ {
if (status & GRUB_USB_HUB_STATUS_PORT_HIGHSPEED) if (status & VasEBoot_USB_HUB_STATUS_PORT_HIGHSPEED)
speed = GRUB_USB_SPEED_HIGH; speed = VasEBoot_USB_SPEED_HIGH;
else else
speed = GRUB_USB_SPEED_FULL; speed = VasEBoot_USB_SPEED_FULL;
} }
/* Wait a recovery time after reset, spec. says 10ms */ /* Wait a recovery time after reset, spec. says 10ms */
grub_millisleep (10); VasEBoot_millisleep (10);
/* Find correct values for SPLIT hubport and hubaddr */ /* Find correct values for SPLIT hubport and hubaddr */
if (speed == GRUB_USB_SPEED_HIGH) if (speed == VasEBoot_USB_SPEED_HIGH)
{ {
/* HIGH speed device needs not transaction translation */ /* HIGH speed device needs not transaction translation */
split_hubport = 0; split_hubport = 0;
@ -625,7 +625,7 @@ poll_nonroot_hub (grub_usb_device_t dev)
else else
/* FULL/LOW device needs hub port and hub address /* FULL/LOW device needs hub port and hub address
for transaction translation (if connected to EHCI) */ for transaction translation (if connected to EHCI) */
if (dev->speed == GRUB_USB_SPEED_HIGH) if (dev->speed == VasEBoot_USB_SPEED_HIGH)
{ {
/* This port is the first FULL/LOW speed port /* This port is the first FULL/LOW speed port
in the chain from root hub. Attached device in the chain from root hub. Attached device
@ -644,7 +644,7 @@ poll_nonroot_hub (grub_usb_device_t dev)
} }
/* Add the device and assign a device address to it. */ /* Add the device and assign a device address to it. */
next_dev = grub_usb_hub_add_dev (&dev->controller, speed, next_dev = VasEBoot_usb_hub_add_dev (&dev->controller, speed,
split_hubport, split_hubaddr); split_hubport, split_hubaddr);
if (dev->controller.dev->pending_reset) if (dev->controller.dev->pending_reset)
{ {
@ -658,16 +658,16 @@ poll_nonroot_hub (grub_usb_device_t dev)
/* If the device is a Hub, scan it for more devices. */ /* If the device is a Hub, scan it for more devices. */
if (next_dev->descdev.class == 0x09) if (next_dev->descdev.class == 0x09)
grub_usb_add_hub (next_dev); VasEBoot_usb_add_hub (next_dev);
} }
} }
} }
} }
void void
grub_usb_poll_devices (int wait_for_completion) VasEBoot_usb_poll_devices (int wait_for_completion)
{ {
struct grub_usb_hub *hub; struct VasEBoot_usb_hub *hub;
int i; int i;
for (hub = hubs; hub; hub = hub->next) for (hub = hubs; hub; hub = hub->next)
@ -676,13 +676,13 @@ grub_usb_poll_devices (int wait_for_completion)
/* No, it should be never changed, it should be constant. */ /* No, it should be never changed, it should be constant. */
for (i = 0; i < hub->nports; i++) for (i = 0; i < hub->nports; i++)
{ {
grub_usb_speed_t speed = GRUB_USB_SPEED_NONE; VasEBoot_usb_speed_t speed = VasEBoot_USB_SPEED_NONE;
int changed = 0; int changed = 0;
if (hub->controller->dev->pending_reset) if (hub->controller->dev->pending_reset)
{ {
/* Check for possible timeout */ /* Check for possible timeout */
if (grub_get_time_ms () > hub->controller->dev->pending_reset) if (VasEBoot_get_time_ms () > hub->controller->dev->pending_reset)
{ {
/* Something went wrong, reset device was not /* Something went wrong, reset device was not
* addressed properly, timeout happened */ * addressed properly, timeout happened */
@ -698,7 +698,7 @@ grub_usb_poll_devices (int wait_for_completion)
{ {
detach_device (hub->devices[i]); detach_device (hub->devices[i]);
hub->devices[i] = NULL; hub->devices[i] = NULL;
if (speed != GRUB_USB_SPEED_NONE) if (speed != VasEBoot_USB_SPEED_NONE)
attach_root_port (hub, i, speed); attach_root_port (hub, i, speed);
} }
} }
@ -709,9 +709,9 @@ grub_usb_poll_devices (int wait_for_completion)
rescan = 0; rescan = 0;
/* We should check changes of non-root hubs too. */ /* We should check changes of non-root hubs too. */
for (i = 0; i < GRUB_USBHUB_MAX_DEVICES; i++) for (i = 0; i < VasEBoot_USBHUB_MAX_DEVICES; i++)
{ {
grub_usb_device_t dev = grub_usb_devs[i]; VasEBoot_usb_device_t dev = VasEBoot_usb_devs[i];
if (dev && dev->descdev.class == 0x09) if (dev && dev->descdev.class == 0x09)
poll_nonroot_hub (dev); poll_nonroot_hub (dev);
@ -720,34 +720,34 @@ grub_usb_poll_devices (int wait_for_completion)
while (1) while (1)
{ {
int continue_waiting = 0; int continue_waiting = 0;
for (i = 0; i < GRUB_USBHUB_MAX_DEVICES; i++) for (i = 0; i < VasEBoot_USBHUB_MAX_DEVICES; i++)
{ {
grub_usb_device_t dev = grub_usb_devs[i]; VasEBoot_usb_device_t dev = VasEBoot_usb_devs[i];
if (dev && dev->descdev.class == 0x09) if (dev && dev->descdev.class == 0x09)
continue_waiting = continue_waiting || wait_power_nonroot_hub (dev); continue_waiting = continue_waiting || wait_power_nonroot_hub (dev);
} }
if (!continue_waiting) if (!continue_waiting)
break; break;
grub_millisleep (1); VasEBoot_millisleep (1);
} }
if (!(rescan || (npending && wait_for_completion))) if (!(rescan || (npending && wait_for_completion)))
break; break;
grub_millisleep (25); VasEBoot_millisleep (25);
} }
} }
int int
grub_usb_iterate (grub_usb_iterate_hook_t hook, void *hook_data) VasEBoot_usb_iterate (VasEBoot_usb_iterate_hook_t hook, void *hook_data)
{ {
int i; int i;
for (i = 0; i < GRUB_USBHUB_MAX_DEVICES; i++) for (i = 0; i < VasEBoot_USBHUB_MAX_DEVICES; i++)
{ {
if (grub_usb_devs[i]) if (VasEBoot_usb_devs[i])
{ {
if (hook (grub_usb_devs[i], hook_data)) if (hook (VasEBoot_usb_devs[i], hook_data))
return 1; return 1;
} }
} }

View File

@ -1,35 +1,35 @@
/* usbtrans.c - USB Transfers and Transactions. */ /* usbtrans.c - USB Transfers and Transactions. */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2008 Free Software Foundation, Inc. * Copyright (C) 2008 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/pci.h> #include <VasEBoot/pci.h>
#include <grub/mm.h> #include <VasEBoot/mm.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/usb.h> #include <VasEBoot/usb.h>
#include <grub/usbtrans.h> #include <VasEBoot/usbtrans.h>
#include <grub/time.h> #include <VasEBoot/time.h>
#include <grub/cache.h> #include <VasEBoot/cache.h>
static inline unsigned int static inline unsigned int
grub_usb_bulk_maxpacket (grub_usb_device_t dev, VasEBoot_usb_bulk_maxpacket (VasEBoot_usb_device_t dev,
struct grub_usb_desc_endp *endpoint) struct VasEBoot_usb_desc_endp *endpoint)
{ {
/* Use the maximum packet size given in the endpoint descriptor. */ /* Use the maximum packet size given in the endpoint descriptor. */
if (dev->initialized && endpoint && (unsigned int) endpoint->maxpacket) if (dev->initialized && endpoint && (unsigned int) endpoint->maxpacket)
@ -39,93 +39,93 @@ grub_usb_bulk_maxpacket (grub_usb_device_t dev,
} }
static grub_usb_err_t static VasEBoot_usb_err_t
grub_usb_execute_and_wait_transfer (grub_usb_device_t dev, VasEBoot_usb_execute_and_wait_transfer (VasEBoot_usb_device_t dev,
grub_usb_transfer_t transfer, VasEBoot_usb_transfer_t transfer,
int timeout, grub_size_t *actual) int timeout, VasEBoot_size_t *actual)
{ {
grub_usb_err_t err; VasEBoot_usb_err_t err;
grub_uint64_t endtime; VasEBoot_uint64_t endtime;
err = dev->controller.dev->setup_transfer (&dev->controller, transfer); err = dev->controller.dev->setup_transfer (&dev->controller, transfer);
if (err) if (err)
return err; return err;
/* endtime moved behind setup transfer to prevent false timeouts /* endtime moved behind setup transfer to prevent false timeouts
* while debugging... */ * while debugging... */
endtime = grub_get_time_ms () + timeout; endtime = VasEBoot_get_time_ms () + timeout;
while (1) while (1)
{ {
err = dev->controller.dev->check_transfer (&dev->controller, transfer, err = dev->controller.dev->check_transfer (&dev->controller, transfer,
actual); actual);
if (!err) if (!err)
return GRUB_USB_ERR_NONE; return VasEBoot_USB_ERR_NONE;
if (err != GRUB_USB_ERR_WAIT) if (err != VasEBoot_USB_ERR_WAIT)
return err; return err;
if (grub_get_time_ms () > endtime) if (VasEBoot_get_time_ms () > endtime)
{ {
err = dev->controller.dev->cancel_transfer (&dev->controller, err = dev->controller.dev->cancel_transfer (&dev->controller,
transfer); transfer);
if (err) if (err)
return err; return err;
return GRUB_USB_ERR_TIMEOUT; return VasEBoot_USB_ERR_TIMEOUT;
} }
grub_cpu_idle (); VasEBoot_cpu_idle ();
} }
} }
grub_usb_err_t VasEBoot_usb_err_t
grub_usb_control_msg (grub_usb_device_t dev, VasEBoot_usb_control_msg (VasEBoot_usb_device_t dev,
grub_uint8_t reqtype, VasEBoot_uint8_t reqtype,
grub_uint8_t request, VasEBoot_uint8_t request,
grub_uint16_t value, VasEBoot_uint16_t value,
grub_uint16_t index, VasEBoot_uint16_t index,
grub_size_t size0, char *data_in) VasEBoot_size_t size0, char *data_in)
{ {
int i; int i;
grub_usb_transfer_t transfer; VasEBoot_usb_transfer_t transfer;
int datablocks; int datablocks;
volatile struct grub_usb_packet_setup *setupdata; volatile struct VasEBoot_usb_packet_setup *setupdata;
grub_uint32_t setupdata_addr; VasEBoot_uint32_t setupdata_addr;
grub_usb_err_t err; VasEBoot_usb_err_t err;
unsigned int max; unsigned int max;
struct grub_pci_dma_chunk *data_chunk, *setupdata_chunk; struct VasEBoot_pci_dma_chunk *data_chunk, *setupdata_chunk;
volatile char *data; volatile char *data;
grub_uint32_t data_addr; VasEBoot_uint32_t data_addr;
grub_size_t size = size0; VasEBoot_size_t size = size0;
grub_size_t actual; VasEBoot_size_t actual;
/* FIXME: avoid allocation any kind of buffer in a first place. */ /* FIXME: avoid allocation any kind of buffer in a first place. */
data_chunk = grub_memalign_dma32 (128, size ? : 16); data_chunk = VasEBoot_memalign_dma32 (128, size ? : 16);
if (!data_chunk) if (!data_chunk)
return GRUB_USB_ERR_INTERNAL; return VasEBoot_USB_ERR_INTERNAL;
data = grub_dma_get_virt (data_chunk); data = VasEBoot_dma_get_virt (data_chunk);
data_addr = grub_dma_get_phys (data_chunk); data_addr = VasEBoot_dma_get_phys (data_chunk);
grub_memcpy ((char *) data, data_in, size); VasEBoot_memcpy ((char *) data, data_in, size);
grub_arch_sync_dma_caches (data, size); VasEBoot_arch_sync_dma_caches (data, size);
grub_dprintf ("usb", VasEBoot_dprintf ("usb",
"control: reqtype=0x%02x req=0x%02x val=0x%02x idx=0x%02x size=%lu\n", "control: reqtype=0x%02x req=0x%02x val=0x%02x idx=0x%02x size=%lu\n",
reqtype, request, value, index, (unsigned long)size); reqtype, request, value, index, (unsigned long)size);
/* Create a transfer. */ /* Create a transfer. */
transfer = grub_malloc (sizeof (*transfer)); transfer = VasEBoot_malloc (sizeof (*transfer));
if (! transfer) if (! transfer)
{ {
grub_dma_free (data_chunk); VasEBoot_dma_free (data_chunk);
return GRUB_USB_ERR_INTERNAL; return VasEBoot_USB_ERR_INTERNAL;
} }
setupdata_chunk = grub_memalign_dma32 (32, sizeof (*setupdata)); setupdata_chunk = VasEBoot_memalign_dma32 (32, sizeof (*setupdata));
if (! setupdata_chunk) if (! setupdata_chunk)
{ {
grub_free (transfer); VasEBoot_free (transfer);
grub_dma_free (data_chunk); VasEBoot_dma_free (data_chunk);
return GRUB_USB_ERR_INTERNAL; return VasEBoot_USB_ERR_INTERNAL;
} }
setupdata = grub_dma_get_virt (setupdata_chunk); setupdata = VasEBoot_dma_get_virt (setupdata_chunk);
setupdata_addr = grub_dma_get_phys (setupdata_chunk); setupdata_addr = VasEBoot_dma_get_phys (setupdata_chunk);
/* Determine the maximum packet size. */ /* Determine the maximum packet size. */
if (dev->descdev.maxsize0) if (dev->descdev.maxsize0)
@ -133,7 +133,7 @@ grub_usb_control_msg (grub_usb_device_t dev,
else else
max = 64; max = 64;
grub_dprintf ("usb", "control: transfer = %p, dev = %p\n", transfer, dev); VasEBoot_dprintf ("usb", "control: transfer = %p, dev = %p\n", transfer, dev);
datablocks = (size + max - 1) / max; datablocks = (size + max - 1) / max;
@ -143,19 +143,19 @@ grub_usb_control_msg (grub_usb_device_t dev,
transfer->size = size; /* XXX ? */ transfer->size = size; /* XXX ? */
transfer->endpoint = 0; transfer->endpoint = 0;
transfer->devaddr = dev->addr; transfer->devaddr = dev->addr;
transfer->type = GRUB_USB_TRANSACTION_TYPE_CONTROL; transfer->type = VasEBoot_USB_TRANSACTION_TYPE_CONTROL;
transfer->max = max; transfer->max = max;
transfer->dev = dev; transfer->dev = dev;
/* Allocate an array of transfer data structures. */ /* Allocate an array of transfer data structures. */
transfer->transactions = grub_malloc (transfer->transcnt transfer->transactions = VasEBoot_malloc (transfer->transcnt
* sizeof (struct grub_usb_transfer)); * sizeof (struct VasEBoot_usb_transfer));
if (! transfer->transactions) if (! transfer->transactions)
{ {
grub_free (transfer); VasEBoot_free (transfer);
grub_dma_free (setupdata_chunk); VasEBoot_dma_free (setupdata_chunk);
grub_dma_free (data_chunk); VasEBoot_dma_free (data_chunk);
return GRUB_USB_ERR_INTERNAL; return VasEBoot_USB_ERR_INTERNAL;
} }
/* Build a Setup packet. XXX: Endianness. */ /* Build a Setup packet. XXX: Endianness. */
@ -164,10 +164,10 @@ grub_usb_control_msg (grub_usb_device_t dev,
setupdata->value = value; setupdata->value = value;
setupdata->index = index; setupdata->index = index;
setupdata->length = size; setupdata->length = size;
grub_arch_sync_dma_caches (setupdata, sizeof (*setupdata)); VasEBoot_arch_sync_dma_caches (setupdata, sizeof (*setupdata));
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 = VasEBoot_USB_TRANSFER_TYPE_SETUP;
transfer->transactions[0].data = setupdata_addr; transfer->transactions[0].data = setupdata_addr;
transfer->transactions[0].toggle = 0; transfer->transactions[0].toggle = 0;
@ -175,16 +175,16 @@ grub_usb_control_msg (grub_usb_device_t dev,
transfers? */ transfers? */
for (i = 0; i < datablocks; i++) for (i = 0; i < datablocks; i++)
{ {
grub_usb_transaction_t tr = &transfer->transactions[i + 1]; VasEBoot_usb_transaction_t tr = &transfer->transactions[i + 1];
tr->size = (size > max) ? max : size; tr->size = (size > max) ? max : size;
/* Use the right most bit as the data toggle. Simple and /* Use the right most bit as the data toggle. Simple and
effective. */ effective. */
tr->toggle = !(i & 1); tr->toggle = !(i & 1);
if (reqtype & 128) if (reqtype & 128)
tr->pid = GRUB_USB_TRANSFER_TYPE_IN; tr->pid = VasEBoot_USB_TRANSFER_TYPE_IN;
else else
tr->pid = GRUB_USB_TRANSFER_TYPE_OUT; tr->pid = VasEBoot_USB_TRANSFER_TYPE_OUT;
tr->data = data_addr + i * max; tr->data = data_addr + i * max;
tr->preceding = i * max; tr->preceding = i * max;
size -= max; size -= max;
@ -194,76 +194,76 @@ grub_usb_control_msg (grub_usb_device_t dev,
transfer->transactions[datablocks + 1].size = 0; transfer->transactions[datablocks + 1].size = 0;
transfer->transactions[datablocks + 1].data = 0; transfer->transactions[datablocks + 1].data = 0;
if ((reqtype & 128) && datablocks) if ((reqtype & 128) && datablocks)
transfer->transactions[datablocks + 1].pid = GRUB_USB_TRANSFER_TYPE_OUT; transfer->transactions[datablocks + 1].pid = VasEBoot_USB_TRANSFER_TYPE_OUT;
else else
transfer->transactions[datablocks + 1].pid = GRUB_USB_TRANSFER_TYPE_IN; transfer->transactions[datablocks + 1].pid = VasEBoot_USB_TRANSFER_TYPE_IN;
transfer->transactions[datablocks + 1].toggle = 1; transfer->transactions[datablocks + 1].toggle = 1;
err = grub_usb_execute_and_wait_transfer (dev, transfer, 1000, &actual); err = VasEBoot_usb_execute_and_wait_transfer (dev, transfer, 1000, &actual);
grub_dprintf ("usb", "control: err=%d\n", err); VasEBoot_dprintf ("usb", "control: err=%d\n", err);
grub_free (transfer->transactions); VasEBoot_free (transfer->transactions);
grub_free (transfer); VasEBoot_free (transfer);
grub_dma_free (setupdata_chunk); VasEBoot_dma_free (setupdata_chunk);
grub_arch_sync_dma_caches (data, size0); VasEBoot_arch_sync_dma_caches (data, size0);
grub_memcpy (data_in, (char *) data, size0); VasEBoot_memcpy (data_in, (char *) data, size0);
grub_dma_free (data_chunk); VasEBoot_dma_free (data_chunk);
return err; return err;
} }
static grub_usb_transfer_t static VasEBoot_usb_transfer_t
grub_usb_bulk_setup_readwrite (grub_usb_device_t dev, VasEBoot_usb_bulk_setup_readwrite (VasEBoot_usb_device_t dev,
struct grub_usb_desc_endp *endpoint, struct VasEBoot_usb_desc_endp *endpoint,
grub_size_t size0, char *data_in, VasEBoot_size_t size0, char *data_in,
grub_transfer_type_t type) VasEBoot_transfer_type_t type)
{ {
int i; int i;
grub_usb_transfer_t transfer; VasEBoot_usb_transfer_t transfer;
int datablocks; int datablocks;
unsigned int max; unsigned int max;
volatile char *data; volatile char *data;
grub_uint32_t data_addr; VasEBoot_uint32_t data_addr;
struct grub_pci_dma_chunk *data_chunk; struct VasEBoot_pci_dma_chunk *data_chunk;
grub_size_t size = size0; VasEBoot_size_t size = size0;
int toggle = dev->toggle[endpoint->endp_addr]; int toggle = dev->toggle[endpoint->endp_addr];
grub_dprintf ("usb", "bulk: size=0x%02lx type=%d\n", (unsigned long) size, VasEBoot_dprintf ("usb", "bulk: size=0x%02lx type=%d\n", (unsigned long) size,
type); type);
/* FIXME: avoid allocation any kind of buffer in a first place. */ /* FIXME: avoid allocation any kind of buffer in a first place. */
data_chunk = grub_memalign_dma32 (128, size); data_chunk = VasEBoot_memalign_dma32 (128, size);
if (!data_chunk) if (!data_chunk)
return NULL; return NULL;
data = grub_dma_get_virt (data_chunk); data = VasEBoot_dma_get_virt (data_chunk);
data_addr = grub_dma_get_phys (data_chunk); data_addr = VasEBoot_dma_get_phys (data_chunk);
if (type == GRUB_USB_TRANSFER_TYPE_OUT) if (type == VasEBoot_USB_TRANSFER_TYPE_OUT)
{ {
grub_memcpy ((char *) data, data_in, size); VasEBoot_memcpy ((char *) data, data_in, size);
grub_arch_sync_dma_caches (data, size); VasEBoot_arch_sync_dma_caches (data, size);
} }
/* Create a transfer. */ /* Create a transfer. */
transfer = grub_malloc (sizeof (struct grub_usb_transfer)); transfer = VasEBoot_malloc (sizeof (struct VasEBoot_usb_transfer));
if (! transfer) if (! transfer)
{ {
grub_dma_free (data_chunk); VasEBoot_dma_free (data_chunk);
return NULL; return NULL;
} }
max = grub_usb_bulk_maxpacket (dev, endpoint); max = VasEBoot_usb_bulk_maxpacket (dev, endpoint);
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->endp_addr; transfer->endpoint = endpoint->endp_addr;
transfer->devaddr = dev->addr; transfer->devaddr = dev->addr;
transfer->type = GRUB_USB_TRANSACTION_TYPE_BULK; transfer->type = VasEBoot_USB_TRANSACTION_TYPE_BULK;
transfer->dir = type; transfer->dir = type;
transfer->max = max; transfer->max = max;
transfer->dev = dev; transfer->dev = dev;
@ -272,19 +272,19 @@ grub_usb_bulk_setup_readwrite (grub_usb_device_t dev,
transfer->data = data_in; transfer->data = data_in;
/* Allocate an array of transfer data structures. */ /* Allocate an array of transfer data structures. */
transfer->transactions = grub_malloc (transfer->transcnt transfer->transactions = VasEBoot_malloc (transfer->transcnt
* sizeof (struct grub_usb_transfer)); * sizeof (struct VasEBoot_usb_transfer));
if (! transfer->transactions) if (! transfer->transactions)
{ {
grub_free (transfer); VasEBoot_free (transfer);
grub_dma_free (data_chunk); VasEBoot_dma_free (data_chunk);
return NULL; return NULL;
} }
/* Set up all transfers. */ /* Set up all transfers. */
for (i = 0; i < datablocks; i++) for (i = 0; i < datablocks; i++)
{ {
grub_usb_transaction_t tr = &transfer->transactions[i]; VasEBoot_usb_transaction_t tr = &transfer->transactions[i];
tr->size = (size > max) ? max : size; tr->size = (size > max) ? max : size;
/* XXX: Use the right most bit as the data toggle. Simple and /* XXX: Use the right most bit as the data toggle. Simple and
@ -300,9 +300,9 @@ grub_usb_bulk_setup_readwrite (grub_usb_device_t dev,
} }
static void static void
grub_usb_bulk_finish_readwrite (grub_usb_transfer_t transfer) VasEBoot_usb_bulk_finish_readwrite (VasEBoot_usb_transfer_t transfer)
{ {
grub_usb_device_t dev = transfer->dev; VasEBoot_usb_device_t dev = transfer->dev;
int toggle = dev->toggle[transfer->endpoint]; int toggle = dev->toggle[transfer->endpoint];
/* We must remember proper toggle value even if some transactions /* We must remember proper toggle value even if some transactions
@ -312,59 +312,59 @@ grub_usb_bulk_finish_readwrite (grub_usb_transfer_t transfer)
toggle = transfer->transactions[transfer->last_trans].toggle ? 0 : 1; toggle = transfer->transactions[transfer->last_trans].toggle ? 0 : 1;
else else
toggle = dev->toggle[transfer->endpoint]; /* Nothing done, take original */ toggle = dev->toggle[transfer->endpoint]; /* Nothing done, take original */
grub_dprintf ("usb", "bulk: toggle=%d\n", toggle); VasEBoot_dprintf ("usb", "bulk: toggle=%d\n", toggle);
dev->toggle[transfer->endpoint] = toggle; dev->toggle[transfer->endpoint] = toggle;
if (transfer->dir == GRUB_USB_TRANSFER_TYPE_IN) if (transfer->dir == VasEBoot_USB_TRANSFER_TYPE_IN)
{ {
grub_arch_sync_dma_caches (grub_dma_get_virt (transfer->data_chunk), VasEBoot_arch_sync_dma_caches (VasEBoot_dma_get_virt (transfer->data_chunk),
transfer->size + 1); transfer->size + 1);
grub_memcpy (transfer->data, (void *) VasEBoot_memcpy (transfer->data, (void *)
grub_dma_get_virt (transfer->data_chunk), VasEBoot_dma_get_virt (transfer->data_chunk),
transfer->size + 1); transfer->size + 1);
} }
grub_free (transfer->transactions); VasEBoot_free (transfer->transactions);
grub_dma_free (transfer->data_chunk); VasEBoot_dma_free (transfer->data_chunk);
grub_free (transfer); VasEBoot_free (transfer);
} }
static grub_usb_err_t static VasEBoot_usb_err_t
grub_usb_bulk_readwrite (grub_usb_device_t dev, VasEBoot_usb_bulk_readwrite (VasEBoot_usb_device_t dev,
struct grub_usb_desc_endp *endpoint, struct VasEBoot_usb_desc_endp *endpoint,
grub_size_t size0, char *data_in, VasEBoot_size_t size0, char *data_in,
grub_transfer_type_t type, int timeout, VasEBoot_transfer_type_t type, int timeout,
grub_size_t *actual) VasEBoot_size_t *actual)
{ {
grub_usb_err_t err; VasEBoot_usb_err_t err;
grub_usb_transfer_t transfer; VasEBoot_usb_transfer_t transfer;
transfer = grub_usb_bulk_setup_readwrite (dev, endpoint, size0, transfer = VasEBoot_usb_bulk_setup_readwrite (dev, endpoint, size0,
data_in, type); data_in, type);
if (!transfer) if (!transfer)
return GRUB_USB_ERR_INTERNAL; return VasEBoot_USB_ERR_INTERNAL;
err = grub_usb_execute_and_wait_transfer (dev, transfer, timeout, actual); err = VasEBoot_usb_execute_and_wait_transfer (dev, transfer, timeout, actual);
grub_usb_bulk_finish_readwrite (transfer); VasEBoot_usb_bulk_finish_readwrite (transfer);
return err; return err;
} }
static grub_usb_err_t static VasEBoot_usb_err_t
grub_usb_bulk_readwrite_packetize (grub_usb_device_t dev, VasEBoot_usb_bulk_readwrite_packetize (VasEBoot_usb_device_t dev,
struct grub_usb_desc_endp *endpoint, struct VasEBoot_usb_desc_endp *endpoint,
grub_transfer_type_t type, VasEBoot_transfer_type_t type,
grub_size_t size, char *data) VasEBoot_size_t size, char *data)
{ {
grub_size_t actual, transferred; VasEBoot_size_t actual, transferred;
grub_usb_err_t err = GRUB_USB_ERR_NONE; VasEBoot_usb_err_t err = VasEBoot_USB_ERR_NONE;
grub_size_t current_size, position; VasEBoot_size_t current_size, position;
grub_size_t max_bulk_transfer_len = MAX_USB_TRANSFER_LEN; VasEBoot_size_t max_bulk_transfer_len = MAX_USB_TRANSFER_LEN;
grub_size_t max; VasEBoot_size_t max;
if (dev->controller.dev->max_bulk_tds) if (dev->controller.dev->max_bulk_tds)
{ {
max = grub_usb_bulk_maxpacket (dev, endpoint); max = VasEBoot_usb_bulk_maxpacket (dev, endpoint);
/* Calculate max. possible length of bulk transfer */ /* Calculate max. possible length of bulk transfer */
max_bulk_transfer_len = dev->controller.dev->max_bulk_tds * max; max_bulk_transfer_len = dev->controller.dev->max_bulk_tds * max;
@ -376,63 +376,63 @@ grub_usb_bulk_readwrite_packetize (grub_usb_device_t dev,
current_size = size - position; current_size = size - position;
if (current_size >= max_bulk_transfer_len) if (current_size >= max_bulk_transfer_len)
current_size = max_bulk_transfer_len; current_size = max_bulk_transfer_len;
err = grub_usb_bulk_readwrite (dev, endpoint, current_size, err = VasEBoot_usb_bulk_readwrite (dev, endpoint, current_size,
&data[position], type, 1000, &actual); &data[position], type, 1000, &actual);
transferred += actual; transferred += actual;
if (err || (current_size != actual)) break; if (err || (current_size != actual)) break;
} }
if (!err && transferred != size) if (!err && transferred != size)
err = GRUB_USB_ERR_DATA; err = VasEBoot_USB_ERR_DATA;
return err; return err;
} }
grub_usb_err_t VasEBoot_usb_err_t
grub_usb_bulk_write (grub_usb_device_t dev, VasEBoot_usb_bulk_write (VasEBoot_usb_device_t dev,
struct grub_usb_desc_endp *endpoint, struct VasEBoot_usb_desc_endp *endpoint,
grub_size_t size, char *data) VasEBoot_size_t size, char *data)
{ {
return grub_usb_bulk_readwrite_packetize (dev, endpoint, return VasEBoot_usb_bulk_readwrite_packetize (dev, endpoint,
GRUB_USB_TRANSFER_TYPE_OUT, VasEBoot_USB_TRANSFER_TYPE_OUT,
size, data); size, data);
} }
grub_usb_err_t VasEBoot_usb_err_t
grub_usb_bulk_read (grub_usb_device_t dev, VasEBoot_usb_bulk_read (VasEBoot_usb_device_t dev,
struct grub_usb_desc_endp *endpoint, struct VasEBoot_usb_desc_endp *endpoint,
grub_size_t size, char *data) VasEBoot_size_t size, char *data)
{ {
return grub_usb_bulk_readwrite_packetize (dev, endpoint, return VasEBoot_usb_bulk_readwrite_packetize (dev, endpoint,
GRUB_USB_TRANSFER_TYPE_IN, VasEBoot_USB_TRANSFER_TYPE_IN,
size, data); size, data);
} }
grub_usb_err_t VasEBoot_usb_err_t
grub_usb_check_transfer (grub_usb_transfer_t transfer, grub_size_t *actual) VasEBoot_usb_check_transfer (VasEBoot_usb_transfer_t transfer, VasEBoot_size_t *actual)
{ {
grub_usb_err_t err; VasEBoot_usb_err_t err;
grub_usb_device_t dev = transfer->dev; VasEBoot_usb_device_t dev = transfer->dev;
err = dev->controller.dev->check_transfer (&dev->controller, transfer, err = dev->controller.dev->check_transfer (&dev->controller, transfer,
actual); actual);
if (err == GRUB_USB_ERR_WAIT) if (err == VasEBoot_USB_ERR_WAIT)
return err; return err;
grub_usb_bulk_finish_readwrite (transfer); VasEBoot_usb_bulk_finish_readwrite (transfer);
return err; return err;
} }
grub_usb_transfer_t VasEBoot_usb_transfer_t
grub_usb_bulk_read_background (grub_usb_device_t dev, VasEBoot_usb_bulk_read_background (VasEBoot_usb_device_t dev,
struct grub_usb_desc_endp *endpoint, struct VasEBoot_usb_desc_endp *endpoint,
grub_size_t size, void *data) VasEBoot_size_t size, void *data)
{ {
grub_usb_err_t err; VasEBoot_usb_err_t err;
grub_usb_transfer_t transfer; VasEBoot_usb_transfer_t transfer;
transfer = grub_usb_bulk_setup_readwrite (dev, endpoint, size, transfer = VasEBoot_usb_bulk_setup_readwrite (dev, endpoint, size,
data, GRUB_USB_TRANSFER_TYPE_IN); data, VasEBoot_USB_TRANSFER_TYPE_IN);
if (!transfer) if (!transfer)
return NULL; return NULL;
@ -444,19 +444,19 @@ grub_usb_bulk_read_background (grub_usb_device_t dev,
} }
void void
grub_usb_cancel_transfer (grub_usb_transfer_t transfer) VasEBoot_usb_cancel_transfer (VasEBoot_usb_transfer_t transfer)
{ {
grub_usb_device_t dev = transfer->dev; VasEBoot_usb_device_t dev = transfer->dev;
dev->controller.dev->cancel_transfer (&dev->controller, transfer); dev->controller.dev->cancel_transfer (&dev->controller, transfer);
grub_errno = GRUB_ERR_NONE; VasEBoot_errno = VasEBoot_ERR_NONE;
} }
grub_usb_err_t VasEBoot_usb_err_t
grub_usb_bulk_read_extended (grub_usb_device_t dev, VasEBoot_usb_bulk_read_extended (VasEBoot_usb_device_t dev,
struct grub_usb_desc_endp *endpoint, struct VasEBoot_usb_desc_endp *endpoint,
grub_size_t size, char *data, VasEBoot_size_t size, char *data,
int timeout, grub_size_t *actual) int timeout, VasEBoot_size_t *actual)
{ {
return grub_usb_bulk_readwrite (dev, endpoint, size, data, return VasEBoot_usb_bulk_readwrite (dev, endpoint, size, data,
GRUB_USB_TRANSFER_TYPE_IN, timeout, actual); VasEBoot_USB_TRANSFER_TYPE_IN, timeout, actual);
} }

View File

@ -1,43 +1,43 @@
/* acpi.c - modify acpi tables. */ /* acpi.c - modify acpi tables. */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc. * Copyright (C) 2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/extcmd.h> #include <VasEBoot/extcmd.h>
#include <grub/file.h> #include <VasEBoot/file.h>
#include <grub/disk.h> #include <VasEBoot/disk.h>
#include <grub/term.h> #include <VasEBoot/term.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/acpi.h> #include <VasEBoot/acpi.h>
#include <grub/mm.h> #include <VasEBoot/mm.h>
#include <grub/memory.h> #include <VasEBoot/memory.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
#ifdef GRUB_MACHINE_EFI #ifdef VasEBoot_MACHINE_EFI
#include <grub/efi/efi.h> #include <VasEBoot/efi/efi.h>
#include <grub/efi/api.h> #include <VasEBoot/efi/api.h>
#endif #endif
#pragma GCC diagnostic ignored "-Wcast-align" #pragma GCC diagnostic ignored "-Wcast-align"
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static const struct grub_arg_option options[] = { static const struct VasEBoot_arg_option options[] = {
{"exclude", 'x', 0, {"exclude", 'x', 0,
N_("Don't load host tables specified by comma-separated list."), N_("Don't load host tables specified by comma-separated list."),
0, ARG_TYPE_STRING}, 0, ARG_TYPE_STRING},
@ -56,7 +56,7 @@ static const struct grub_arg_option options[] = {
N_("Set creator revision of RSDP, XSDT and RSDT."), 0, ARG_TYPE_INT}, N_("Set creator revision of RSDP, XSDT and RSDT."), 0, ARG_TYPE_INT},
/* TRANSLATORS: "hangs" here is a noun, not a verb. */ /* TRANSLATORS: "hangs" here is a noun, not a verb. */
{"no-ebda", 'e', 0, N_("Don't update EBDA. May fix failures or hangs on some " {"no-ebda", 'e', 0, N_("Don't update EBDA. May fix failures or hangs on some "
"BIOSes but makes it ineffective with OS not receiving RSDP from GRUB."), "BIOSes but makes it ineffective with OS not receiving RSDP from VasEBoot."),
0, ARG_TYPE_NONE}, 0, ARG_TYPE_NONE},
{0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0}
}; };
@ -69,13 +69,13 @@ static char root_oemid[6];
/* OEMTABLE of the same tables. */ /* OEMTABLE of the same tables. */
static char root_oemtable[8]; static char root_oemtable[8];
/* OEMREVISION of the same tables. */ /* OEMREVISION of the same tables. */
static grub_uint32_t root_oemrev; static VasEBoot_uint32_t root_oemrev;
/* CreatorID of the same tables. */ /* CreatorID of the same tables. */
static char root_creator_id[4]; static char root_creator_id[4];
/* CreatorRevision of the same tables. */ /* CreatorRevision of the same tables. */
static grub_uint32_t root_creator_rev; static VasEBoot_uint32_t root_creator_rev;
static struct grub_acpi_rsdp_v10 *rsdpv1_new = 0; static struct VasEBoot_acpi_rsdp_v10 *rsdpv1_new = 0;
static struct grub_acpi_rsdp_v20 *rsdpv2_new = 0; static struct VasEBoot_acpi_rsdp_v20 *rsdpv2_new = 0;
static char *playground = 0, *playground_ptr = 0; static char *playground = 0, *playground_ptr = 0;
static int playground_size = 0; static int playground_size = 0;
@ -83,7 +83,7 @@ static int playground_size = 0;
struct efiemu_acpi_table struct efiemu_acpi_table
{ {
void *addr; void *addr;
grub_size_t size; VasEBoot_size_t size;
struct efiemu_acpi_table *next; struct efiemu_acpi_table *next;
}; };
static struct efiemu_acpi_table *acpi_tables = 0; static struct efiemu_acpi_table *acpi_tables = 0;
@ -94,35 +94,35 @@ static void *table_dsdt = 0;
static void *rsdt_addr = 0; static void *rsdt_addr = 0;
/* Allocation handles for different tables. */ /* Allocation handles for different tables. */
static grub_size_t dsdt_size = 0; static VasEBoot_size_t dsdt_size = 0;
/* Address of original FACS. */ /* Address of original FACS. */
static grub_uint32_t facs_addr = 0; static VasEBoot_uint32_t facs_addr = 0;
struct grub_acpi_rsdp_v20 * struct VasEBoot_acpi_rsdp_v20 *
grub_acpi_get_rsdpv2 (void) VasEBoot_acpi_get_rsdpv2 (void)
{ {
if (rsdpv2_new) if (rsdpv2_new)
return rsdpv2_new; return rsdpv2_new;
if (rsdpv1_new) if (rsdpv1_new)
return 0; return 0;
return grub_machine_acpi_get_rsdpv2 (); return VasEBoot_machine_acpi_get_rsdpv2 ();
} }
struct grub_acpi_rsdp_v10 * struct VasEBoot_acpi_rsdp_v10 *
grub_acpi_get_rsdpv1 (void) VasEBoot_acpi_get_rsdpv1 (void)
{ {
if (rsdpv1_new) if (rsdpv1_new)
return rsdpv1_new; return rsdpv1_new;
if (rsdpv2_new) if (rsdpv2_new)
return 0; return 0;
return grub_machine_acpi_get_rsdpv1 (); return VasEBoot_machine_acpi_get_rsdpv1 ();
} }
#if defined (__i386__) || defined (__x86_64__) #if defined (__i386__) || defined (__x86_64__)
static inline int static inline int
iszero (grub_uint8_t *reg, int size) iszero (VasEBoot_uint8_t *reg, int size)
{ {
int i; int i;
for (i = 0; i < size; i++) for (i = 0; i < size; i++)
@ -131,20 +131,20 @@ iszero (grub_uint8_t *reg, int size)
return 1; return 1;
} }
/* Context for grub_acpi_create_ebda. */ /* Context for VasEBoot_acpi_create_ebda. */
struct grub_acpi_create_ebda_ctx { struct VasEBoot_acpi_create_ebda_ctx {
int ebda_len; int ebda_len;
grub_uint64_t highestlow; VasEBoot_uint64_t highestlow;
}; };
/* Helper for grub_acpi_create_ebda. */ /* Helper for VasEBoot_acpi_create_ebda. */
static int static int
find_hook (grub_uint64_t start, grub_uint64_t size, grub_memory_type_t type, find_hook (VasEBoot_uint64_t start, VasEBoot_uint64_t size, VasEBoot_memory_type_t type,
void *data) void *data)
{ {
struct grub_acpi_create_ebda_ctx *ctx = data; struct VasEBoot_acpi_create_ebda_ctx *ctx = data;
grub_uint64_t end = start + size; VasEBoot_uint64_t end = start + size;
if (type != GRUB_MEMORY_AVAILABLE) if (type != VasEBoot_MEMORY_AVAILABLE)
return 0; return 0;
if (end > 0x100000) if (end > 0x100000)
end = 0x100000; end = 0x100000;
@ -154,71 +154,71 @@ find_hook (grub_uint64_t start, grub_uint64_t size, grub_memory_type_t type,
return 0; return 0;
} }
grub_err_t VasEBoot_err_t
grub_acpi_create_ebda (void) VasEBoot_acpi_create_ebda (void)
{ {
struct grub_acpi_create_ebda_ctx ctx = { struct VasEBoot_acpi_create_ebda_ctx ctx = {
.highestlow = 0 .highestlow = 0
}; };
int ebda_kb_len = 0; int ebda_kb_len = 0;
int mmapregion = 0; int mmapregion = 0;
grub_uint8_t *ebda, *v1inebda = 0, *v2inebda = 0; VasEBoot_uint8_t *ebda, *v1inebda = 0, *v2inebda = 0;
grub_uint8_t *targetebda, *target; VasEBoot_uint8_t *targetebda, *target;
struct grub_acpi_rsdp_v10 *v1; struct VasEBoot_acpi_rsdp_v10 *v1;
struct grub_acpi_rsdp_v20 *v2; struct VasEBoot_acpi_rsdp_v20 *v2;
ebda = (grub_uint8_t *) (grub_addr_t) ((*((grub_uint16_t *)0x40e)) << 4); ebda = (VasEBoot_uint8_t *) (VasEBoot_addr_t) ((*((VasEBoot_uint16_t *)0x40e)) << 4);
grub_dprintf ("acpi", "EBDA @%p\n", ebda); VasEBoot_dprintf ("acpi", "EBDA @%p\n", ebda);
if (ebda) if (ebda)
ebda_kb_len = *(grub_uint16_t *) ebda; ebda_kb_len = *(VasEBoot_uint16_t *) ebda;
grub_dprintf ("acpi", "EBDA length 0x%x\n", ebda_kb_len); VasEBoot_dprintf ("acpi", "EBDA length 0x%x\n", ebda_kb_len);
if (ebda_kb_len > 16) if (ebda_kb_len > 16)
ebda_kb_len = 0; ebda_kb_len = 0;
ctx.ebda_len = (ebda_kb_len + 1) << 10; ctx.ebda_len = (ebda_kb_len + 1) << 10;
/* FIXME: use low-memory mm allocation once it's available. */ /* FIXME: use low-memory mm allocation once it's available. */
grub_mmap_iterate (find_hook, &ctx); VasEBoot_mmap_iterate (find_hook, &ctx);
targetebda = (grub_uint8_t *) (grub_addr_t) ctx.highestlow; targetebda = (VasEBoot_uint8_t *) (VasEBoot_addr_t) ctx.highestlow;
grub_dprintf ("acpi", "creating ebda @%llx\n", VasEBoot_dprintf ("acpi", "creating ebda @%llx\n",
(unsigned long long) ctx.highestlow); (unsigned long long) ctx.highestlow);
if (! ctx.highestlow) if (! ctx.highestlow)
return grub_error (GRUB_ERR_OUT_OF_MEMORY, return VasEBoot_error (VasEBoot_ERR_OUT_OF_MEMORY,
"couldn't find space for the new EBDA"); "couldn't find space for the new EBDA");
mmapregion = grub_mmap_register ((grub_addr_t) targetebda, ctx.ebda_len, mmapregion = VasEBoot_mmap_register ((VasEBoot_addr_t) targetebda, ctx.ebda_len,
GRUB_MEMORY_RESERVED); VasEBoot_MEMORY_RESERVED);
if (! mmapregion) if (! mmapregion)
return grub_errno; return VasEBoot_errno;
/* XXX: EBDA is unstandardized, so this implementation is heuristical. */ /* XXX: EBDA is unstandardized, so this implementation is heuristical. */
if (ebda_kb_len) if (ebda_kb_len)
grub_memcpy (targetebda, ebda, 0x400); VasEBoot_memcpy (targetebda, ebda, 0x400);
else else
grub_memset (targetebda, 0, 0x400); VasEBoot_memset (targetebda, 0, 0x400);
*((grub_uint16_t *) targetebda) = ebda_kb_len + 1; *((VasEBoot_uint16_t *) targetebda) = ebda_kb_len + 1;
target = targetebda; target = targetebda;
v1 = grub_acpi_get_rsdpv1 (); v1 = VasEBoot_acpi_get_rsdpv1 ();
v2 = grub_acpi_get_rsdpv2 (); v2 = VasEBoot_acpi_get_rsdpv2 ();
if (v2 && v2->length > 40) if (v2 && v2->length > 40)
v2 = 0; v2 = 0;
/* First try to replace already existing rsdp. */ /* First try to replace already existing rsdp. */
if (v2) if (v2)
{ {
grub_dprintf ("acpi", "Scanning EBDA for old rsdpv2\n"); VasEBoot_dprintf ("acpi", "Scanning EBDA for old rsdpv2\n");
for (; target < targetebda + 0x400 - v2->length; target += 0x10) for (; target < targetebda + 0x400 - v2->length; target += 0x10)
if (grub_memcmp (target, GRUB_RSDP_SIGNATURE, GRUB_RSDP_SIGNATURE_SIZE) == 0 if (VasEBoot_memcmp (target, VasEBoot_RSDP_SIGNATURE, VasEBoot_RSDP_SIGNATURE_SIZE) == 0
&& grub_byte_checksum (target, && VasEBoot_byte_checksum (target,
sizeof (struct grub_acpi_rsdp_v10)) == 0 sizeof (struct VasEBoot_acpi_rsdp_v10)) == 0
&& ((struct grub_acpi_rsdp_v10 *) target)->revision != 0 && ((struct VasEBoot_acpi_rsdp_v10 *) target)->revision != 0
&& ((struct grub_acpi_rsdp_v20 *) target)->length <= v2->length) && ((struct VasEBoot_acpi_rsdp_v20 *) target)->length <= v2->length)
{ {
grub_memcpy (target, v2, v2->length); VasEBoot_memcpy (target, v2, v2->length);
grub_dprintf ("acpi", "Copying rsdpv2 to %p\n", target); VasEBoot_dprintf ("acpi", "Copying rsdpv2 to %p\n", target);
v2inebda = target; v2inebda = target;
target += v2->length; target += v2->length;
target = (grub_uint8_t *) ALIGN_UP((grub_addr_t) target, 16); target = (VasEBoot_uint8_t *) ALIGN_UP((VasEBoot_addr_t) target, 16);
v2 = 0; v2 = 0;
break; break;
} }
@ -226,18 +226,18 @@ grub_acpi_create_ebda (void)
if (v1) if (v1)
{ {
grub_dprintf ("acpi", "Scanning EBDA for old rsdpv1\n"); VasEBoot_dprintf ("acpi", "Scanning EBDA for old rsdpv1\n");
for (; target < targetebda + 0x400 - sizeof (struct grub_acpi_rsdp_v10); for (; target < targetebda + 0x400 - sizeof (struct VasEBoot_acpi_rsdp_v10);
target += 0x10) target += 0x10)
if (grub_memcmp (target, GRUB_RSDP_SIGNATURE, GRUB_RSDP_SIGNATURE_SIZE) == 0 if (VasEBoot_memcmp (target, VasEBoot_RSDP_SIGNATURE, VasEBoot_RSDP_SIGNATURE_SIZE) == 0
&& grub_byte_checksum (target, && VasEBoot_byte_checksum (target,
sizeof (struct grub_acpi_rsdp_v10)) == 0) sizeof (struct VasEBoot_acpi_rsdp_v10)) == 0)
{ {
grub_memcpy (target, v1, sizeof (struct grub_acpi_rsdp_v10)); VasEBoot_memcpy (target, v1, sizeof (struct VasEBoot_acpi_rsdp_v10));
grub_dprintf ("acpi", "Copying rsdpv1 to %p\n", target); VasEBoot_dprintf ("acpi", "Copying rsdpv1 to %p\n", target);
v1inebda = target; v1inebda = target;
target += sizeof (struct grub_acpi_rsdp_v10); target += sizeof (struct VasEBoot_acpi_rsdp_v10);
target = (grub_uint8_t *) ALIGN_UP((grub_addr_t) target, 16); target = (VasEBoot_uint8_t *) ALIGN_UP((VasEBoot_addr_t) target, 16);
v1 = 0; v1 = 0;
break; break;
} }
@ -248,15 +248,15 @@ grub_acpi_create_ebda (void)
/* Try contiguous zeros. */ /* Try contiguous zeros. */
if (v2) if (v2)
{ {
grub_dprintf ("acpi", "Scanning EBDA for block of zeros\n"); VasEBoot_dprintf ("acpi", "Scanning EBDA for block of zeros\n");
for (; target < targetebda + 0x400 - v2->length; target += 0x10) for (; target < targetebda + 0x400 - v2->length; target += 0x10)
if (iszero (target, v2->length)) if (iszero (target, v2->length))
{ {
grub_dprintf ("acpi", "Copying rsdpv2 to %p\n", target); VasEBoot_dprintf ("acpi", "Copying rsdpv2 to %p\n", target);
grub_memcpy (target, v2, v2->length); VasEBoot_memcpy (target, v2, v2->length);
v2inebda = target; v2inebda = target;
target += v2->length; target += v2->length;
target = (grub_uint8_t *) ALIGN_UP((grub_addr_t) target, 16); target = (VasEBoot_uint8_t *) ALIGN_UP((VasEBoot_addr_t) target, 16);
v2 = 0; v2 = 0;
break; break;
} }
@ -264,16 +264,16 @@ grub_acpi_create_ebda (void)
if (v1) if (v1)
{ {
grub_dprintf ("acpi", "Scanning EBDA for block of zeros\n"); VasEBoot_dprintf ("acpi", "Scanning EBDA for block of zeros\n");
for (; target < targetebda + 0x400 - sizeof (struct grub_acpi_rsdp_v10); for (; target < targetebda + 0x400 - sizeof (struct VasEBoot_acpi_rsdp_v10);
target += 0x10) target += 0x10)
if (iszero (target, sizeof (struct grub_acpi_rsdp_v10))) if (iszero (target, sizeof (struct VasEBoot_acpi_rsdp_v10)))
{ {
grub_dprintf ("acpi", "Copying rsdpv1 to %p\n", target); VasEBoot_dprintf ("acpi", "Copying rsdpv1 to %p\n", target);
grub_memcpy (target, v1, sizeof (struct grub_acpi_rsdp_v10)); VasEBoot_memcpy (target, v1, sizeof (struct VasEBoot_acpi_rsdp_v10));
v1inebda = target; v1inebda = target;
target += sizeof (struct grub_acpi_rsdp_v10); target += sizeof (struct VasEBoot_acpi_rsdp_v10);
target = (grub_uint8_t *) ALIGN_UP((grub_addr_t) target, 16); target = (VasEBoot_uint8_t *) ALIGN_UP((VasEBoot_addr_t) target, 16);
v1 = 0; v1 = 0;
break; break;
} }
@ -281,26 +281,26 @@ grub_acpi_create_ebda (void)
if (v1 || v2) if (v1 || v2)
{ {
grub_mmap_unregister (mmapregion); VasEBoot_mmap_unregister (mmapregion);
return grub_error (GRUB_ERR_OUT_OF_MEMORY, return VasEBoot_error (VasEBoot_ERR_OUT_OF_MEMORY,
"couldn't find suitable spot in EBDA"); "couldn't find suitable spot in EBDA");
} }
/* Remove any other RSDT. */ /* Remove any other RSDT. */
for (target = targetebda; for (target = targetebda;
target < targetebda + 0x400 - sizeof (struct grub_acpi_rsdp_v10); target < targetebda + 0x400 - sizeof (struct VasEBoot_acpi_rsdp_v10);
target += 0x10) target += 0x10)
if (grub_memcmp (target, GRUB_RSDP_SIGNATURE, GRUB_RSDP_SIGNATURE_SIZE) == 0 if (VasEBoot_memcmp (target, VasEBoot_RSDP_SIGNATURE, VasEBoot_RSDP_SIGNATURE_SIZE) == 0
&& grub_byte_checksum (target, && VasEBoot_byte_checksum (target,
sizeof (struct grub_acpi_rsdp_v10)) == 0 sizeof (struct VasEBoot_acpi_rsdp_v10)) == 0
&& target != v1inebda && target != v2inebda) && target != v1inebda && target != v2inebda)
*target = 0; *target = 0;
grub_dprintf ("acpi", "Switching EBDA\n"); VasEBoot_dprintf ("acpi", "Switching EBDA\n");
(*((grub_uint16_t *) 0x40e)) = ((grub_addr_t) targetebda) >> 4; (*((VasEBoot_uint16_t *) 0x40e)) = ((VasEBoot_addr_t) targetebda) >> 4;
grub_dprintf ("acpi", "EBDA switched\n"); VasEBoot_dprintf ("acpi", "EBDA switched\n");
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
} }
#endif #endif
@ -309,44 +309,44 @@ static void
setup_common_tables (void) setup_common_tables (void)
{ {
struct efiemu_acpi_table *cur; struct efiemu_acpi_table *cur;
struct grub_acpi_table_header *rsdt; struct VasEBoot_acpi_table_header *rsdt;
grub_uint32_t *rsdt_entry; VasEBoot_uint32_t *rsdt_entry;
int numoftables; int numoftables;
/* Treat DSDT. */ /* Treat DSDT. */
grub_memcpy (playground_ptr, table_dsdt, dsdt_size); VasEBoot_memcpy (playground_ptr, table_dsdt, dsdt_size);
grub_free (table_dsdt); VasEBoot_free (table_dsdt);
table_dsdt = playground_ptr; table_dsdt = playground_ptr;
playground_ptr += dsdt_size; playground_ptr += dsdt_size;
/* Treat other tables. */ /* Treat other tables. */
for (cur = acpi_tables; cur; cur = cur->next) for (cur = acpi_tables; cur; cur = cur->next)
{ {
struct grub_acpi_fadt *fadt; struct VasEBoot_acpi_fadt *fadt;
grub_memcpy (playground_ptr, cur->addr, cur->size); VasEBoot_memcpy (playground_ptr, cur->addr, cur->size);
grub_free (cur->addr); VasEBoot_free (cur->addr);
cur->addr = playground_ptr; cur->addr = playground_ptr;
playground_ptr += cur->size; playground_ptr += cur->size;
/* If it's FADT correct DSDT and FACS addresses. */ /* If it's FADT correct DSDT and FACS addresses. */
fadt = (struct grub_acpi_fadt *) cur->addr; fadt = (struct VasEBoot_acpi_fadt *) cur->addr;
if (grub_memcmp (fadt->hdr.signature, GRUB_ACPI_FADT_SIGNATURE, if (VasEBoot_memcmp (fadt->hdr.signature, VasEBoot_ACPI_FADT_SIGNATURE,
sizeof (fadt->hdr.signature)) == 0) sizeof (fadt->hdr.signature)) == 0)
{ {
fadt->dsdt_addr = (grub_addr_t) table_dsdt; fadt->dsdt_addr = (VasEBoot_addr_t) table_dsdt;
fadt->facs_addr = facs_addr; fadt->facs_addr = facs_addr;
/* Does a revision 2 exist at all? */ /* Does a revision 2 exist at all? */
if (fadt->hdr.revision >= 3) if (fadt->hdr.revision >= 3)
{ {
fadt->dsdt_xaddr = (grub_addr_t) table_dsdt; fadt->dsdt_xaddr = (VasEBoot_addr_t) table_dsdt;
fadt->facs_xaddr = facs_addr; fadt->facs_xaddr = facs_addr;
} }
/* Recompute checksum. */ /* Recompute checksum. */
fadt->hdr.checksum = 0; fadt->hdr.checksum = 0;
fadt->hdr.checksum = 1 + ~grub_byte_checksum (fadt, fadt->hdr.length); fadt->hdr.checksum = 1 + ~VasEBoot_byte_checksum (fadt, fadt->hdr.length);
} }
} }
@ -355,27 +355,27 @@ setup_common_tables (void)
for (cur = acpi_tables; cur; cur = cur->next) for (cur = acpi_tables; cur; cur = cur->next)
numoftables++; numoftables++;
rsdt_addr = rsdt = (struct grub_acpi_table_header *) playground_ptr; rsdt_addr = rsdt = (struct VasEBoot_acpi_table_header *) playground_ptr;
playground_ptr += sizeof (struct grub_acpi_table_header) + sizeof (grub_uint32_t) * numoftables; playground_ptr += sizeof (struct VasEBoot_acpi_table_header) + sizeof (VasEBoot_uint32_t) * numoftables;
rsdt_entry = (grub_uint32_t *) (rsdt + 1); rsdt_entry = (VasEBoot_uint32_t *) (rsdt + 1);
/* Fill RSDT header. */ /* Fill RSDT header. */
grub_memcpy (&(rsdt->signature), "RSDT", 4); VasEBoot_memcpy (&(rsdt->signature), "RSDT", 4);
rsdt->length = sizeof (struct grub_acpi_table_header) + sizeof (grub_uint32_t) * numoftables; rsdt->length = sizeof (struct VasEBoot_acpi_table_header) + sizeof (VasEBoot_uint32_t) * numoftables;
rsdt->revision = 1; rsdt->revision = 1;
grub_memcpy (&(rsdt->oemid), root_oemid, sizeof (rsdt->oemid)); VasEBoot_memcpy (&(rsdt->oemid), root_oemid, sizeof (rsdt->oemid));
grub_memcpy (&(rsdt->oemtable), root_oemtable, sizeof (rsdt->oemtable)); VasEBoot_memcpy (&(rsdt->oemtable), root_oemtable, sizeof (rsdt->oemtable));
rsdt->oemrev = root_oemrev; rsdt->oemrev = root_oemrev;
grub_memcpy (&(rsdt->creator_id), root_creator_id, sizeof (rsdt->creator_id)); VasEBoot_memcpy (&(rsdt->creator_id), root_creator_id, sizeof (rsdt->creator_id));
rsdt->creator_rev = root_creator_rev; rsdt->creator_rev = root_creator_rev;
for (cur = acpi_tables; cur; cur = cur->next) for (cur = acpi_tables; cur; cur = cur->next)
*(rsdt_entry++) = (grub_addr_t) cur->addr; *(rsdt_entry++) = (VasEBoot_addr_t) cur->addr;
/* Recompute checksum. */ /* Recompute checksum. */
rsdt->checksum = 0; rsdt->checksum = 0;
rsdt->checksum = 1 + ~grub_byte_checksum (rsdt, rsdt->length); rsdt->checksum = 1 + ~VasEBoot_byte_checksum (rsdt, rsdt->length);
} }
/* Regenerate ACPIv1 RSDP */ /* Regenerate ACPIv1 RSDP */
@ -383,25 +383,25 @@ static void
setv1table (void) setv1table (void)
{ {
/* Create RSDP. */ /* Create RSDP. */
rsdpv1_new = (struct grub_acpi_rsdp_v10 *) playground_ptr; rsdpv1_new = (struct VasEBoot_acpi_rsdp_v10 *) playground_ptr;
playground_ptr += sizeof (struct grub_acpi_rsdp_v10); playground_ptr += sizeof (struct VasEBoot_acpi_rsdp_v10);
grub_memcpy (&(rsdpv1_new->signature), GRUB_RSDP_SIGNATURE, VasEBoot_memcpy (&(rsdpv1_new->signature), VasEBoot_RSDP_SIGNATURE,
sizeof (rsdpv1_new->signature)); sizeof (rsdpv1_new->signature));
grub_memcpy (&(rsdpv1_new->oemid), root_oemid, sizeof (rsdpv1_new->oemid)); VasEBoot_memcpy (&(rsdpv1_new->oemid), root_oemid, sizeof (rsdpv1_new->oemid));
rsdpv1_new->revision = 0; rsdpv1_new->revision = 0;
rsdpv1_new->rsdt_addr = (grub_addr_t) rsdt_addr; rsdpv1_new->rsdt_addr = (VasEBoot_addr_t) rsdt_addr;
rsdpv1_new->checksum = 0; rsdpv1_new->checksum = 0;
rsdpv1_new->checksum = 1 + ~grub_byte_checksum (rsdpv1_new, rsdpv1_new->checksum = 1 + ~VasEBoot_byte_checksum (rsdpv1_new,
sizeof (*rsdpv1_new)); sizeof (*rsdpv1_new));
grub_dprintf ("acpi", "Generated ACPIv1 tables\n"); VasEBoot_dprintf ("acpi", "Generated ACPIv1 tables\n");
} }
static void static void
setv2table (void) setv2table (void)
{ {
struct grub_acpi_table_header *xsdt; struct VasEBoot_acpi_table_header *xsdt;
struct efiemu_acpi_table *cur; struct efiemu_acpi_table *cur;
grub_uint64_t *xsdt_entry; VasEBoot_uint64_t *xsdt_entry;
int numoftables; int numoftables;
numoftables = 0; numoftables = 0;
@ -409,41 +409,41 @@ setv2table (void)
numoftables++; numoftables++;
/* Create XSDT. */ /* Create XSDT. */
xsdt = (struct grub_acpi_table_header *) playground_ptr; xsdt = (struct VasEBoot_acpi_table_header *) playground_ptr;
playground_ptr += sizeof (struct grub_acpi_table_header) + sizeof (grub_uint64_t) * numoftables; playground_ptr += sizeof (struct VasEBoot_acpi_table_header) + sizeof (VasEBoot_uint64_t) * numoftables;
xsdt_entry = (grub_uint64_t *)(xsdt + 1); xsdt_entry = (VasEBoot_uint64_t *)(xsdt + 1);
for (cur = acpi_tables; cur; cur = cur->next) for (cur = acpi_tables; cur; cur = cur->next)
*(xsdt_entry++) = (grub_addr_t) cur->addr; *(xsdt_entry++) = (VasEBoot_addr_t) cur->addr;
grub_memcpy (&(xsdt->signature), "XSDT", 4); VasEBoot_memcpy (&(xsdt->signature), "XSDT", 4);
xsdt->length = sizeof (struct grub_acpi_table_header) + sizeof (grub_uint64_t) * numoftables; xsdt->length = sizeof (struct VasEBoot_acpi_table_header) + sizeof (VasEBoot_uint64_t) * numoftables;
xsdt->revision = 1; xsdt->revision = 1;
grub_memcpy (&(xsdt->oemid), root_oemid, sizeof (xsdt->oemid)); VasEBoot_memcpy (&(xsdt->oemid), root_oemid, sizeof (xsdt->oemid));
grub_memcpy (&(xsdt->oemtable), root_oemtable, sizeof (xsdt->oemtable)); VasEBoot_memcpy (&(xsdt->oemtable), root_oemtable, sizeof (xsdt->oemtable));
xsdt->oemrev = root_oemrev; xsdt->oemrev = root_oemrev;
grub_memcpy (&(xsdt->creator_id), root_creator_id, sizeof (xsdt->creator_id)); VasEBoot_memcpy (&(xsdt->creator_id), root_creator_id, sizeof (xsdt->creator_id));
xsdt->creator_rev = root_creator_rev; xsdt->creator_rev = root_creator_rev;
xsdt->checksum = 0; xsdt->checksum = 0;
xsdt->checksum = 1 + ~grub_byte_checksum (xsdt, xsdt->length); xsdt->checksum = 1 + ~VasEBoot_byte_checksum (xsdt, xsdt->length);
/* Create RSDPv2. */ /* Create RSDPv2. */
rsdpv2_new = (struct grub_acpi_rsdp_v20 *) playground_ptr; rsdpv2_new = (struct VasEBoot_acpi_rsdp_v20 *) playground_ptr;
playground_ptr += sizeof (struct grub_acpi_rsdp_v20); playground_ptr += sizeof (struct VasEBoot_acpi_rsdp_v20);
grub_memcpy (&(rsdpv2_new->rsdpv1.signature), GRUB_RSDP_SIGNATURE, VasEBoot_memcpy (&(rsdpv2_new->rsdpv1.signature), VasEBoot_RSDP_SIGNATURE,
sizeof (rsdpv2_new->rsdpv1.signature)); sizeof (rsdpv2_new->rsdpv1.signature));
grub_memcpy (&(rsdpv2_new->rsdpv1.oemid), root_oemid, VasEBoot_memcpy (&(rsdpv2_new->rsdpv1.oemid), root_oemid,
sizeof (rsdpv2_new->rsdpv1.oemid)); sizeof (rsdpv2_new->rsdpv1.oemid));
rsdpv2_new->rsdpv1.revision = rev2; rsdpv2_new->rsdpv1.revision = rev2;
rsdpv2_new->rsdpv1.rsdt_addr = (grub_addr_t) rsdt_addr; rsdpv2_new->rsdpv1.rsdt_addr = (VasEBoot_addr_t) rsdt_addr;
rsdpv2_new->rsdpv1.checksum = 0; rsdpv2_new->rsdpv1.checksum = 0;
rsdpv2_new->rsdpv1.checksum = 1 + ~grub_byte_checksum rsdpv2_new->rsdpv1.checksum = 1 + ~VasEBoot_byte_checksum
(&(rsdpv2_new->rsdpv1), sizeof (rsdpv2_new->rsdpv1)); (&(rsdpv2_new->rsdpv1), sizeof (rsdpv2_new->rsdpv1));
rsdpv2_new->length = sizeof (*rsdpv2_new); rsdpv2_new->length = sizeof (*rsdpv2_new);
rsdpv2_new->xsdt_addr = (grub_addr_t) xsdt; rsdpv2_new->xsdt_addr = (VasEBoot_addr_t) xsdt;
rsdpv2_new->checksum = 0; rsdpv2_new->checksum = 0;
rsdpv2_new->checksum = 1 + ~grub_byte_checksum (rsdpv2_new, rsdpv2_new->checksum = 1 + ~VasEBoot_byte_checksum (rsdpv2_new,
rsdpv2_new->length); rsdpv2_new->length);
grub_dprintf ("acpi", "Generated ACPIv2 tables\n"); VasEBoot_dprintf ("acpi", "Generated ACPIv2 tables\n");
} }
static void static void
@ -451,23 +451,23 @@ free_tables (void)
{ {
struct efiemu_acpi_table *cur, *t; struct efiemu_acpi_table *cur, *t;
if (table_dsdt) if (table_dsdt)
grub_free (table_dsdt); VasEBoot_free (table_dsdt);
for (cur = acpi_tables; cur;) for (cur = acpi_tables; cur;)
{ {
t = cur; t = cur;
grub_free (cur->addr); VasEBoot_free (cur->addr);
cur = cur->next; cur = cur->next;
grub_free (t); VasEBoot_free (t);
} }
acpi_tables = 0; acpi_tables = 0;
table_dsdt = 0; table_dsdt = 0;
} }
static grub_err_t static VasEBoot_err_t
grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args) VasEBoot_cmd_acpi (struct VasEBoot_extcmd_context *ctxt, int argc, char **args)
{ {
struct grub_arg_list *state = ctxt->state; struct VasEBoot_arg_list *state = ctxt->state;
struct grub_acpi_rsdp_v10 *rsdp; struct VasEBoot_acpi_rsdp_v10 *rsdp;
struct efiemu_acpi_table *cur, *t; struct efiemu_acpi_table *cur, *t;
int i, mmapregion; int i, mmapregion;
int numoftables; int numoftables;
@ -480,88 +480,88 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
playground = playground_ptr = 0; playground = playground_ptr = 0;
playground_size = 0; playground_size = 0;
rsdp = (struct grub_acpi_rsdp_v10 *) grub_machine_acpi_get_rsdpv2 (); rsdp = (struct VasEBoot_acpi_rsdp_v10 *) VasEBoot_machine_acpi_get_rsdpv2 ();
if (! rsdp) if (! rsdp)
rsdp = grub_machine_acpi_get_rsdpv1 (); rsdp = VasEBoot_machine_acpi_get_rsdpv1 ();
grub_dprintf ("acpi", "RSDP @%p\n", rsdp); VasEBoot_dprintf ("acpi", "RSDP @%p\n", rsdp);
if (rsdp) if (rsdp)
{ {
grub_uint32_t *entry_ptr; VasEBoot_uint32_t *entry_ptr;
char *exclude = 0; char *exclude = 0;
char *load_only = 0; char *load_only = 0;
char *ptr; char *ptr;
/* RSDT consists of header and an array of 32-bit pointers. */ /* RSDT consists of header and an array of 32-bit pointers. */
struct grub_acpi_table_header *rsdt; struct VasEBoot_acpi_table_header *rsdt;
exclude = state[0].set ? grub_strdup (state[0].arg) : 0; exclude = state[0].set ? VasEBoot_strdup (state[0].arg) : 0;
if (exclude) if (exclude)
{ {
for (ptr = exclude; *ptr; ptr++) for (ptr = exclude; *ptr; ptr++)
*ptr = grub_tolower (*ptr); *ptr = VasEBoot_tolower (*ptr);
} }
load_only = state[1].set ? grub_strdup (state[1].arg) : 0; load_only = state[1].set ? VasEBoot_strdup (state[1].arg) : 0;
if (load_only) if (load_only)
{ {
for (ptr = load_only; *ptr; ptr++) for (ptr = load_only; *ptr; ptr++)
*ptr = grub_tolower (*ptr); *ptr = VasEBoot_tolower (*ptr);
} }
/* Set revision variables to replicate the same version as host. */ /* Set revision variables to replicate the same version as host. */
rev1 = ! rsdp->revision; rev1 = ! rsdp->revision;
rev2 = rsdp->revision; rev2 = rsdp->revision;
rsdt = (struct grub_acpi_table_header *) (grub_addr_t) rsdp->rsdt_addr; rsdt = (struct VasEBoot_acpi_table_header *) (VasEBoot_addr_t) rsdp->rsdt_addr;
/* Load host tables. */ /* Load host tables. */
for (entry_ptr = (grub_uint32_t *) (rsdt + 1); for (entry_ptr = (VasEBoot_uint32_t *) (rsdt + 1);
entry_ptr < (grub_uint32_t *) (((grub_uint8_t *) rsdt) entry_ptr < (VasEBoot_uint32_t *) (((VasEBoot_uint8_t *) rsdt)
+ rsdt->length); + rsdt->length);
entry_ptr++) entry_ptr++)
{ {
char signature[5]; char signature[5];
struct efiemu_acpi_table *table; struct efiemu_acpi_table *table;
struct grub_acpi_table_header *curtable struct VasEBoot_acpi_table_header *curtable
= (struct grub_acpi_table_header *) (grub_addr_t) *entry_ptr; = (struct VasEBoot_acpi_table_header *) (VasEBoot_addr_t) *entry_ptr;
signature[4] = 0; signature[4] = 0;
for (i = 0; i < 4;i++) for (i = 0; i < 4;i++)
signature[i] = grub_tolower (curtable->signature[i]); signature[i] = VasEBoot_tolower (curtable->signature[i]);
/* If it's FADT it contains addresses of DSDT and FACS. */ /* If it's FADT it contains addresses of DSDT and FACS. */
if (grub_strcmp (signature, "facp") == 0) if (VasEBoot_strcmp (signature, "facp") == 0)
{ {
struct grub_acpi_table_header *dsdt; struct VasEBoot_acpi_table_header *dsdt;
struct grub_acpi_fadt *fadt = (struct grub_acpi_fadt *) curtable; struct VasEBoot_acpi_fadt *fadt = (struct VasEBoot_acpi_fadt *) curtable;
/* Set root header variables to the same values /* Set root header variables to the same values
as FADT by default. */ as FADT by default. */
grub_memcpy (&root_oemid, &(fadt->hdr.oemid), VasEBoot_memcpy (&root_oemid, &(fadt->hdr.oemid),
sizeof (root_oemid)); sizeof (root_oemid));
grub_memcpy (&root_oemtable, &(fadt->hdr.oemtable), VasEBoot_memcpy (&root_oemtable, &(fadt->hdr.oemtable),
sizeof (root_oemtable)); sizeof (root_oemtable));
root_oemrev = fadt->hdr.oemrev; root_oemrev = fadt->hdr.oemrev;
grub_memcpy (&root_creator_id, &(fadt->hdr.creator_id), VasEBoot_memcpy (&root_creator_id, &(fadt->hdr.creator_id),
sizeof (root_creator_id)); sizeof (root_creator_id));
root_creator_rev = fadt->hdr.creator_rev; root_creator_rev = fadt->hdr.creator_rev;
/* Load DSDT if not excluded. */ /* Load DSDT if not excluded. */
dsdt = (struct grub_acpi_table_header *) dsdt = (struct VasEBoot_acpi_table_header *)
(grub_addr_t) fadt->dsdt_addr; (VasEBoot_addr_t) fadt->dsdt_addr;
if (dsdt && (! exclude || ! grub_strword (exclude, "dsdt")) if (dsdt && (! exclude || ! VasEBoot_strword (exclude, "dsdt"))
&& (! load_only || grub_strword (load_only, "dsdt")) && (! load_only || VasEBoot_strword (load_only, "dsdt"))
&& dsdt->length >= sizeof (*dsdt)) && dsdt->length >= sizeof (*dsdt))
{ {
dsdt_size = dsdt->length; dsdt_size = dsdt->length;
table_dsdt = grub_malloc (dsdt->length); table_dsdt = VasEBoot_malloc (dsdt->length);
if (! table_dsdt) if (! table_dsdt)
{ {
free_tables (); free_tables ();
grub_free (exclude); VasEBoot_free (exclude);
grub_free (load_only); VasEBoot_free (load_only);
return grub_errno; return VasEBoot_errno;
} }
grub_memcpy (table_dsdt, dsdt, dsdt->length); VasEBoot_memcpy (table_dsdt, dsdt, dsdt->length);
} }
/* Save FACS address. FACS shouldn't be overridden. */ /* Save FACS address. FACS shouldn't be overridden. */
@ -569,41 +569,41 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
} }
/* Skip excluded tables. */ /* Skip excluded tables. */
if (exclude && grub_strword (exclude, signature)) if (exclude && VasEBoot_strword (exclude, signature))
continue; continue;
if (load_only && ! grub_strword (load_only, signature)) if (load_only && ! VasEBoot_strword (load_only, signature))
continue; continue;
/* Sanity check. */ /* Sanity check. */
if (curtable->length < sizeof (*curtable)) if (curtable->length < sizeof (*curtable))
continue; continue;
table = (struct efiemu_acpi_table *) grub_malloc table = (struct efiemu_acpi_table *) VasEBoot_malloc
(sizeof (struct efiemu_acpi_table)); (sizeof (struct efiemu_acpi_table));
if (! table) if (! table)
{ {
free_tables (); free_tables ();
grub_free (exclude); VasEBoot_free (exclude);
grub_free (load_only); VasEBoot_free (load_only);
return grub_errno; return VasEBoot_errno;
} }
table->size = curtable->length; table->size = curtable->length;
table->addr = grub_malloc (table->size); table->addr = VasEBoot_malloc (table->size);
playground_size += table->size; playground_size += table->size;
if (! table->addr) if (! table->addr)
{ {
free_tables (); free_tables ();
grub_free (exclude); VasEBoot_free (exclude);
grub_free (load_only); VasEBoot_free (load_only);
grub_free (table); VasEBoot_free (table);
return grub_errno; return VasEBoot_errno;
} }
table->next = acpi_tables; table->next = acpi_tables;
acpi_tables = table; acpi_tables = table;
grub_memcpy (table->addr, curtable, table->size); VasEBoot_memcpy (table->addr, curtable, table->size);
} }
grub_free (exclude); VasEBoot_free (exclude);
grub_free (load_only); VasEBoot_free (load_only);
} }
/* Does user specify versions to generate? */ /* Does user specify versions to generate? */
@ -618,74 +618,74 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
/* Does user override root header information? */ /* Does user override root header information? */
if (state[4].set) if (state[4].set)
grub_strncpy (root_oemid, state[4].arg, sizeof (root_oemid)); VasEBoot_strncpy (root_oemid, state[4].arg, sizeof (root_oemid));
if (state[5].set) if (state[5].set)
grub_strncpy (root_oemtable, state[5].arg, sizeof (root_oemtable)); VasEBoot_strncpy (root_oemtable, state[5].arg, sizeof (root_oemtable));
if (state[6].set) if (state[6].set)
root_oemrev = grub_strtoul (state[6].arg, 0, 0); root_oemrev = VasEBoot_strtoul (state[6].arg, 0, 0);
if (state[7].set) if (state[7].set)
grub_strncpy (root_creator_id, state[7].arg, sizeof (root_creator_id)); VasEBoot_strncpy (root_creator_id, state[7].arg, sizeof (root_creator_id));
if (state[8].set) if (state[8].set)
root_creator_rev = grub_strtoul (state[8].arg, 0, 0); root_creator_rev = VasEBoot_strtoul (state[8].arg, 0, 0);
/* Load user tables */ /* Load user tables */
for (i = 0; i < argc; i++) for (i = 0; i < argc; i++)
{ {
grub_file_t file; VasEBoot_file_t file;
grub_size_t size; VasEBoot_size_t size;
char *buf; char *buf;
file = grub_file_open (args[i]); file = VasEBoot_file_open (args[i]);
if (! file) if (! file)
{ {
free_tables (); free_tables ();
return grub_errno; return VasEBoot_errno;
} }
size = grub_file_size (file); size = VasEBoot_file_size (file);
if (size < sizeof (struct grub_acpi_table_header)) if (size < sizeof (struct VasEBoot_acpi_table_header))
{ {
grub_file_close (file); VasEBoot_file_close (file);
free_tables (); free_tables ();
return grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), return VasEBoot_error (VasEBoot_ERR_BAD_OS, N_("premature end of file %s"),
args[i]); args[i]);
} }
buf = (char *) grub_malloc (size); buf = (char *) VasEBoot_malloc (size);
if (! buf) if (! buf)
{ {
grub_file_close (file); VasEBoot_file_close (file);
free_tables (); free_tables ();
return grub_errno; return VasEBoot_errno;
} }
if (grub_file_read (file, buf, size) != (int) size) if (VasEBoot_file_read (file, buf, size) != (int) size)
{ {
grub_file_close (file); VasEBoot_file_close (file);
free_tables (); free_tables ();
if (!grub_errno) if (!VasEBoot_errno)
grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"), VasEBoot_error (VasEBoot_ERR_BAD_OS, N_("premature end of file %s"),
args[i]); args[i]);
return grub_errno; return VasEBoot_errno;
} }
grub_file_close (file); VasEBoot_file_close (file);
if (grub_memcmp (((struct grub_acpi_table_header *) buf)->signature, if (VasEBoot_memcmp (((struct VasEBoot_acpi_table_header *) buf)->signature,
"DSDT", 4) == 0) "DSDT", 4) == 0)
{ {
grub_free (table_dsdt); VasEBoot_free (table_dsdt);
table_dsdt = buf; table_dsdt = buf;
dsdt_size = size; dsdt_size = size;
} }
else else
{ {
struct efiemu_acpi_table *table; struct efiemu_acpi_table *table;
table = (struct efiemu_acpi_table *) grub_malloc table = (struct efiemu_acpi_table *) VasEBoot_malloc
(sizeof (struct efiemu_acpi_table)); (sizeof (struct efiemu_acpi_table));
if (! table) if (! table)
{ {
free_tables (); free_tables ();
return grub_errno; return VasEBoot_errno;
} }
table->size = size; table->size = size;
@ -704,22 +704,22 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
/* DSDT. */ /* DSDT. */
playground_size += dsdt_size; playground_size += dsdt_size;
/* RSDT. */ /* RSDT. */
playground_size += sizeof (struct grub_acpi_table_header) + sizeof (grub_uint32_t) * numoftables; playground_size += sizeof (struct VasEBoot_acpi_table_header) + sizeof (VasEBoot_uint32_t) * numoftables;
/* RSDPv1. */ /* RSDPv1. */
playground_size += sizeof (struct grub_acpi_rsdp_v10); playground_size += sizeof (struct VasEBoot_acpi_rsdp_v10);
/* XSDT. */ /* XSDT. */
playground_size += sizeof (struct grub_acpi_table_header) + sizeof (grub_uint64_t) * numoftables; playground_size += sizeof (struct VasEBoot_acpi_table_header) + sizeof (VasEBoot_uint64_t) * numoftables;
/* RSDPv2. */ /* RSDPv2. */
playground_size += sizeof (struct grub_acpi_rsdp_v20); playground_size += sizeof (struct VasEBoot_acpi_rsdp_v20);
playground = playground_ptr playground = playground_ptr
= grub_mmap_malign_and_register (1, playground_size, &mmapregion, = VasEBoot_mmap_malign_and_register (1, playground_size, &mmapregion,
GRUB_MEMORY_ACPI, 0); VasEBoot_MEMORY_ACPI, 0);
if (! playground) if (! playground)
{ {
free_tables (); free_tables ();
return grub_error (GRUB_ERR_OUT_OF_MEMORY, return VasEBoot_error (VasEBoot_ERR_OUT_OF_MEMORY,
"couldn't allocate space for ACPI tables"); "couldn't allocate space for ACPI tables");
} }
@ -737,45 +737,45 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
{ {
t = cur; t = cur;
cur = cur->next; cur = cur->next;
grub_free (t); VasEBoot_free (t);
} }
acpi_tables = 0; acpi_tables = 0;
#if defined (__i386__) || defined (__x86_64__) #if defined (__i386__) || defined (__x86_64__)
if (! state[9].set) if (! state[9].set)
{ {
grub_err_t err; VasEBoot_err_t err;
err = grub_acpi_create_ebda (); err = VasEBoot_acpi_create_ebda ();
if (err) if (err)
{ {
rsdpv1_new = 0; rsdpv1_new = 0;
rsdpv2_new = 0; rsdpv2_new = 0;
grub_mmap_free_and_unregister (mmapregion); VasEBoot_mmap_free_and_unregister (mmapregion);
return err; return err;
} }
} }
#endif #endif
#ifdef GRUB_MACHINE_EFI #ifdef VasEBoot_MACHINE_EFI
{ {
struct grub_efi_guid acpi = GRUB_EFI_ACPI_TABLE_GUID; struct VasEBoot_efi_guid acpi = VasEBoot_EFI_ACPI_TABLE_GUID;
struct grub_efi_guid acpi20 = GRUB_EFI_ACPI_20_TABLE_GUID; struct VasEBoot_efi_guid acpi20 = VasEBoot_EFI_ACPI_20_TABLE_GUID;
efi_call_2 (grub_efi_system_table->boot_services->install_configuration_table, efi_call_2 (VasEBoot_efi_system_table->boot_services->install_configuration_table,
&acpi20, grub_acpi_get_rsdpv2 ()); &acpi20, VasEBoot_acpi_get_rsdpv2 ());
efi_call_2 (grub_efi_system_table->boot_services->install_configuration_table, efi_call_2 (VasEBoot_efi_system_table->boot_services->install_configuration_table,
&acpi, grub_acpi_get_rsdpv1 ()); &acpi, VasEBoot_acpi_get_rsdpv1 ());
} }
#endif #endif
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
} }
static grub_extcmd_t cmd; static VasEBoot_extcmd_t cmd;
GRUB_MOD_INIT(acpi) VasEBoot_MOD_INIT(acpi)
{ {
cmd = grub_register_extcmd ("acpi", grub_cmd_acpi, 0, cmd = VasEBoot_register_extcmd ("acpi", VasEBoot_cmd_acpi, 0,
N_("[-1|-2] [--exclude=TABLE1,TABLE2|" N_("[-1|-2] [--exclude=TABLE1,TABLE2|"
"--load-only=TABLE1,TABLE2] FILE1" "--load-only=TABLE1,TABLE2] FILE1"
" [FILE2] [...]"), " [FILE2] [...]"),
@ -784,7 +784,7 @@ GRUB_MOD_INIT(acpi)
options); options);
} }
GRUB_MOD_FINI(acpi) VasEBoot_MOD_FINI(acpi)
{ {
grub_unregister_extcmd (cmd); VasEBoot_unregister_extcmd (cmd);
} }

View File

@ -1,22 +1,22 @@
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2010 Free Software Foundation, Inc. * Copyright (C) 2010 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifdef GRUB_DSDT_TEST #ifdef VasEBoot_DSDT_TEST
#include <stdio.h> #include <stdio.h>
#include <unistd.h> #include <unistd.h>
#include <stdlib.h> #include <stdlib.h>
@ -24,37 +24,37 @@
#include <string.h> #include <string.h>
#include <errno.h> #include <errno.h>
#define grub_dprintf(cond, args...) printf ( args ) #define VasEBoot_dprintf(cond, args...) printf ( args )
#define grub_printf printf #define VasEBoot_printf printf
#define grub_util_fopen fopen #define VasEBoot_util_fopen fopen
#define grub_memcmp memcmp #define VasEBoot_memcmp memcmp
typedef uint64_t grub_uint64_t; typedef uint64_t VasEBoot_uint64_t;
typedef uint32_t grub_uint32_t; typedef uint32_t VasEBoot_uint32_t;
typedef uint16_t grub_uint16_t; typedef uint16_t VasEBoot_uint16_t;
typedef uint8_t grub_uint8_t; typedef uint8_t VasEBoot_uint8_t;
#endif #endif
#include <grub/acpi.h> #include <VasEBoot/acpi.h>
#ifndef GRUB_DSDT_TEST #ifndef VasEBoot_DSDT_TEST
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
#else #else
#define _(x) x #define _(x) x
#define N_(x) x #define N_(x) x
#endif #endif
#ifndef GRUB_DSDT_TEST #ifndef VasEBoot_DSDT_TEST
#include <grub/mm.h> #include <VasEBoot/mm.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/time.h> #include <VasEBoot/time.h>
#include <grub/cpu/io.h> #include <VasEBoot/cpu/io.h>
#endif #endif
static inline grub_uint32_t static inline VasEBoot_uint32_t
decode_length (const grub_uint8_t *ptr, int *numlen) decode_length (const VasEBoot_uint8_t *ptr, int *numlen)
{ {
int num_bytes, i; int num_bytes, i;
grub_uint32_t ret; VasEBoot_uint32_t ret;
if (*ptr < 64) if (*ptr < 64)
{ {
if (numlen) if (numlen)
@ -74,10 +74,10 @@ decode_length (const grub_uint8_t *ptr, int *numlen)
return ret; return ret;
} }
static inline grub_uint32_t static inline VasEBoot_uint32_t
skip_name_string (const grub_uint8_t *ptr, const grub_uint8_t *end) skip_name_string (const VasEBoot_uint8_t *ptr, const VasEBoot_uint8_t *end)
{ {
const grub_uint8_t *ptr0 = ptr; const VasEBoot_uint8_t *ptr0 = ptr;
while (ptr < end && (*ptr == '^' || *ptr == '\\')) while (ptr < end && (*ptr == '^' || *ptr == '\\'))
ptr++; ptr++;
@ -101,28 +101,28 @@ skip_name_string (const grub_uint8_t *ptr, const grub_uint8_t *end)
return ptr - ptr0; return ptr - ptr0;
} }
static inline grub_uint32_t static inline VasEBoot_uint32_t
skip_data_ref_object (const grub_uint8_t *ptr, const grub_uint8_t *end) skip_data_ref_object (const VasEBoot_uint8_t *ptr, const VasEBoot_uint8_t *end)
{ {
grub_dprintf ("acpi", "data type = 0x%x\n", *ptr); VasEBoot_dprintf ("acpi", "data type = 0x%x\n", *ptr);
switch (*ptr) switch (*ptr)
{ {
case GRUB_ACPI_OPCODE_PACKAGE: case VasEBoot_ACPI_OPCODE_PACKAGE:
case GRUB_ACPI_OPCODE_BUFFER: case VasEBoot_ACPI_OPCODE_BUFFER:
return 1 + decode_length (ptr + 1, 0); return 1 + decode_length (ptr + 1, 0);
case GRUB_ACPI_OPCODE_ZERO: case VasEBoot_ACPI_OPCODE_ZERO:
case GRUB_ACPI_OPCODE_ONES: case VasEBoot_ACPI_OPCODE_ONES:
case GRUB_ACPI_OPCODE_ONE: case VasEBoot_ACPI_OPCODE_ONE:
return 1; return 1;
case GRUB_ACPI_OPCODE_BYTE_CONST: case VasEBoot_ACPI_OPCODE_BYTE_CONST:
return 2; return 2;
case GRUB_ACPI_OPCODE_WORD_CONST: case VasEBoot_ACPI_OPCODE_WORD_CONST:
return 3; return 3;
case GRUB_ACPI_OPCODE_DWORD_CONST: case VasEBoot_ACPI_OPCODE_DWORD_CONST:
return 5; return 5;
case GRUB_ACPI_OPCODE_STRING_CONST: case VasEBoot_ACPI_OPCODE_STRING_CONST:
{ {
const grub_uint8_t *ptr0 = ptr; const VasEBoot_uint8_t *ptr0 = ptr;
for (ptr++; ptr < end && *ptr; ptr++); for (ptr++; ptr < end && *ptr; ptr++);
if (ptr == end) if (ptr == end)
return 0; return 0;
@ -132,35 +132,35 @@ skip_data_ref_object (const grub_uint8_t *ptr, const grub_uint8_t *end)
if (*ptr == '^' || *ptr == '\\' || *ptr == '_' if (*ptr == '^' || *ptr == '\\' || *ptr == '_'
|| (*ptr >= 'A' && *ptr <= 'Z')) || (*ptr >= 'A' && *ptr <= 'Z'))
return skip_name_string (ptr, end); return skip_name_string (ptr, end);
grub_printf ("Unknown opcode 0x%x\n", *ptr); VasEBoot_printf ("Unknown opcode 0x%x\n", *ptr);
return 0; return 0;
} }
} }
static inline grub_uint32_t static inline VasEBoot_uint32_t
skip_term (const grub_uint8_t *ptr, const grub_uint8_t *end) skip_term (const VasEBoot_uint8_t *ptr, const VasEBoot_uint8_t *end)
{ {
grub_uint32_t add; VasEBoot_uint32_t add;
const grub_uint8_t *ptr0 = ptr; const VasEBoot_uint8_t *ptr0 = ptr;
switch(*ptr) switch(*ptr)
{ {
case GRUB_ACPI_OPCODE_ADD: case VasEBoot_ACPI_OPCODE_ADD:
case GRUB_ACPI_OPCODE_AND: case VasEBoot_ACPI_OPCODE_AND:
case GRUB_ACPI_OPCODE_CONCAT: case VasEBoot_ACPI_OPCODE_CONCAT:
case GRUB_ACPI_OPCODE_CONCATRES: case VasEBoot_ACPI_OPCODE_CONCATRES:
case GRUB_ACPI_OPCODE_DIVIDE: case VasEBoot_ACPI_OPCODE_DIVIDE:
case GRUB_ACPI_OPCODE_INDEX: case VasEBoot_ACPI_OPCODE_INDEX:
case GRUB_ACPI_OPCODE_LSHIFT: case VasEBoot_ACPI_OPCODE_LSHIFT:
case GRUB_ACPI_OPCODE_MOD: case VasEBoot_ACPI_OPCODE_MOD:
case GRUB_ACPI_OPCODE_MULTIPLY: case VasEBoot_ACPI_OPCODE_MULTIPLY:
case GRUB_ACPI_OPCODE_NAND: case VasEBoot_ACPI_OPCODE_NAND:
case GRUB_ACPI_OPCODE_NOR: case VasEBoot_ACPI_OPCODE_NOR:
case GRUB_ACPI_OPCODE_OR: case VasEBoot_ACPI_OPCODE_OR:
case GRUB_ACPI_OPCODE_RSHIFT: case VasEBoot_ACPI_OPCODE_RSHIFT:
case GRUB_ACPI_OPCODE_SUBTRACT: case VasEBoot_ACPI_OPCODE_SUBTRACT:
case GRUB_ACPI_OPCODE_TOSTRING: case VasEBoot_ACPI_OPCODE_TOSTRING:
case GRUB_ACPI_OPCODE_XOR: case VasEBoot_ACPI_OPCODE_XOR:
/* /*
* Parameters for these opcodes: TermArg, TermArg Target, see ACPI * Parameters for these opcodes: TermArg, TermArg Target, see ACPI
* spec r5.0, page 828f. * spec r5.0, page 828f.
@ -180,24 +180,24 @@ skip_term (const grub_uint8_t *ptr, const grub_uint8_t *end)
return ptr - ptr0; return ptr - ptr0;
} }
static inline grub_uint32_t static inline VasEBoot_uint32_t
skip_ext_op (const grub_uint8_t *ptr, const grub_uint8_t *end) skip_ext_op (const VasEBoot_uint8_t *ptr, const VasEBoot_uint8_t *end)
{ {
const grub_uint8_t *ptr0 = ptr; const VasEBoot_uint8_t *ptr0 = ptr;
int add; int add;
grub_dprintf ("acpi", "Extended opcode: 0x%x\n", *ptr); VasEBoot_dprintf ("acpi", "Extended opcode: 0x%x\n", *ptr);
switch (*ptr) switch (*ptr)
{ {
case GRUB_ACPI_EXTOPCODE_MUTEX: case VasEBoot_ACPI_EXTOPCODE_MUTEX:
ptr++; ptr++;
ptr += skip_name_string (ptr, end); ptr += skip_name_string (ptr, end);
ptr++; ptr++;
break; break;
case GRUB_ACPI_EXTOPCODE_EVENT_OP: case VasEBoot_ACPI_EXTOPCODE_EVENT_OP:
ptr++; ptr++;
ptr += skip_name_string (ptr, end); ptr += skip_name_string (ptr, end);
break; break;
case GRUB_ACPI_EXTOPCODE_OPERATION_REGION: case VasEBoot_ACPI_EXTOPCODE_OPERATION_REGION:
ptr++; ptr++;
ptr += skip_name_string (ptr, end); ptr += skip_name_string (ptr, end);
ptr++; ptr++;
@ -208,18 +208,18 @@ skip_ext_op (const grub_uint8_t *ptr, const grub_uint8_t *end)
if (!add) if (!add)
return 0; return 0;
break; break;
case GRUB_ACPI_EXTOPCODE_FIELD_OP: case VasEBoot_ACPI_EXTOPCODE_FIELD_OP:
case GRUB_ACPI_EXTOPCODE_DEVICE_OP: case VasEBoot_ACPI_EXTOPCODE_DEVICE_OP:
case GRUB_ACPI_EXTOPCODE_PROCESSOR_OP: case VasEBoot_ACPI_EXTOPCODE_PROCESSOR_OP:
case GRUB_ACPI_EXTOPCODE_POWER_RES_OP: case VasEBoot_ACPI_EXTOPCODE_POWER_RES_OP:
case GRUB_ACPI_EXTOPCODE_THERMAL_ZONE_OP: case VasEBoot_ACPI_EXTOPCODE_THERMAL_ZONE_OP:
case GRUB_ACPI_EXTOPCODE_INDEX_FIELD_OP: case VasEBoot_ACPI_EXTOPCODE_INDEX_FIELD_OP:
case GRUB_ACPI_EXTOPCODE_BANK_FIELD_OP: case VasEBoot_ACPI_EXTOPCODE_BANK_FIELD_OP:
ptr++; ptr++;
ptr += decode_length (ptr, 0); ptr += decode_length (ptr, 0);
break; break;
default: default:
grub_printf ("Unexpected extended opcode: 0x%x\n", *ptr); VasEBoot_printf ("Unexpected extended opcode: 0x%x\n", *ptr);
return 0; return 0;
} }
return ptr - ptr0; return ptr - ptr0;
@ -227,30 +227,30 @@ skip_ext_op (const grub_uint8_t *ptr, const grub_uint8_t *end)
static int static int
get_sleep_type (grub_uint8_t *table, grub_uint8_t *ptr, grub_uint8_t *end, get_sleep_type (VasEBoot_uint8_t *table, VasEBoot_uint8_t *ptr, VasEBoot_uint8_t *end,
grub_uint8_t *scope, int scope_len) VasEBoot_uint8_t *scope, int scope_len)
{ {
grub_uint8_t *prev = table; VasEBoot_uint8_t *prev = table;
if (!ptr) if (!ptr)
ptr = table + sizeof (struct grub_acpi_table_header); ptr = table + sizeof (struct VasEBoot_acpi_table_header);
while (ptr < end && prev < ptr) while (ptr < end && prev < ptr)
{ {
int add; int add;
prev = ptr; prev = ptr;
grub_dprintf ("acpi", "Opcode 0x%x\n", *ptr); VasEBoot_dprintf ("acpi", "Opcode 0x%x\n", *ptr);
grub_dprintf ("acpi", "Tell %x\n", (unsigned) (ptr - table)); VasEBoot_dprintf ("acpi", "Tell %x\n", (unsigned) (ptr - table));
switch (*ptr) switch (*ptr)
{ {
case GRUB_ACPI_OPCODE_EXTOP: case VasEBoot_ACPI_OPCODE_EXTOP:
ptr++; ptr++;
ptr += add = skip_ext_op (ptr, end); ptr += add = skip_ext_op (ptr, end);
if (!add) if (!add)
return -1; return -1;
break; break;
case GRUB_ACPI_OPCODE_CREATE_DWORD_FIELD: case VasEBoot_ACPI_OPCODE_CREATE_DWORD_FIELD:
case GRUB_ACPI_OPCODE_CREATE_WORD_FIELD: case VasEBoot_ACPI_OPCODE_CREATE_WORD_FIELD:
case GRUB_ACPI_OPCODE_CREATE_BYTE_FIELD: case VasEBoot_ACPI_OPCODE_CREATE_BYTE_FIELD:
{ {
ptr += 5; ptr += 5;
ptr += add = skip_data_ref_object (ptr, end); ptr += add = skip_data_ref_object (ptr, end);
@ -259,18 +259,18 @@ get_sleep_type (grub_uint8_t *table, grub_uint8_t *ptr, grub_uint8_t *end,
ptr += 4; ptr += 4;
break; break;
} }
case GRUB_ACPI_OPCODE_NAME: case VasEBoot_ACPI_OPCODE_NAME:
ptr++; ptr++;
if ((!scope || grub_memcmp (scope, "\\", scope_len) == 0) && if ((!scope || VasEBoot_memcmp (scope, "\\", scope_len) == 0) &&
(grub_memcmp (ptr, "_S5_", 4) == 0 || grub_memcmp (ptr, "\\_S5_", 4) == 0)) (VasEBoot_memcmp (ptr, "_S5_", 4) == 0 || VasEBoot_memcmp (ptr, "\\_S5_", 4) == 0))
{ {
int ll; int ll;
grub_uint8_t *ptr2 = ptr; VasEBoot_uint8_t *ptr2 = ptr;
grub_dprintf ("acpi", "S5 found\n"); VasEBoot_dprintf ("acpi", "S5 found\n");
ptr2 += skip_name_string (ptr, end); ptr2 += skip_name_string (ptr, end);
if (*ptr2 != 0x12) if (*ptr2 != 0x12)
{ {
grub_printf ("Unknown opcode in _S5: 0x%x\n", *ptr2); VasEBoot_printf ("Unknown opcode in _S5: 0x%x\n", *ptr2);
return -1; return -1;
} }
ptr2++; ptr2++;
@ -279,14 +279,14 @@ get_sleep_type (grub_uint8_t *table, grub_uint8_t *ptr, grub_uint8_t *end,
ptr2++; ptr2++;
switch (*ptr2) switch (*ptr2)
{ {
case GRUB_ACPI_OPCODE_ZERO: case VasEBoot_ACPI_OPCODE_ZERO:
return 0; return 0;
case GRUB_ACPI_OPCODE_ONE: case VasEBoot_ACPI_OPCODE_ONE:
return 1; return 1;
case GRUB_ACPI_OPCODE_BYTE_CONST: case VasEBoot_ACPI_OPCODE_BYTE_CONST:
return ptr2[1]; return ptr2[1];
default: default:
grub_printf ("Unknown data type in _S5: 0x%x\n", *ptr2); VasEBoot_printf ("Unknown data type in _S5: 0x%x\n", *ptr2);
return -1; return -1;
} }
} }
@ -297,7 +297,7 @@ get_sleep_type (grub_uint8_t *table, grub_uint8_t *ptr, grub_uint8_t *end,
if (!add) if (!add)
return -1; return -1;
break; break;
case GRUB_ACPI_OPCODE_ALIAS: case VasEBoot_ACPI_OPCODE_ALIAS:
ptr++; ptr++;
/* We need to skip two name strings */ /* We need to skip two name strings */
ptr += add = skip_name_string (ptr, end); ptr += add = skip_name_string (ptr, end);
@ -308,11 +308,11 @@ get_sleep_type (grub_uint8_t *table, grub_uint8_t *ptr, grub_uint8_t *end,
return -1; return -1;
break; break;
case GRUB_ACPI_OPCODE_SCOPE: case VasEBoot_ACPI_OPCODE_SCOPE:
{ {
int scope_sleep_type; int scope_sleep_type;
int ll; int ll;
grub_uint8_t *name; VasEBoot_uint8_t *name;
int name_len; int name_len;
ptr++; ptr++;
@ -328,15 +328,15 @@ get_sleep_type (grub_uint8_t *table, grub_uint8_t *ptr, grub_uint8_t *end,
ptr += add; ptr += add;
break; break;
} }
case GRUB_ACPI_OPCODE_IF: case VasEBoot_ACPI_OPCODE_IF:
case GRUB_ACPI_OPCODE_METHOD: case VasEBoot_ACPI_OPCODE_METHOD:
{ {
ptr++; ptr++;
ptr += decode_length (ptr, 0); ptr += decode_length (ptr, 0);
break; break;
} }
default: default:
grub_printf ("Unknown opcode 0x%x\n", *ptr); VasEBoot_printf ("Unknown opcode 0x%x\n", *ptr);
return -1; return -1;
} }
} }
@ -344,7 +344,7 @@ get_sleep_type (grub_uint8_t *table, grub_uint8_t *ptr, grub_uint8_t *end,
return -2; return -2;
} }
#ifdef GRUB_DSDT_TEST #ifdef VasEBoot_DSDT_TEST
int int
main (int argc, char **argv) main (int argc, char **argv)
{ {
@ -353,7 +353,7 @@ main (int argc, char **argv)
unsigned char *buf; unsigned char *buf;
if (argc < 2) if (argc < 2)
printf ("Usage: %s FILE\n", argv[0]); printf ("Usage: %s FILE\n", argv[0]);
f = grub_util_fopen (argv[1], "rb"); f = VasEBoot_util_fopen (argv[1], "rb");
if (!f) if (!f)
{ {
printf ("Couldn't open file\n"); printf ("Couldn't open file\n");
@ -386,69 +386,69 @@ main (int argc, char **argv)
#else #else
void void
grub_acpi_halt (void) VasEBoot_acpi_halt (void)
{ {
struct grub_acpi_rsdp_v20 *rsdp2; struct VasEBoot_acpi_rsdp_v20 *rsdp2;
struct grub_acpi_rsdp_v10 *rsdp1; struct VasEBoot_acpi_rsdp_v10 *rsdp1;
struct grub_acpi_table_header *rsdt; struct VasEBoot_acpi_table_header *rsdt;
grub_uint32_t *entry_ptr; VasEBoot_uint32_t *entry_ptr;
grub_uint32_t port = 0; VasEBoot_uint32_t port = 0;
int sleep_type = -1; int sleep_type = -1;
rsdp2 = grub_acpi_get_rsdpv2 (); rsdp2 = VasEBoot_acpi_get_rsdpv2 ();
if (rsdp2) if (rsdp2)
rsdp1 = &(rsdp2->rsdpv1); rsdp1 = &(rsdp2->rsdpv1);
else else
rsdp1 = grub_acpi_get_rsdpv1 (); rsdp1 = VasEBoot_acpi_get_rsdpv1 ();
grub_dprintf ("acpi", "rsdp1=%p\n", rsdp1); VasEBoot_dprintf ("acpi", "rsdp1=%p\n", rsdp1);
if (!rsdp1) if (!rsdp1)
return; return;
rsdt = (struct grub_acpi_table_header *) (grub_addr_t) rsdp1->rsdt_addr; rsdt = (struct VasEBoot_acpi_table_header *) (VasEBoot_addr_t) rsdp1->rsdt_addr;
for (entry_ptr = (grub_uint32_t *) (rsdt + 1); for (entry_ptr = (VasEBoot_uint32_t *) (rsdt + 1);
entry_ptr < (grub_uint32_t *) (((grub_uint8_t *) rsdt) entry_ptr < (VasEBoot_uint32_t *) (((VasEBoot_uint8_t *) rsdt)
+ rsdt->length); + rsdt->length);
entry_ptr++) entry_ptr++)
{ {
if (grub_memcmp ((void *) (grub_addr_t) *entry_ptr, "FACP", 4) == 0) if (VasEBoot_memcmp ((void *) (VasEBoot_addr_t) *entry_ptr, "FACP", 4) == 0)
{ {
struct grub_acpi_fadt *fadt struct VasEBoot_acpi_fadt *fadt
= ((struct grub_acpi_fadt *) (grub_addr_t) *entry_ptr); = ((struct VasEBoot_acpi_fadt *) (VasEBoot_addr_t) *entry_ptr);
struct grub_acpi_table_header *dsdt struct VasEBoot_acpi_table_header *dsdt
= (struct grub_acpi_table_header *) (grub_addr_t) fadt->dsdt_addr; = (struct VasEBoot_acpi_table_header *) (VasEBoot_addr_t) fadt->dsdt_addr;
grub_uint8_t *buf = (grub_uint8_t *) dsdt; VasEBoot_uint8_t *buf = (VasEBoot_uint8_t *) dsdt;
port = fadt->pm1a; port = fadt->pm1a;
grub_dprintf ("acpi", "PM1a port=%x\n", port); VasEBoot_dprintf ("acpi", "PM1a port=%x\n", port);
if (grub_memcmp (dsdt->signature, "DSDT", if (VasEBoot_memcmp (dsdt->signature, "DSDT",
sizeof (dsdt->signature)) == 0 sizeof (dsdt->signature)) == 0
&& sleep_type < 0) && sleep_type < 0)
sleep_type = get_sleep_type (buf, NULL, buf + dsdt->length, sleep_type = get_sleep_type (buf, NULL, buf + dsdt->length,
NULL, 0); NULL, 0);
} }
else if (grub_memcmp ((void *) (grub_addr_t) *entry_ptr, "SSDT", 4) == 0 else if (VasEBoot_memcmp ((void *) (VasEBoot_addr_t) *entry_ptr, "SSDT", 4) == 0
&& sleep_type < 0) && sleep_type < 0)
{ {
struct grub_acpi_table_header *ssdt struct VasEBoot_acpi_table_header *ssdt
= (struct grub_acpi_table_header *) (grub_addr_t) *entry_ptr; = (struct VasEBoot_acpi_table_header *) (VasEBoot_addr_t) *entry_ptr;
grub_uint8_t *buf = (grub_uint8_t *) ssdt; VasEBoot_uint8_t *buf = (VasEBoot_uint8_t *) ssdt;
grub_dprintf ("acpi", "SSDT = %p\n", ssdt); VasEBoot_dprintf ("acpi", "SSDT = %p\n", ssdt);
sleep_type = get_sleep_type (buf, NULL, buf + ssdt->length, NULL, 0); sleep_type = get_sleep_type (buf, NULL, buf + ssdt->length, NULL, 0);
} }
} }
grub_dprintf ("acpi", "SLP_TYP = %d, port = 0x%x\n", sleep_type, port); VasEBoot_dprintf ("acpi", "SLP_TYP = %d, port = 0x%x\n", sleep_type, port);
if (port && sleep_type >= 0 && sleep_type < 8) if (port && sleep_type >= 0 && sleep_type < 8)
grub_outw (GRUB_ACPI_SLP_EN | (sleep_type << GRUB_ACPI_SLP_TYP_OFFSET), VasEBoot_outw (VasEBoot_ACPI_SLP_EN | (sleep_type << VasEBoot_ACPI_SLP_TYP_OFFSET),
port & 0xffff); port & 0xffff);
grub_millisleep (1500); VasEBoot_millisleep (1500);
/* TRANSLATORS: It's computer shutdown using ACPI, not disabling ACPI. */ /* TRANSLATORS: It's computer shutdown using ACPI, not disabling ACPI. */
grub_puts_ (N_("ACPI shutdown failed")); VasEBoot_puts_ (N_("ACPI shutdown failed"));
} }
#endif #endif

View File

@ -1,57 +1,57 @@
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2011 Free Software Foundation, Inc. * Copyright (C) 2011 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/command.h> #include <VasEBoot/command.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
#include <grub/arc/arc.h> #include <VasEBoot/arc/arc.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
/* Helper for grub_cmd_lsdev. */ /* Helper for VasEBoot_cmd_lsdev. */
static int static int
grub_cmd_lsdev_iter (const char *name, VasEBoot_cmd_lsdev_iter (const char *name,
const struct grub_arc_component *comp __attribute__ ((unused)), const struct VasEBoot_arc_component *comp __attribute__ ((unused)),
void *data __attribute__ ((unused))) void *data __attribute__ ((unused)))
{ {
grub_printf ("%s\n", name); VasEBoot_printf ("%s\n", name);
return 0; return 0;
} }
static grub_err_t static VasEBoot_err_t
grub_cmd_lsdev (grub_command_t cmd __attribute__ ((unused)), VasEBoot_cmd_lsdev (VasEBoot_command_t cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)), int argc __attribute__ ((unused)),
char **args __attribute__ ((unused))) char **args __attribute__ ((unused)))
{ {
grub_arc_iterate_devs (grub_cmd_lsdev_iter, 0, 0); VasEBoot_arc_iterate_devs (VasEBoot_cmd_lsdev_iter, 0, 0);
return 0; return 0;
} }
static grub_command_t cmd; static VasEBoot_command_t cmd;
GRUB_MOD_INIT(lsdev) VasEBoot_MOD_INIT(lsdev)
{ {
cmd = grub_register_command ("lsdev", grub_cmd_lsdev, "", cmd = VasEBoot_register_command ("lsdev", VasEBoot_cmd_lsdev, "",
N_("List devices.")); N_("List devices."));
} }
GRUB_MOD_FINI(lsdev) VasEBoot_MOD_FINI(lsdev)
{ {
grub_unregister_command (cmd); VasEBoot_unregister_command (cmd);
} }

View File

@ -1,60 +1,60 @@
/* blocklist.c - print the block list of a file */ /* blocklist.c - print the block list of a file */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2006,2007 Free Software Foundation, Inc. * Copyright (C) 2006,2007 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/file.h> #include <VasEBoot/file.h>
#include <grub/mm.h> #include <VasEBoot/mm.h>
#include <grub/disk.h> #include <VasEBoot/disk.h>
#include <grub/partition.h> #include <VasEBoot/partition.h>
#include <grub/command.h> #include <VasEBoot/command.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
/* Context for grub_cmd_blocklist. */ /* Context for VasEBoot_cmd_blocklist. */
struct blocklist_ctx struct blocklist_ctx
{ {
unsigned long start_sector; unsigned long start_sector;
unsigned num_sectors; unsigned num_sectors;
int num_entries; int num_entries;
grub_disk_addr_t part_start; VasEBoot_disk_addr_t part_start;
}; };
/* Helper for grub_cmd_blocklist. */ /* Helper for VasEBoot_cmd_blocklist. */
static void static void
print_blocklist (grub_disk_addr_t sector, unsigned num, print_blocklist (VasEBoot_disk_addr_t sector, unsigned num,
unsigned offset, unsigned length, struct blocklist_ctx *ctx) unsigned offset, unsigned length, struct blocklist_ctx *ctx)
{ {
if (ctx->num_entries++) if (ctx->num_entries++)
grub_printf (","); VasEBoot_printf (",");
grub_printf ("%llu", (unsigned long long) (sector - ctx->part_start)); VasEBoot_printf ("%llu", (unsigned long long) (sector - ctx->part_start));
if (num > 0) if (num > 0)
grub_printf ("+%u", num); VasEBoot_printf ("+%u", num);
if (offset != 0 || length != 0) if (offset != 0 || length != 0)
grub_printf ("[%u-%u]", offset, offset + length); VasEBoot_printf ("[%u-%u]", offset, offset + length);
} }
/* Helper for grub_cmd_blocklist. */ /* Helper for VasEBoot_cmd_blocklist. */
static void static void
read_blocklist (grub_disk_addr_t sector, unsigned offset, unsigned length, read_blocklist (VasEBoot_disk_addr_t sector, unsigned offset, unsigned length,
void *data) void *data)
{ {
struct blocklist_ctx *ctx = data; struct blocklist_ctx *ctx = data;
@ -62,11 +62,11 @@ read_blocklist (grub_disk_addr_t sector, unsigned offset, unsigned length,
if (ctx->num_sectors > 0) if (ctx->num_sectors > 0)
{ {
if (ctx->start_sector + ctx->num_sectors == sector if (ctx->start_sector + ctx->num_sectors == sector
&& offset == 0 && length >= GRUB_DISK_SECTOR_SIZE) && offset == 0 && length >= VasEBoot_DISK_SECTOR_SIZE)
{ {
ctx->num_sectors += length >> GRUB_DISK_SECTOR_BITS; ctx->num_sectors += length >> VasEBoot_DISK_SECTOR_BITS;
sector += length >> GRUB_DISK_SECTOR_BITS; sector += length >> VasEBoot_DISK_SECTOR_BITS;
length &= (GRUB_DISK_SECTOR_SIZE - 1); length &= (VasEBoot_DISK_SECTOR_SIZE - 1);
} }
if (!length) if (!length)
@ -78,7 +78,7 @@ read_blocklist (grub_disk_addr_t sector, unsigned offset, unsigned length,
if (offset) if (offset)
{ {
unsigned l = length + offset; unsigned l = length + offset;
l &= (GRUB_DISK_SECTOR_SIZE - 1); l &= (VasEBoot_DISK_SECTOR_SIZE - 1);
l -= offset; l -= offset;
print_blocklist (sector, 0, offset, l, ctx); print_blocklist (sector, 0, offset, l, ctx);
length -= l; length -= l;
@ -89,28 +89,28 @@ read_blocklist (grub_disk_addr_t sector, unsigned offset, unsigned length,
if (!length) if (!length)
return; return;
if (length & (GRUB_DISK_SECTOR_SIZE - 1)) if (length & (VasEBoot_DISK_SECTOR_SIZE - 1))
{ {
if (length >> GRUB_DISK_SECTOR_BITS) if (length >> VasEBoot_DISK_SECTOR_BITS)
{ {
print_blocklist (sector, length >> GRUB_DISK_SECTOR_BITS, 0, 0, ctx); print_blocklist (sector, length >> VasEBoot_DISK_SECTOR_BITS, 0, 0, ctx);
sector += length >> GRUB_DISK_SECTOR_BITS; sector += length >> VasEBoot_DISK_SECTOR_BITS;
} }
print_blocklist (sector, 0, 0, length & (GRUB_DISK_SECTOR_SIZE - 1), ctx); print_blocklist (sector, 0, 0, length & (VasEBoot_DISK_SECTOR_SIZE - 1), ctx);
} }
else else
{ {
ctx->start_sector = sector; ctx->start_sector = sector;
ctx->num_sectors = length >> GRUB_DISK_SECTOR_BITS; ctx->num_sectors = length >> VasEBoot_DISK_SECTOR_BITS;
} }
} }
static grub_err_t static VasEBoot_err_t
grub_cmd_blocklist (grub_command_t cmd __attribute__ ((unused)), VasEBoot_cmd_blocklist (VasEBoot_command_t cmd __attribute__ ((unused)),
int argc, char **args) int argc, char **args)
{ {
grub_file_t file; VasEBoot_file_t file;
char buf[GRUB_DISK_SECTOR_SIZE]; char buf[VasEBoot_DISK_SECTOR_SIZE];
struct blocklist_ctx ctx = { struct blocklist_ctx ctx = {
.start_sector = 0, .start_sector = 0,
.num_sectors = 0, .num_sectors = 0,
@ -119,42 +119,42 @@ grub_cmd_blocklist (grub_command_t cmd __attribute__ ((unused)),
}; };
if (argc < 1) if (argc < 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, N_("filename expected"));
grub_file_filter_disable_compression (); VasEBoot_file_filter_disable_compression ();
file = grub_file_open (args[0]); file = VasEBoot_file_open (args[0]);
if (! file) if (! file)
return grub_errno; return VasEBoot_errno;
if (! file->device->disk) if (! file->device->disk)
return grub_error (GRUB_ERR_BAD_DEVICE, return VasEBoot_error (VasEBoot_ERR_BAD_DEVICE,
"this command is available only for disk devices"); "this command is available only for disk devices");
ctx.part_start = grub_partition_get_start (file->device->disk->partition); ctx.part_start = VasEBoot_partition_get_start (file->device->disk->partition);
file->read_hook = read_blocklist; file->read_hook = read_blocklist;
file->read_hook_data = &ctx; file->read_hook_data = &ctx;
while (grub_file_read (file, buf, sizeof (buf)) > 0) while (VasEBoot_file_read (file, buf, sizeof (buf)) > 0)
; ;
if (ctx.num_sectors > 0) if (ctx.num_sectors > 0)
print_blocklist (ctx.start_sector, ctx.num_sectors, 0, 0, &ctx); print_blocklist (ctx.start_sector, ctx.num_sectors, 0, 0, &ctx);
grub_file_close (file); VasEBoot_file_close (file);
return grub_errno; return VasEBoot_errno;
} }
static grub_command_t cmd; static VasEBoot_command_t cmd;
GRUB_MOD_INIT(blocklist) VasEBoot_MOD_INIT(blocklist)
{ {
cmd = grub_register_command ("blocklist", grub_cmd_blocklist, cmd = VasEBoot_register_command ("blocklist", VasEBoot_cmd_blocklist,
N_("FILE"), N_("Print a block list.")); N_("FILE"), N_("Print a block list."));
} }
GRUB_MOD_FINI(blocklist) VasEBoot_MOD_FINI(blocklist)
{ {
grub_unregister_command (cmd); VasEBoot_unregister_command (cmd);
} }

View File

@ -1,68 +1,68 @@
/* boot.c - command to boot an operating system */ /* boot.c - command to boot an operating system */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2002,2003,2004,2005,2007,2009 Free Software Foundation, Inc. * Copyright (C) 2002,2003,2004,2005,2007,2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/normal.h> #include <VasEBoot/normal.h>
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/loader.h> #include <VasEBoot/loader.h>
#include <grub/kernel.h> #include <VasEBoot/kernel.h>
#include <grub/mm.h> #include <VasEBoot/mm.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static grub_err_t (*grub_loader_boot_func) (void); static VasEBoot_err_t (*VasEBoot_loader_boot_func) (void);
static grub_err_t (*grub_loader_unload_func) (void); static VasEBoot_err_t (*VasEBoot_loader_unload_func) (void);
static int grub_loader_flags; static int VasEBoot_loader_flags;
struct grub_preboot struct VasEBoot_preboot
{ {
grub_err_t (*preboot_func) (int); VasEBoot_err_t (*preboot_func) (int);
grub_err_t (*preboot_rest_func) (void); VasEBoot_err_t (*preboot_rest_func) (void);
grub_loader_preboot_hook_prio_t prio; VasEBoot_loader_preboot_hook_prio_t prio;
struct grub_preboot *next; struct VasEBoot_preboot *next;
struct grub_preboot *prev; struct VasEBoot_preboot *prev;
}; };
static int grub_loader_loaded; static int VasEBoot_loader_loaded;
static struct grub_preboot *preboots_head = 0, static struct VasEBoot_preboot *preboots_head = 0,
*preboots_tail = 0; *preboots_tail = 0;
int int
grub_loader_is_loaded (void) VasEBoot_loader_is_loaded (void)
{ {
return grub_loader_loaded; return VasEBoot_loader_loaded;
} }
/* Register a preboot hook. */ /* Register a preboot hook. */
struct grub_preboot * struct VasEBoot_preboot *
grub_loader_register_preboot_hook (grub_err_t (*preboot_func) (int flags), VasEBoot_loader_register_preboot_hook (VasEBoot_err_t (*preboot_func) (int flags),
grub_err_t (*preboot_rest_func) (void), VasEBoot_err_t (*preboot_rest_func) (void),
grub_loader_preboot_hook_prio_t prio) VasEBoot_loader_preboot_hook_prio_t prio)
{ {
struct grub_preboot *cur, *new_preboot; struct VasEBoot_preboot *cur, *new_preboot;
if (! preboot_func && ! preboot_rest_func) if (! preboot_func && ! preboot_rest_func)
return 0; return 0;
new_preboot = (struct grub_preboot *) new_preboot = (struct VasEBoot_preboot *)
grub_malloc (sizeof (struct grub_preboot)); VasEBoot_malloc (sizeof (struct VasEBoot_preboot));
if (! new_preboot) if (! new_preboot)
return 0; return 0;
@ -93,9 +93,9 @@ grub_loader_register_preboot_hook (grub_err_t (*preboot_func) (int flags),
} }
void void
grub_loader_unregister_preboot_hook (struct grub_preboot *hnd) VasEBoot_loader_unregister_preboot_hook (struct VasEBoot_preboot *hnd)
{ {
struct grub_preboot *preb = hnd; struct VasEBoot_preboot *preb = hnd;
if (preb->next) if (preb->next)
preb->next->prev = preb->prev; preb->next->prev = preb->prev;
@ -106,51 +106,51 @@ grub_loader_unregister_preboot_hook (struct grub_preboot *hnd)
else else
preboots_head = preb->next; preboots_head = preb->next;
grub_free (preb); VasEBoot_free (preb);
} }
void void
grub_loader_set (grub_err_t (*boot) (void), VasEBoot_loader_set (VasEBoot_err_t (*boot) (void),
grub_err_t (*unload) (void), VasEBoot_err_t (*unload) (void),
int flags) int flags)
{ {
if (grub_loader_loaded && grub_loader_unload_func) if (VasEBoot_loader_loaded && VasEBoot_loader_unload_func)
grub_loader_unload_func (); VasEBoot_loader_unload_func ();
grub_loader_boot_func = boot; VasEBoot_loader_boot_func = boot;
grub_loader_unload_func = unload; VasEBoot_loader_unload_func = unload;
grub_loader_flags = flags; VasEBoot_loader_flags = flags;
grub_loader_loaded = 1; VasEBoot_loader_loaded = 1;
} }
void void
grub_loader_unset(void) VasEBoot_loader_unset(void)
{ {
if (grub_loader_loaded && grub_loader_unload_func) if (VasEBoot_loader_loaded && VasEBoot_loader_unload_func)
grub_loader_unload_func (); VasEBoot_loader_unload_func ();
grub_loader_boot_func = 0; VasEBoot_loader_boot_func = 0;
grub_loader_unload_func = 0; VasEBoot_loader_unload_func = 0;
grub_loader_loaded = 0; VasEBoot_loader_loaded = 0;
} }
grub_err_t VasEBoot_err_t
grub_loader_boot (void) VasEBoot_loader_boot (void)
{ {
grub_err_t err = GRUB_ERR_NONE; VasEBoot_err_t err = VasEBoot_ERR_NONE;
struct grub_preboot *cur; struct VasEBoot_preboot *cur;
if (! grub_loader_loaded) if (! VasEBoot_loader_loaded)
return grub_error (GRUB_ERR_NO_KERNEL, return VasEBoot_error (VasEBoot_ERR_NO_KERNEL,
N_("you need to load the kernel first")); N_("you need to load the kernel first"));
grub_machine_fini (grub_loader_flags); VasEBoot_machine_fini (VasEBoot_loader_flags);
for (cur = preboots_head; cur; cur = cur->next) for (cur = preboots_head; cur; cur = cur->next)
{ {
err = cur->preboot_func (grub_loader_flags); err = cur->preboot_func (VasEBoot_loader_flags);
if (err) if (err)
{ {
for (cur = cur->prev; cur; cur = cur->prev) for (cur = cur->prev; cur; cur = cur->prev)
@ -158,7 +158,7 @@ grub_loader_boot (void)
return err; return err;
} }
} }
err = (grub_loader_boot_func) (); err = (VasEBoot_loader_boot_func) ();
for (cur = preboots_tail; cur; cur = cur->prev) for (cur = preboots_tail; cur; cur = cur->prev)
if (! err) if (! err)
@ -170,26 +170,26 @@ grub_loader_boot (void)
} }
/* boot */ /* boot */
static grub_err_t static VasEBoot_err_t
grub_cmd_boot (struct grub_command *cmd __attribute__ ((unused)), VasEBoot_cmd_boot (struct VasEBoot_command *cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)), int argc __attribute__ ((unused)),
char *argv[] __attribute__ ((unused))) char *argv[] __attribute__ ((unused)))
{ {
return grub_loader_boot (); return VasEBoot_loader_boot ();
} }
static grub_command_t cmd_boot; static VasEBoot_command_t cmd_boot;
GRUB_MOD_INIT(boot) VasEBoot_MOD_INIT(boot)
{ {
cmd_boot = cmd_boot =
grub_register_command ("boot", grub_cmd_boot, VasEBoot_register_command ("boot", VasEBoot_cmd_boot,
0, N_("Boot an operating system.")); 0, N_("Boot an operating system."));
} }
GRUB_MOD_FINI(boot) VasEBoot_MOD_FINI(boot)
{ {
grub_unregister_command (cmd_boot); VasEBoot_unregister_command (cmd_boot);
} }

View File

@ -1,65 +1,65 @@
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2013 Free Software Foundation, Inc. * Copyright (C) 2013 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/command.h> #include <VasEBoot/command.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static grub_err_t static VasEBoot_err_t
grub_cmd_boottime (struct grub_command *cmd __attribute__ ((unused)), VasEBoot_cmd_boottime (struct VasEBoot_command *cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)), int argc __attribute__ ((unused)),
char *argv[] __attribute__ ((unused))) char *argv[] __attribute__ ((unused)))
{ {
struct grub_boot_time *cur; struct VasEBoot_boot_time *cur;
grub_uint64_t last_time = 0, start_time = 0; VasEBoot_uint64_t last_time = 0, start_time = 0;
if (!grub_boot_time_head) if (!VasEBoot_boot_time_head)
{ {
grub_puts_ (N_("No boot time statistics is available\n")); VasEBoot_puts_ (N_("No boot time statistics is available\n"));
return 0; return 0;
} }
start_time = last_time = grub_boot_time_head->tp; start_time = last_time = VasEBoot_boot_time_head->tp;
for (cur = grub_boot_time_head; cur; cur = cur->next) for (cur = VasEBoot_boot_time_head; cur; cur = cur->next)
{ {
grub_uint32_t tmabs = cur->tp - start_time; VasEBoot_uint32_t tmabs = cur->tp - start_time;
grub_uint32_t tmrel = cur->tp - last_time; VasEBoot_uint32_t tmrel = cur->tp - last_time;
last_time = cur->tp; last_time = cur->tp;
grub_printf ("%3d.%03ds %2d.%03ds %s:%d %s\n", VasEBoot_printf ("%3d.%03ds %2d.%03ds %s:%d %s\n",
tmabs / 1000, tmabs % 1000, tmrel / 1000, tmrel % 1000, cur->file, cur->line, tmabs / 1000, tmabs % 1000, tmrel / 1000, tmrel % 1000, cur->file, cur->line,
cur->msg); cur->msg);
} }
return 0; return 0;
} }
static grub_command_t cmd_boottime; static VasEBoot_command_t cmd_boottime;
GRUB_MOD_INIT(boottime) VasEBoot_MOD_INIT(boottime)
{ {
cmd_boottime = cmd_boottime =
grub_register_command ("boottime", grub_cmd_boottime, VasEBoot_register_command ("boottime", VasEBoot_cmd_boottime,
0, N_("Show boot time statistics.")); 0, N_("Show boot time statistics."));
} }
GRUB_MOD_FINI(boottime) VasEBoot_MOD_FINI(boottime)
{ {
grub_unregister_command (cmd_boottime); VasEBoot_unregister_command (cmd_boottime);
} }

View File

@ -1,62 +1,62 @@
/* cacheinfo.c - disk cache statistics */ /* cacheinfo.c - disk cache statistics */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2008,2010 Free Software Foundation, Inc. * Copyright (C) 2008,2010 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/command.h> #include <VasEBoot/command.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
#include <grub/disk.h> #include <VasEBoot/disk.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static grub_err_t static VasEBoot_err_t
grub_rescue_cmd_info (struct grub_command *cmd __attribute__ ((unused)), VasEBoot_rescue_cmd_info (struct VasEBoot_command *cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)), int argc __attribute__ ((unused)),
char *argv[] __attribute__ ((unused))) char *argv[] __attribute__ ((unused)))
{ {
unsigned long hits, misses; unsigned long hits, misses;
grub_disk_cache_get_performance (&hits, &misses); VasEBoot_disk_cache_get_performance (&hits, &misses);
if (hits + misses) if (hits + misses)
{ {
unsigned long ratio = hits * 10000 / (hits + misses); unsigned long ratio = hits * 10000 / (hits + misses);
grub_printf ("(%lu.%lu%%)\n", ratio / 100, ratio % 100); VasEBoot_printf ("(%lu.%lu%%)\n", ratio / 100, ratio % 100);
grub_printf_ (N_("Disk cache statistics: hits = %lu (%lu.%02lu%%)," VasEBoot_printf_ (N_("Disk cache statistics: hits = %lu (%lu.%02lu%%),"
" misses = %lu\n"), ratio / 100, ratio % 100, " misses = %lu\n"), ratio / 100, ratio % 100,
hits, misses); hits, misses);
} }
else else
grub_printf ("%s\n", _("No disk cache statistics available\n")); VasEBoot_printf ("%s\n", _("No disk cache statistics available\n"));
return 0; return 0;
} }
static grub_command_t cmd_cacheinfo; static VasEBoot_command_t cmd_cacheinfo;
GRUB_MOD_INIT(cacheinfo) VasEBoot_MOD_INIT(cacheinfo)
{ {
cmd_cacheinfo = cmd_cacheinfo =
grub_register_command ("cacheinfo", grub_rescue_cmd_info, VasEBoot_register_command ("cacheinfo", VasEBoot_rescue_cmd_info,
0, N_("Get disk cache info.")); 0, N_("Get disk cache info."));
} }
GRUB_MOD_FINI(cacheinfo) VasEBoot_MOD_FINI(cacheinfo)
{ {
grub_unregister_command (cmd_cacheinfo); VasEBoot_unregister_command (cmd_cacheinfo);
} }

View File

@ -1,51 +1,51 @@
/* cat.c - command to show the contents of a file */ /* cat.c - command to show the contents of a file */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2003,2005,2007,2008 Free Software Foundation, Inc. * Copyright (C) 2003,2005,2007,2008 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/file.h> #include <VasEBoot/file.h>
#include <grub/disk.h> #include <VasEBoot/disk.h>
#include <grub/term.h> #include <VasEBoot/term.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/extcmd.h> #include <VasEBoot/extcmd.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
#include <grub/charset.h> #include <VasEBoot/charset.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static const struct grub_arg_option options[] = static const struct VasEBoot_arg_option options[] =
{ {
{"dos", -1, 0, N_("Accept DOS-style CR/NL line endings."), 0, 0}, {"dos", -1, 0, N_("Accept DOS-style CR/NL line endings."), 0, 0},
{0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0}
}; };
static grub_err_t static VasEBoot_err_t
grub_cmd_cat (grub_extcmd_context_t ctxt, int argc, char **args) VasEBoot_cmd_cat (VasEBoot_extcmd_context_t ctxt, int argc, char **args)
{ {
struct grub_arg_list *state = ctxt->state; struct VasEBoot_arg_list *state = ctxt->state;
int dos = 0; int dos = 0;
grub_file_t file; VasEBoot_file_t file;
unsigned char buf[GRUB_DISK_SECTOR_SIZE]; unsigned char buf[VasEBoot_DISK_SECTOR_SIZE];
grub_ssize_t size; VasEBoot_ssize_t size;
int key = GRUB_TERM_NO_KEY; int key = VasEBoot_TERM_NO_KEY;
grub_uint32_t code = 0; VasEBoot_uint32_t code = 0;
int count = 0; int count = 0;
unsigned char utbuf[GRUB_MAX_UTF8_PER_CODEPOINT + 1]; unsigned char utbuf[VasEBoot_MAX_UTF8_PER_CODEPOINT + 1];
int utcount = 0; int utcount = 0;
int is_0d = 0; int is_0d = 0;
int j; int j;
@ -54,14 +54,14 @@ grub_cmd_cat (grub_extcmd_context_t ctxt, int argc, char **args)
dos = 1; dos = 1;
if (argc != 1) if (argc != 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, N_("filename expected"));
file = grub_file_open (args[0]); file = VasEBoot_file_open (args[0]);
if (! file) if (! file)
return grub_errno; return VasEBoot_errno;
while ((size = grub_file_read (file, buf, sizeof (buf))) > 0 while ((size = VasEBoot_file_read (file, buf, sizeof (buf))) > 0
&& key != GRUB_TERM_ESC) && key != VasEBoot_TERM_ESC)
{ {
int i; int i;
@ -71,39 +71,39 @@ grub_cmd_cat (grub_extcmd_context_t ctxt, int argc, char **args)
if (is_0d && buf[i] != '\n') if (is_0d && buf[i] != '\n')
{ {
grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT); VasEBoot_setcolorstate (VasEBoot_TERM_COLOR_HIGHLIGHT);
grub_printf ("<%x>", (int) '\r'); VasEBoot_printf ("<%x>", (int) '\r');
grub_setcolorstate (GRUB_TERM_COLOR_STANDARD); VasEBoot_setcolorstate (VasEBoot_TERM_COLOR_STANDARD);
} }
is_0d = 0; is_0d = 0;
if (!grub_utf8_process (buf[i], &code, &count)) if (!VasEBoot_utf8_process (buf[i], &code, &count))
{ {
grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT); VasEBoot_setcolorstate (VasEBoot_TERM_COLOR_HIGHLIGHT);
for (j = 0; j < utcount - 1; j++) for (j = 0; j < utcount - 1; j++)
grub_printf ("<%x>", (unsigned int) utbuf[j]); VasEBoot_printf ("<%x>", (unsigned int) utbuf[j]);
code = 0; code = 0;
count = 0; count = 0;
if (utcount == 1 || !grub_utf8_process (buf[i], &code, &count)) if (utcount == 1 || !VasEBoot_utf8_process (buf[i], &code, &count))
{ {
grub_printf ("<%x>", (unsigned int) buf[i]); VasEBoot_printf ("<%x>", (unsigned int) buf[i]);
code = 0; code = 0;
count = 0; count = 0;
utcount = 0; utcount = 0;
grub_setcolorstate (GRUB_TERM_COLOR_STANDARD); VasEBoot_setcolorstate (VasEBoot_TERM_COLOR_STANDARD);
continue; continue;
} }
grub_setcolorstate (GRUB_TERM_COLOR_STANDARD); VasEBoot_setcolorstate (VasEBoot_TERM_COLOR_STANDARD);
utcount = 1; utcount = 1;
} }
if (count) if (count)
continue; continue;
if ((code >= 0xa1 || grub_isprint (code) if ((code >= 0xa1 || VasEBoot_isprint (code)
|| grub_isspace (code)) && code != '\r') || VasEBoot_isspace (code)) && code != '\r')
{ {
grub_printf ("%C", code); VasEBoot_printf ("%C", code);
count = 0; count = 0;
code = 0; code = 0;
utcount = 0; utcount = 0;
@ -119,52 +119,52 @@ grub_cmd_cat (grub_extcmd_context_t ctxt, int argc, char **args)
continue; continue;
} }
grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT); VasEBoot_setcolorstate (VasEBoot_TERM_COLOR_HIGHLIGHT);
for (j = 0; j < utcount; j++) for (j = 0; j < utcount; j++)
grub_printf ("<%x>", (unsigned int) utbuf[j]); VasEBoot_printf ("<%x>", (unsigned int) utbuf[j]);
grub_setcolorstate (GRUB_TERM_COLOR_STANDARD); VasEBoot_setcolorstate (VasEBoot_TERM_COLOR_STANDARD);
count = 0; count = 0;
code = 0; code = 0;
utcount = 0; utcount = 0;
} }
do do
key = grub_getkey_noblock (); key = VasEBoot_getkey_noblock ();
while (key != GRUB_TERM_ESC && key != GRUB_TERM_NO_KEY); while (key != VasEBoot_TERM_ESC && key != VasEBoot_TERM_NO_KEY);
} }
if (is_0d) if (is_0d)
{ {
grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT); VasEBoot_setcolorstate (VasEBoot_TERM_COLOR_HIGHLIGHT);
grub_printf ("<%x>", (unsigned int) '\r'); VasEBoot_printf ("<%x>", (unsigned int) '\r');
grub_setcolorstate (GRUB_TERM_COLOR_STANDARD); VasEBoot_setcolorstate (VasEBoot_TERM_COLOR_STANDARD);
} }
if (utcount) if (utcount)
{ {
grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT); VasEBoot_setcolorstate (VasEBoot_TERM_COLOR_HIGHLIGHT);
for (j = 0; j < utcount; j++) for (j = 0; j < utcount; j++)
grub_printf ("<%x>", (unsigned int) utbuf[j]); VasEBoot_printf ("<%x>", (unsigned int) utbuf[j]);
grub_setcolorstate (GRUB_TERM_COLOR_STANDARD); VasEBoot_setcolorstate (VasEBoot_TERM_COLOR_STANDARD);
} }
grub_xputs ("\n"); VasEBoot_xputs ("\n");
grub_refresh (); VasEBoot_refresh ();
grub_file_close (file); VasEBoot_file_close (file);
return 0; return 0;
} }
static grub_extcmd_t cmd; static VasEBoot_extcmd_t cmd;
GRUB_MOD_INIT(cat) VasEBoot_MOD_INIT(cat)
{ {
cmd = grub_register_extcmd ("cat", grub_cmd_cat, 0, cmd = VasEBoot_register_extcmd ("cat", VasEBoot_cmd_cat, 0,
N_("FILE"), N_("Show the contents of a file."), N_("FILE"), N_("Show the contents of a file."),
options); options);
} }
GRUB_MOD_FINI(cat) VasEBoot_MOD_FINI(cat)
{ {
grub_unregister_extcmd (cmd); VasEBoot_unregister_extcmd (cmd);
} }

View File

@ -1,65 +1,65 @@
/* cmd.c - command to cmp an operating system */ /* cmd.c - command to cmp an operating system */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2003,2005,2006,2007,2009 Free Software Foundation, Inc. * Copyright (C) 2003,2005,2006,2007,2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/file.h> #include <VasEBoot/file.h>
#include <grub/mm.h> #include <VasEBoot/mm.h>
#include <grub/command.h> #include <VasEBoot/command.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
#define BUFFER_SIZE 512 #define BUFFER_SIZE 512
static grub_err_t static VasEBoot_err_t
grub_cmd_cmp (grub_command_t cmd __attribute__ ((unused)), VasEBoot_cmd_cmp (VasEBoot_command_t cmd __attribute__ ((unused)),
int argc, char **args) int argc, char **args)
{ {
grub_ssize_t rd1, rd2; VasEBoot_ssize_t rd1, rd2;
grub_off_t pos; VasEBoot_off_t pos;
grub_file_t file1 = 0; VasEBoot_file_t file1 = 0;
grub_file_t file2 = 0; VasEBoot_file_t file2 = 0;
char *buf1 = 0; char *buf1 = 0;
char *buf2 = 0; char *buf2 = 0;
if (argc != 2) if (argc != 2)
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("two arguments expected")); return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, N_("two arguments expected"));
grub_printf_ (N_("Compare file `%s' with `%s':\n"), args[0], VasEBoot_printf_ (N_("Compare file `%s' with `%s':\n"), args[0],
args[1]); args[1]);
file1 = grub_file_open (args[0]); file1 = VasEBoot_file_open (args[0]);
file2 = grub_file_open (args[1]); file2 = VasEBoot_file_open (args[1]);
if (! file1 || ! file2) if (! file1 || ! file2)
goto cleanup; goto cleanup;
if (grub_file_size (file1) != grub_file_size (file2)) if (VasEBoot_file_size (file1) != VasEBoot_file_size (file2))
grub_printf_ (N_("Files differ in size: %llu [%s], %llu [%s]\n"), VasEBoot_printf_ (N_("Files differ in size: %llu [%s], %llu [%s]\n"),
(unsigned long long) grub_file_size (file1), args[0], (unsigned long long) VasEBoot_file_size (file1), args[0],
(unsigned long long) grub_file_size (file2), args[1]); (unsigned long long) VasEBoot_file_size (file2), args[1]);
else else
{ {
pos = 0; pos = 0;
buf1 = grub_malloc (BUFFER_SIZE); buf1 = VasEBoot_malloc (BUFFER_SIZE);
buf2 = grub_malloc (BUFFER_SIZE); buf2 = VasEBoot_malloc (BUFFER_SIZE);
if (! buf1 || ! buf2) if (! buf1 || ! buf2)
goto cleanup; goto cleanup;
@ -68,8 +68,8 @@ grub_cmd_cmp (grub_command_t cmd __attribute__ ((unused)),
{ {
int i; int i;
rd1 = grub_file_read (file1, buf1, BUFFER_SIZE); rd1 = VasEBoot_file_read (file1, buf1, BUFFER_SIZE);
rd2 = grub_file_read (file2, buf2, BUFFER_SIZE); rd2 = VasEBoot_file_read (file2, buf2, BUFFER_SIZE);
if (rd1 != rd2) if (rd1 != rd2)
goto cleanup; goto cleanup;
@ -78,7 +78,7 @@ grub_cmd_cmp (grub_command_t cmd __attribute__ ((unused)),
{ {
if (buf1[i] != buf2[i]) if (buf1[i] != buf2[i])
{ {
grub_printf_ (N_("Files differ at the offset %llu: 0x%x [%s], 0x%x [%s]\n"), VasEBoot_printf_ (N_("Files differ at the offset %llu: 0x%x [%s], 0x%x [%s]\n"),
(unsigned long long) (i + pos), buf1[i], (unsigned long long) (i + pos), buf1[i],
args[0], buf2[i], args[1]); args[0], buf2[i], args[1]);
goto cleanup; goto cleanup;
@ -90,30 +90,30 @@ grub_cmd_cmp (grub_command_t cmd __attribute__ ((unused)),
while (rd2); while (rd2);
/* TRANSLATORS: it's always exactly 2 files. */ /* TRANSLATORS: it's always exactly 2 files. */
grub_printf_ (N_("The files are identical.\n")); VasEBoot_printf_ (N_("The files are identical.\n"));
} }
cleanup: cleanup:
grub_free (buf1); VasEBoot_free (buf1);
grub_free (buf2); VasEBoot_free (buf2);
if (file1) if (file1)
grub_file_close (file1); VasEBoot_file_close (file1);
if (file2) if (file2)
grub_file_close (file2); VasEBoot_file_close (file2);
return grub_errno; return VasEBoot_errno;
} }
static grub_command_t cmd; static VasEBoot_command_t cmd;
GRUB_MOD_INIT(cmp) VasEBoot_MOD_INIT(cmp)
{ {
cmd = grub_register_command ("cmp", grub_cmd_cmp, cmd = VasEBoot_register_command ("cmp", VasEBoot_cmd_cmp,
N_("FILE1 FILE2"), N_("Compare two files.")); N_("FILE1 FILE2"), N_("Compare two files."));
} }
GRUB_MOD_FINI(cmp) VasEBoot_MOD_FINI(cmp)
{ {
grub_unregister_command (cmd); VasEBoot_unregister_command (cmd);
} }

View File

@ -1,98 +1,98 @@
/* configfile.c - command to manually load config file */ /* configfile.c - command to manually load config file */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2005,2006,2007,2009 Free Software Foundation, Inc. * Copyright (C) 2005,2006,2007,2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/term.h> #include <VasEBoot/term.h>
#include <grub/env.h> #include <VasEBoot/env.h>
#include <grub/normal.h> #include <VasEBoot/normal.h>
#include <grub/command.h> #include <VasEBoot/command.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static grub_err_t static VasEBoot_err_t
grub_cmd_source (grub_command_t cmd, int argc, char **args) VasEBoot_cmd_source (VasEBoot_command_t cmd, int argc, char **args)
{ {
int new_env, extractor; int new_env, extractor;
if (argc != 1) if (argc != 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, N_("filename expected"));
extractor = (cmd->name[0] == 'e'); extractor = (cmd->name[0] == 'e');
new_env = (cmd->name[extractor ? sizeof ("extract_entries_") - 1 : 0] == 'c'); new_env = (cmd->name[extractor ? sizeof ("extract_entries_") - 1 : 0] == 'c');
if (new_env) if (new_env)
grub_cls (); VasEBoot_cls ();
if (new_env && !extractor) if (new_env && !extractor)
grub_env_context_open (); VasEBoot_env_context_open ();
if (extractor) if (extractor)
grub_env_extractor_open (!new_env); VasEBoot_env_extractor_open (!new_env);
grub_normal_execute (args[0], 1, ! new_env); VasEBoot_normal_execute (args[0], 1, ! new_env);
if (new_env && !extractor) if (new_env && !extractor)
grub_env_context_close (); VasEBoot_env_context_close ();
if (extractor) if (extractor)
grub_env_extractor_close (!new_env); VasEBoot_env_extractor_close (!new_env);
return 0; return 0;
} }
static grub_command_t cmd_configfile, cmd_source, cmd_dot; static VasEBoot_command_t cmd_configfile, cmd_source, cmd_dot;
static grub_command_t cmd_extractor_source, cmd_extractor_configfile; static VasEBoot_command_t cmd_extractor_source, cmd_extractor_configfile;
GRUB_MOD_INIT(configfile) VasEBoot_MOD_INIT(configfile)
{ {
cmd_configfile = cmd_configfile =
grub_register_command ("configfile", grub_cmd_source, VasEBoot_register_command ("configfile", VasEBoot_cmd_source,
N_("FILE"), N_("Load another config file.")); N_("FILE"), N_("Load another config file."));
cmd_source = cmd_source =
grub_register_command ("source", grub_cmd_source, VasEBoot_register_command ("source", VasEBoot_cmd_source,
N_("FILE"), N_("FILE"),
N_("Load another config file without changing context.") N_("Load another config file without changing context.")
); );
cmd_extractor_source = cmd_extractor_source =
grub_register_command ("extract_entries_source", grub_cmd_source, VasEBoot_register_command ("extract_entries_source", VasEBoot_cmd_source,
N_("FILE"), N_("FILE"),
N_("Load another config file without changing context but take only menu entries.") N_("Load another config file without changing context but take only menu entries.")
); );
cmd_extractor_configfile = cmd_extractor_configfile =
grub_register_command ("extract_entries_configfile", grub_cmd_source, VasEBoot_register_command ("extract_entries_configfile", VasEBoot_cmd_source,
N_("FILE"), N_("FILE"),
N_("Load another config file but take only menu entries.") N_("Load another config file but take only menu entries.")
); );
cmd_dot = cmd_dot =
grub_register_command (".", grub_cmd_source, VasEBoot_register_command (".", VasEBoot_cmd_source,
N_("FILE"), N_("FILE"),
N_("Load another config file without changing context.") N_("Load another config file without changing context.")
); );
} }
GRUB_MOD_FINI(configfile) VasEBoot_MOD_FINI(configfile)
{ {
grub_unregister_command (cmd_configfile); VasEBoot_unregister_command (cmd_configfile);
grub_unregister_command (cmd_source); VasEBoot_unregister_command (cmd_source);
grub_unregister_command (cmd_extractor_configfile); VasEBoot_unregister_command (cmd_extractor_configfile);
grub_unregister_command (cmd_extractor_source); VasEBoot_unregister_command (cmd_extractor_source);
grub_unregister_command (cmd_dot); VasEBoot_unregister_command (cmd_dot);
} }

View File

@ -1,60 +1,60 @@
/* date.c - command to display/set current datetime. */ /* date.c - command to display/set current datetime. */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2008 Free Software Foundation, Inc. * Copyright (C) 2008 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/err.h> #include <VasEBoot/err.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/datetime.h> #include <VasEBoot/datetime.h>
#include <grub/command.h> #include <VasEBoot/command.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
#define GRUB_DATETIME_SET_YEAR 1 #define VasEBoot_DATETIME_SET_YEAR 1
#define GRUB_DATETIME_SET_MONTH 2 #define VasEBoot_DATETIME_SET_MONTH 2
#define GRUB_DATETIME_SET_DAY 4 #define VasEBoot_DATETIME_SET_DAY 4
#define GRUB_DATETIME_SET_HOUR 8 #define VasEBoot_DATETIME_SET_HOUR 8
#define GRUB_DATETIME_SET_MINUTE 16 #define VasEBoot_DATETIME_SET_MINUTE 16
#define GRUB_DATETIME_SET_SECOND 32 #define VasEBoot_DATETIME_SET_SECOND 32
static grub_err_t static VasEBoot_err_t
grub_cmd_date (grub_command_t cmd __attribute__ ((unused)), VasEBoot_cmd_date (VasEBoot_command_t cmd __attribute__ ((unused)),
int argc, char **args) int argc, char **args)
{ {
struct grub_datetime datetime; struct VasEBoot_datetime datetime;
int limit[6][2] = {{1980, 2079}, {1, 12}, {1, 31}, {0, 23}, {0, 59}, {0, 59}}; int limit[6][2] = {{1980, 2079}, {1, 12}, {1, 31}, {0, 23}, {0, 59}, {0, 59}};
int value[6], mask; int value[6], mask;
if (argc == 0) if (argc == 0)
{ {
if (grub_get_datetime (&datetime)) if (VasEBoot_get_datetime (&datetime))
return grub_errno; return VasEBoot_errno;
grub_printf ("%d-%02d-%02d %02d:%02d:%02d %s\n", VasEBoot_printf ("%d-%02d-%02d %02d:%02d:%02d %s\n",
datetime.year, datetime.month, datetime.day, datetime.year, datetime.month, datetime.day,
datetime.hour, datetime.minute, datetime.second, datetime.hour, datetime.minute, datetime.second,
grub_get_weekday_name (&datetime)); VasEBoot_get_weekday_name (&datetime));
return 0; return 0;
} }
grub_memset (&value, 0, sizeof (value)); VasEBoot_memset (&value, 0, sizeof (value));
mask = 0; mask = 0;
for (; argc; argc--, args++) for (; argc; argc--, args++)
@ -63,7 +63,7 @@ grub_cmd_date (grub_command_t cmd __attribute__ ((unused)),
int m1, ofs, n, cur_mask; int m1, ofs, n, cur_mask;
p = args[0]; p = args[0];
m1 = grub_strtoul (p, &p, 10); m1 = VasEBoot_strtoul (p, &p, 10);
c = *p; c = *p;
if (c == '-') if (c == '-')
@ -82,7 +82,7 @@ grub_cmd_date (grub_command_t cmd __attribute__ ((unused)),
if (*p != c) if (*p != c)
goto fail; goto fail;
value[ofs + n] = grub_strtoul (p + 1, &p, 10); value[ofs + n] = VasEBoot_strtoul (p + 1, &p, 10);
cur_mask |= (1 << (ofs + n)); cur_mask |= (1 << (ofs + n));
} }
@ -105,44 +105,44 @@ grub_cmd_date (grub_command_t cmd __attribute__ ((unused)),
mask |= cur_mask; mask |= cur_mask;
} }
if (grub_get_datetime (&datetime)) if (VasEBoot_get_datetime (&datetime))
return grub_errno; return VasEBoot_errno;
if (mask & GRUB_DATETIME_SET_YEAR) if (mask & VasEBoot_DATETIME_SET_YEAR)
datetime.year = value[0]; datetime.year = value[0];
if (mask & GRUB_DATETIME_SET_MONTH) if (mask & VasEBoot_DATETIME_SET_MONTH)
datetime.month = value[1]; datetime.month = value[1];
if (mask & GRUB_DATETIME_SET_DAY) if (mask & VasEBoot_DATETIME_SET_DAY)
datetime.day = value[2]; datetime.day = value[2];
if (mask & GRUB_DATETIME_SET_HOUR) if (mask & VasEBoot_DATETIME_SET_HOUR)
datetime.hour = value[3]; datetime.hour = value[3];
if (mask & GRUB_DATETIME_SET_MINUTE) if (mask & VasEBoot_DATETIME_SET_MINUTE)
datetime.minute = value[4]; datetime.minute = value[4];
if (mask & GRUB_DATETIME_SET_SECOND) if (mask & VasEBoot_DATETIME_SET_SECOND)
datetime.second = value[5]; datetime.second = value[5];
return grub_set_datetime (&datetime); return VasEBoot_set_datetime (&datetime);
fail: fail:
return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid datetime"); return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, "invalid datetime");
} }
static grub_command_t cmd; static VasEBoot_command_t cmd;
GRUB_MOD_INIT(date) VasEBoot_MOD_INIT(date)
{ {
cmd = cmd =
grub_register_command ("date", grub_cmd_date, VasEBoot_register_command ("date", VasEBoot_cmd_date,
N_("[[year-]month-day] [hour:minute[:second]]"), N_("[[year-]month-day] [hour:minute[:second]]"),
N_("Display/set current datetime.")); N_("Display/set current datetime."));
} }
GRUB_MOD_FINI(date) VasEBoot_MOD_FINI(date)
{ {
grub_unregister_command (cmd); VasEBoot_unregister_command (cmd);
} }

View File

@ -1,41 +1,41 @@
/* echo.c - Command to display a line of text */ /* echo.c - Command to display a line of text */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2006,2007,2010 Free Software Foundation, Inc. * Copyright (C) 2006,2007,2010 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/extcmd.h> #include <VasEBoot/extcmd.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
#include <grub/term.h> #include <VasEBoot/term.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static const struct grub_arg_option options[] = static const struct VasEBoot_arg_option options[] =
{ {
{0, 'n', 0, N_("Do not output the trailing newline."), 0, 0}, {0, 'n', 0, N_("Do not output the trailing newline."), 0, 0},
{0, 'e', 0, N_("Enable interpretation of backslash escapes."), 0, 0}, {0, 'e', 0, N_("Enable interpretation of backslash escapes."), 0, 0},
{0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0}
}; };
static grub_err_t static VasEBoot_err_t
grub_cmd_echo (grub_extcmd_context_t ctxt, int argc, char **args) VasEBoot_cmd_echo (VasEBoot_extcmd_context_t ctxt, int argc, char **args)
{ {
struct grub_arg_list *state = ctxt->state; struct VasEBoot_arg_list *state = ctxt->state;
int newline = 1; int newline = 1;
int i; int i;
@ -47,12 +47,12 @@ grub_cmd_echo (grub_extcmd_context_t ctxt, int argc, char **args)
{ {
char *arg = *args; char *arg = *args;
/* Unescaping results in a string no longer than the original. */ /* Unescaping results in a string no longer than the original. */
char *unescaped = grub_malloc (grub_strlen (arg) + 1); char *unescaped = VasEBoot_malloc (VasEBoot_strlen (arg) + 1);
char *p = unescaped; char *p = unescaped;
args++; args++;
if (!unescaped) if (!unescaped)
return grub_errno; return VasEBoot_errno;
while (*arg) while (*arg)
{ {
@ -108,34 +108,34 @@ grub_cmd_echo (grub_extcmd_context_t ctxt, int argc, char **args)
} }
*p = '\0'; *p = '\0';
grub_xputs (unescaped); VasEBoot_xputs (unescaped);
grub_free (unescaped); VasEBoot_free (unescaped);
/* If another argument follows, insert a space. */ /* If another argument follows, insert a space. */
if (i != argc - 1) if (i != argc - 1)
grub_printf (" " ); VasEBoot_printf (" " );
} }
if (newline) if (newline)
grub_printf ("\n"); VasEBoot_printf ("\n");
grub_refresh (); VasEBoot_refresh ();
return 0; return 0;
} }
static grub_extcmd_t cmd; static VasEBoot_extcmd_t cmd;
GRUB_MOD_INIT(echo) VasEBoot_MOD_INIT(echo)
{ {
cmd = grub_register_extcmd ("echo", grub_cmd_echo, cmd = VasEBoot_register_extcmd ("echo", VasEBoot_cmd_echo,
GRUB_COMMAND_ACCEPT_DASH VasEBoot_COMMAND_ACCEPT_DASH
| GRUB_COMMAND_OPTIONS_AT_START, | VasEBoot_COMMAND_OPTIONS_AT_START,
N_("[-e|-n] STRING"), N_("Display a line of text."), N_("[-e|-n] STRING"), N_("Display a line of text."),
options); options);
} }
GRUB_MOD_FINI(echo) VasEBoot_MOD_FINI(echo)
{ {
grub_unregister_extcmd (cmd); VasEBoot_unregister_extcmd (cmd);
} }

View File

@ -1,90 +1,90 @@
/* fwsetup.c - Reboot into firmware setup menu. */ /* fwsetup.c - Reboot into firmware setup menu. */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2012 Free Software Foundation, Inc. * Copyright (C) 2012 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/types.h> #include <VasEBoot/types.h>
#include <grub/mm.h> #include <VasEBoot/mm.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/efi/api.h> #include <VasEBoot/efi/api.h>
#include <grub/efi/efi.h> #include <VasEBoot/efi/efi.h>
#include <grub/command.h> #include <VasEBoot/command.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static grub_err_t static VasEBoot_err_t
grub_cmd_fwsetup (grub_command_t cmd __attribute__ ((unused)), VasEBoot_cmd_fwsetup (VasEBoot_command_t cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)), int argc __attribute__ ((unused)),
char **args __attribute__ ((unused))) char **args __attribute__ ((unused)))
{ {
grub_efi_uint64_t *old_os_indications; VasEBoot_efi_uint64_t *old_os_indications;
grub_efi_uint64_t os_indications = GRUB_EFI_OS_INDICATIONS_BOOT_TO_FW_UI; VasEBoot_efi_uint64_t os_indications = VasEBoot_EFI_OS_INDICATIONS_BOOT_TO_FW_UI;
grub_err_t status; VasEBoot_err_t status;
grub_size_t oi_size; VasEBoot_size_t oi_size;
grub_efi_guid_t global = GRUB_EFI_GLOBAL_VARIABLE_GUID; VasEBoot_efi_guid_t global = VasEBoot_EFI_GLOBAL_VARIABLE_GUID;
old_os_indications = grub_efi_get_variable ("OsIndications", &global, old_os_indications = VasEBoot_efi_get_variable ("OsIndications", &global,
&oi_size); &oi_size);
if (old_os_indications != NULL && oi_size == sizeof (os_indications)) if (old_os_indications != NULL && oi_size == sizeof (os_indications))
os_indications |= *old_os_indications; os_indications |= *old_os_indications;
status = grub_efi_set_variable ("OsIndications", &global, &os_indications, status = VasEBoot_efi_set_variable ("OsIndications", &global, &os_indications,
sizeof (os_indications)); sizeof (os_indications));
if (status != GRUB_ERR_NONE) if (status != VasEBoot_ERR_NONE)
return status; return status;
grub_reboot (); VasEBoot_reboot ();
return GRUB_ERR_BUG; return VasEBoot_ERR_BUG;
} }
static grub_command_t cmd = NULL; static VasEBoot_command_t cmd = NULL;
static grub_efi_boolean_t static VasEBoot_efi_boolean_t
efifwsetup_is_supported (void) efifwsetup_is_supported (void)
{ {
grub_efi_uint64_t *os_indications_supported = NULL; VasEBoot_efi_uint64_t *os_indications_supported = NULL;
grub_size_t oi_size = 0; VasEBoot_size_t oi_size = 0;
grub_efi_guid_t global = GRUB_EFI_GLOBAL_VARIABLE_GUID; VasEBoot_efi_guid_t global = VasEBoot_EFI_GLOBAL_VARIABLE_GUID;
os_indications_supported = grub_efi_get_variable ("OsIndicationsSupported", os_indications_supported = VasEBoot_efi_get_variable ("OsIndicationsSupported",
&global, &oi_size); &global, &oi_size);
if (!os_indications_supported) if (!os_indications_supported)
return 0; return 0;
if (*os_indications_supported & GRUB_EFI_OS_INDICATIONS_BOOT_TO_FW_UI) if (*os_indications_supported & VasEBoot_EFI_OS_INDICATIONS_BOOT_TO_FW_UI)
return 1; return 1;
return 0; return 0;
} }
GRUB_MOD_INIT (efifwsetup) VasEBoot_MOD_INIT (efifwsetup)
{ {
if (efifwsetup_is_supported ()) if (efifwsetup_is_supported ())
cmd = grub_register_command ("fwsetup", grub_cmd_fwsetup, NULL, cmd = VasEBoot_register_command ("fwsetup", VasEBoot_cmd_fwsetup, NULL,
N_("Reboot into firmware setup menu.")); N_("Reboot into firmware setup menu."));
} }
GRUB_MOD_FINI (efifwsetup) VasEBoot_MOD_FINI (efifwsetup)
{ {
if (cmd) if (cmd)
grub_unregister_command (cmd); VasEBoot_unregister_command (cmd);
} }

View File

@ -1,39 +1,39 @@
/* fixvideo.c - fix video problem in efi */ /* fixvideo.c - fix video problem in efi */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc. * Copyright (C) 2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/file.h> #include <VasEBoot/file.h>
#include <grub/pci.h> #include <VasEBoot/pci.h>
#include <grub/command.h> #include <VasEBoot/command.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
#include <grub/mm.h> #include <VasEBoot/mm.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static struct grub_video_patch static struct VasEBoot_video_patch
{ {
const char *name; const char *name;
grub_uint32_t pci_id; VasEBoot_uint32_t pci_id;
grub_uint32_t mmio_bar; VasEBoot_uint32_t mmio_bar;
grub_uint32_t mmio_reg; VasEBoot_uint32_t mmio_reg;
grub_uint32_t mmio_old; VasEBoot_uint32_t mmio_old;
} video_patches[] = } video_patches[] =
{ {
{"Intel 945GM", 0x27a28086, 0, 0x71184, 0x1000000}, /* DSPBBASE */ {"Intel 945GM", 0x27a28086, 0, 0x71184, 0x1000000}, /* DSPBBASE */
@ -42,40 +42,40 @@ static struct grub_video_patch
}; };
static int static int
scan_card (grub_pci_device_t dev, grub_pci_id_t pciid, scan_card (VasEBoot_pci_device_t dev, VasEBoot_pci_id_t pciid,
void *data __attribute__ ((unused))) void *data __attribute__ ((unused)))
{ {
grub_pci_address_t addr; VasEBoot_pci_address_t addr;
addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS); addr = VasEBoot_pci_make_address (dev, VasEBoot_PCI_REG_CLASS);
if (grub_pci_read_byte (addr + 3) == 0x3) if (VasEBoot_pci_read_byte (addr + 3) == 0x3)
{ {
struct grub_video_patch *p = video_patches; struct VasEBoot_video_patch *p = video_patches;
while (p->name) while (p->name)
{ {
if (p->pci_id == pciid) if (p->pci_id == pciid)
{ {
grub_addr_t base; VasEBoot_addr_t base;
grub_dprintf ("fixvideo", "Found graphic card: %s\n", p->name); VasEBoot_dprintf ("fixvideo", "Found graphic card: %s\n", p->name);
addr += 8 + p->mmio_bar * 4; addr += 8 + p->mmio_bar * 4;
base = grub_pci_read (addr); base = VasEBoot_pci_read (addr);
if ((! base) || (base & GRUB_PCI_ADDR_SPACE_IO) || if ((! base) || (base & VasEBoot_PCI_ADDR_SPACE_IO) ||
(base & GRUB_PCI_ADDR_MEM_PREFETCH)) (base & VasEBoot_PCI_ADDR_MEM_PREFETCH))
grub_dprintf ("fixvideo", "Invalid MMIO bar %d\n", p->mmio_bar); VasEBoot_dprintf ("fixvideo", "Invalid MMIO bar %d\n", p->mmio_bar);
else else
{ {
base &= GRUB_PCI_ADDR_MEM_MASK; base &= VasEBoot_PCI_ADDR_MEM_MASK;
base += p->mmio_reg; base += p->mmio_reg;
if (*((volatile grub_uint32_t *) base) != p->mmio_old) if (*((volatile VasEBoot_uint32_t *) base) != p->mmio_old)
grub_dprintf ("fixvideo", "Old value doesn't match\n"); VasEBoot_dprintf ("fixvideo", "Old value doesn't match\n");
else else
{ {
*((volatile grub_uint32_t *) base) = 0; *((volatile VasEBoot_uint32_t *) base) = 0;
if (*((volatile grub_uint32_t *) base)) if (*((volatile VasEBoot_uint32_t *) base))
grub_dprintf ("fixvideo", "Setting MMIO fails\n"); VasEBoot_dprintf ("fixvideo", "Setting MMIO fails\n");
} }
} }
@ -84,31 +84,31 @@ scan_card (grub_pci_device_t dev, grub_pci_id_t pciid,
p++; p++;
} }
grub_dprintf ("fixvideo", "Unknown graphic card: %x\n", pciid); VasEBoot_dprintf ("fixvideo", "Unknown graphic card: %x\n", pciid);
} }
return 0; return 0;
} }
static grub_err_t static VasEBoot_err_t
grub_cmd_fixvideo (grub_command_t cmd __attribute__ ((unused)), VasEBoot_cmd_fixvideo (VasEBoot_command_t cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)), int argc __attribute__ ((unused)),
char *argv[] __attribute__ ((unused))) char *argv[] __attribute__ ((unused)))
{ {
grub_pci_iterate (scan_card, NULL); VasEBoot_pci_iterate (scan_card, NULL);
return 0; return 0;
} }
static grub_command_t cmd_fixvideo; static VasEBoot_command_t cmd_fixvideo;
GRUB_MOD_INIT(fixvideo) VasEBoot_MOD_INIT(fixvideo)
{ {
cmd_fixvideo = grub_register_command ("fix_video", grub_cmd_fixvideo, cmd_fixvideo = VasEBoot_register_command ("fix_video", VasEBoot_cmd_fixvideo,
0, N_("Fix video problem.")); 0, N_("Fix video problem."));
} }
GRUB_MOD_FINI(fixvideo) VasEBoot_MOD_FINI(fixvideo)
{ {
grub_unregister_command (cmd_fixvideo); VasEBoot_unregister_command (cmd_fixvideo);
} }

View File

@ -1,35 +1,35 @@
/* getenv.c - retrieve EFI variables. */ /* getenv.c - retrieve EFI variables. */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc. * Copyright (C) 2009 Free Software Foundation, Inc.
* Copyright (C) 2014 CoreOS, Inc. * Copyright (C) 2014 CoreOS, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/efi/efi.h> #include <VasEBoot/efi/efi.h>
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/env.h> #include <VasEBoot/env.h>
#include <grub/err.h> #include <VasEBoot/err.h>
#include <grub/extcmd.h> #include <VasEBoot/extcmd.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/mm.h> #include <VasEBoot/mm.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static const struct grub_arg_option options_getenv[] = { static const struct VasEBoot_arg_option options_getenv[] = {
{"var-name", 'e', 0, {"var-name", 'e', 0,
N_("Environment variable to query"), N_("Environment variable to query"),
N_("VARNAME"), ARG_TYPE_STRING}, N_("VARNAME"), ARG_TYPE_STRING},
@ -49,105 +49,105 @@ enum options_getenv
GETENV_BINARY, GETENV_BINARY,
}; };
static grub_err_t static VasEBoot_err_t
grub_cmd_getenv (grub_extcmd_context_t ctxt, int argc, char **args) VasEBoot_cmd_getenv (VasEBoot_extcmd_context_t ctxt, int argc, char **args)
{ {
struct grub_arg_list *state = ctxt->state; struct VasEBoot_arg_list *state = ctxt->state;
char *envvar = NULL, *guid = NULL, *bindata = NULL, *data = NULL; char *envvar = NULL, *guid = NULL, *bindata = NULL, *data = NULL;
grub_size_t datasize; VasEBoot_size_t datasize;
grub_efi_guid_t efi_var_guid; VasEBoot_efi_guid_t efi_var_guid;
grub_efi_boolean_t binary = state[GETENV_BINARY].set; VasEBoot_efi_boolean_t binary = state[GETENV_BINARY].set;
unsigned int i; unsigned int i;
if (!state[GETENV_VAR_NAME].set || !state[GETENV_VAR_GUID].set) if (!state[GETENV_VAR_NAME].set || !state[GETENV_VAR_GUID].set)
{ {
grub_error (GRUB_ERR_INVALID_COMMAND, N_("-e and -g are required")); VasEBoot_error (VasEBoot_ERR_INVALID_COMMAND, N_("-e and -g are required"));
goto done; goto done;
} }
if (argc != 1) if (argc != 1)
{ {
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("unexpected arguments")); VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, N_("unexpected arguments"));
goto done; goto done;
} }
envvar = state[GETENV_VAR_NAME].arg; envvar = state[GETENV_VAR_NAME].arg;
guid = state[GETENV_VAR_GUID].arg; guid = state[GETENV_VAR_GUID].arg;
if (grub_strlen(guid) != 36 || if (VasEBoot_strlen(guid) != 36 ||
guid[8] != '-' || guid[8] != '-' ||
guid[13] != '-' || guid[13] != '-' ||
guid[18] != '-' || guid[18] != '-' ||
guid[23] != '-') guid[23] != '-')
{ {
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("invalid GUID")); VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, N_("invalid GUID"));
goto done; goto done;
} }
/* Forgive me father for I have sinned */ /* Forgive me father for I have sinned */
guid[8] = 0; guid[8] = 0;
efi_var_guid.data1 = grub_strtoul(guid, NULL, 16); efi_var_guid.data1 = VasEBoot_strtoul(guid, NULL, 16);
guid[13] = 0; guid[13] = 0;
efi_var_guid.data2 = grub_strtoul(guid + 9, NULL, 16); efi_var_guid.data2 = VasEBoot_strtoul(guid + 9, NULL, 16);
guid[18] = 0; guid[18] = 0;
efi_var_guid.data3 = grub_strtoul(guid + 14, NULL, 16); efi_var_guid.data3 = VasEBoot_strtoul(guid + 14, NULL, 16);
efi_var_guid.data4[7] = grub_strtoul(guid + 34, NULL, 16); efi_var_guid.data4[7] = VasEBoot_strtoul(guid + 34, NULL, 16);
guid[34] = 0; guid[34] = 0;
efi_var_guid.data4[6] = grub_strtoul(guid + 32, NULL, 16); efi_var_guid.data4[6] = VasEBoot_strtoul(guid + 32, NULL, 16);
guid[32] = 0; guid[32] = 0;
efi_var_guid.data4[5] = grub_strtoul(guid + 30, NULL, 16); efi_var_guid.data4[5] = VasEBoot_strtoul(guid + 30, NULL, 16);
guid[30] = 0; guid[30] = 0;
efi_var_guid.data4[4] = grub_strtoul(guid + 28, NULL, 16); efi_var_guid.data4[4] = VasEBoot_strtoul(guid + 28, NULL, 16);
guid[28] = 0; guid[28] = 0;
efi_var_guid.data4[3] = grub_strtoul(guid + 26, NULL, 16); efi_var_guid.data4[3] = VasEBoot_strtoul(guid + 26, NULL, 16);
guid[26] = 0; guid[26] = 0;
efi_var_guid.data4[2] = grub_strtoul(guid + 24, NULL, 16); efi_var_guid.data4[2] = VasEBoot_strtoul(guid + 24, NULL, 16);
guid[23] = 0; guid[23] = 0;
efi_var_guid.data4[1] = grub_strtoul(guid + 21, NULL, 16); efi_var_guid.data4[1] = VasEBoot_strtoul(guid + 21, NULL, 16);
guid[21] = 0; guid[21] = 0;
efi_var_guid.data4[0] = grub_strtoul(guid + 19, NULL, 16); efi_var_guid.data4[0] = VasEBoot_strtoul(guid + 19, NULL, 16);
data = grub_efi_get_variable(envvar, &efi_var_guid, &datasize); data = VasEBoot_efi_get_variable(envvar, &efi_var_guid, &datasize);
if (!data || !datasize) if (!data || !datasize)
{ {
grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("No such variable")); VasEBoot_error (VasEBoot_ERR_FILE_NOT_FOUND, N_("No such variable"));
goto done; goto done;
} }
if (binary) if (binary)
{ {
bindata = grub_zalloc(datasize * 2 + 1); bindata = VasEBoot_zalloc(datasize * 2 + 1);
for (i=0; i<datasize; i++) for (i=0; i<datasize; i++)
grub_snprintf(bindata + i*2, 3, "%02x", data[i] & 0xff); VasEBoot_snprintf(bindata + i*2, 3, "%02x", data[i] & 0xff);
if (grub_env_set (args[0], bindata)) if (VasEBoot_env_set (args[0], bindata))
goto done; goto done;
} }
else if (grub_env_set (args[0], data)) else if (VasEBoot_env_set (args[0], data))
{ {
goto done; goto done;
} }
grub_errno = GRUB_ERR_NONE; VasEBoot_errno = VasEBoot_ERR_NONE;
done: done:
grub_free(bindata); VasEBoot_free(bindata);
grub_free(data); VasEBoot_free(data);
return grub_errno; return VasEBoot_errno;
} }
static grub_extcmd_t cmd_getenv; static VasEBoot_extcmd_t cmd_getenv;
GRUB_MOD_INIT(getenv) VasEBoot_MOD_INIT(getenv)
{ {
cmd_getenv = grub_register_extcmd ("getenv", grub_cmd_getenv, 0, cmd_getenv = VasEBoot_register_extcmd ("getenv", VasEBoot_cmd_getenv, 0,
N_("-e envvar -g guidenv setvar"), N_("-e envvar -g guidenv setvar"),
N_("Read a firmware environment variable"), N_("Read a firmware environment variable"),
options_getenv); options_getenv);
} }
GRUB_MOD_FINI(getenv) VasEBoot_MOD_FINI(getenv)
{ {
grub_unregister_extcmd (cmd_getenv); VasEBoot_unregister_extcmd (cmd_getenv);
} }

View File

@ -1,36 +1,36 @@
/* loadbios.c - command to load a bios dump */ /* loadbios.c - command to load a bios dump */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc. * Copyright (C) 2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/file.h> #include <VasEBoot/file.h>
#include <grub/efi/efi.h> #include <VasEBoot/efi/efi.h>
#include <grub/pci.h> #include <VasEBoot/pci.h>
#include <grub/command.h> #include <VasEBoot/command.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static grub_efi_guid_t acpi_guid = GRUB_EFI_ACPI_TABLE_GUID; static VasEBoot_efi_guid_t acpi_guid = VasEBoot_EFI_ACPI_TABLE_GUID;
static grub_efi_guid_t acpi2_guid = GRUB_EFI_ACPI_20_TABLE_GUID; static VasEBoot_efi_guid_t acpi2_guid = VasEBoot_EFI_ACPI_20_TABLE_GUID;
static grub_efi_guid_t smbios_guid = GRUB_EFI_SMBIOS_TABLE_GUID; static VasEBoot_efi_guid_t smbios_guid = VasEBoot_EFI_SMBIOS_TABLE_GUID;
static grub_efi_guid_t smbios3_guid = GRUB_EFI_SMBIOS3_TABLE_GUID; static VasEBoot_efi_guid_t smbios3_guid = VasEBoot_EFI_SMBIOS3_TABLE_GUID;
#define EBDA_SEG_ADDR 0x40e #define EBDA_SEG_ADDR 0x40e
#define LOW_MEM_ADDR 0x413 #define LOW_MEM_ADDR 0x413
@ -43,32 +43,32 @@ static grub_efi_guid_t smbios3_guid = GRUB_EFI_SMBIOS3_TABLE_GUID;
static int static int
enable_rom_area (void) enable_rom_area (void)
{ {
grub_pci_address_t addr; VasEBoot_pci_address_t addr;
grub_uint32_t *rom_ptr; VasEBoot_uint32_t *rom_ptr;
grub_pci_device_t dev = { .bus = 0, .device = 0, .function = 0}; VasEBoot_pci_device_t dev = { .bus = 0, .device = 0, .function = 0};
rom_ptr = (grub_uint32_t *) VBIOS_ADDR; rom_ptr = (VasEBoot_uint32_t *) VBIOS_ADDR;
if (*rom_ptr != BLANK_MEM) if (*rom_ptr != BLANK_MEM)
{ {
grub_puts_ (N_("ROM image is present.")); VasEBoot_puts_ (N_("ROM image is present."));
return 0; return 0;
} }
/* FIXME: should be macroified. */ /* FIXME: should be macroified. */
addr = grub_pci_make_address (dev, 144); addr = VasEBoot_pci_make_address (dev, 144);
grub_pci_write_byte (addr++, 0x30); VasEBoot_pci_write_byte (addr++, 0x30);
grub_pci_write_byte (addr++, 0x33); VasEBoot_pci_write_byte (addr++, 0x33);
grub_pci_write_byte (addr++, 0x33); VasEBoot_pci_write_byte (addr++, 0x33);
grub_pci_write_byte (addr++, 0x33); VasEBoot_pci_write_byte (addr++, 0x33);
grub_pci_write_byte (addr++, 0x33); VasEBoot_pci_write_byte (addr++, 0x33);
grub_pci_write_byte (addr++, 0x33); VasEBoot_pci_write_byte (addr++, 0x33);
grub_pci_write_byte (addr++, 0x33); VasEBoot_pci_write_byte (addr++, 0x33);
grub_pci_write_byte (addr, 0); VasEBoot_pci_write_byte (addr, 0);
*rom_ptr = 0; *rom_ptr = 0;
if (*rom_ptr != 0) if (*rom_ptr != 0)
{ {
grub_puts_ (N_("Can\'t enable ROM area.")); VasEBoot_puts_ (N_("Can\'t enable ROM area."));
return 0; return 0;
} }
@ -78,16 +78,16 @@ enable_rom_area (void)
static void static void
lock_rom_area (void) lock_rom_area (void)
{ {
grub_pci_address_t addr; VasEBoot_pci_address_t addr;
grub_pci_device_t dev = { .bus = 0, .device = 0, .function = 0}; VasEBoot_pci_device_t dev = { .bus = 0, .device = 0, .function = 0};
/* FIXME: should be macroified. */ /* FIXME: should be macroified. */
addr = grub_pci_make_address (dev, 144); addr = VasEBoot_pci_make_address (dev, 144);
grub_pci_write_byte (addr++, 0x10); VasEBoot_pci_write_byte (addr++, 0x10);
grub_pci_write_byte (addr++, 0x11); VasEBoot_pci_write_byte (addr++, 0x11);
grub_pci_write_byte (addr++, 0x11); VasEBoot_pci_write_byte (addr++, 0x11);
grub_pci_write_byte (addr++, 0x11); VasEBoot_pci_write_byte (addr++, 0x11);
grub_pci_write_byte (addr, 0x11); VasEBoot_pci_write_byte (addr, 0x11);
} }
static void static void
@ -95,66 +95,66 @@ fake_bios_data (int use_rom)
{ {
unsigned i; unsigned i;
void *acpi, *smbios, *smbios3; void *acpi, *smbios, *smbios3;
grub_uint16_t *ebda_seg_ptr, *low_mem_ptr; VasEBoot_uint16_t *ebda_seg_ptr, *low_mem_ptr;
ebda_seg_ptr = (grub_uint16_t *) EBDA_SEG_ADDR; ebda_seg_ptr = (VasEBoot_uint16_t *) EBDA_SEG_ADDR;
low_mem_ptr = (grub_uint16_t *) LOW_MEM_ADDR; low_mem_ptr = (VasEBoot_uint16_t *) LOW_MEM_ADDR;
if ((*ebda_seg_ptr) || (*low_mem_ptr)) if ((*ebda_seg_ptr) || (*low_mem_ptr))
return; return;
acpi = 0; acpi = 0;
smbios = 0; smbios = 0;
smbios3 = 0; smbios3 = 0;
for (i = 0; i < grub_efi_system_table->num_table_entries; i++) for (i = 0; i < VasEBoot_efi_system_table->num_table_entries; i++)
{ {
grub_efi_packed_guid_t *guid = VasEBoot_efi_packed_guid_t *guid =
&grub_efi_system_table->configuration_table[i].vendor_guid; &VasEBoot_efi_system_table->configuration_table[i].vendor_guid;
if (! grub_memcmp (guid, &acpi2_guid, sizeof (grub_efi_guid_t))) if (! VasEBoot_memcmp (guid, &acpi2_guid, sizeof (VasEBoot_efi_guid_t)))
{ {
acpi = grub_efi_system_table->configuration_table[i].vendor_table; acpi = VasEBoot_efi_system_table->configuration_table[i].vendor_table;
grub_dprintf ("efi", "ACPI2: %p\n", acpi); VasEBoot_dprintf ("efi", "ACPI2: %p\n", acpi);
} }
else if (! grub_memcmp (guid, &acpi_guid, sizeof (grub_efi_guid_t))) else if (! VasEBoot_memcmp (guid, &acpi_guid, sizeof (VasEBoot_efi_guid_t)))
{ {
void *t; void *t;
t = grub_efi_system_table->configuration_table[i].vendor_table; t = VasEBoot_efi_system_table->configuration_table[i].vendor_table;
if (! acpi) if (! acpi)
acpi = t; acpi = t;
grub_dprintf ("efi", "ACPI: %p\n", t); VasEBoot_dprintf ("efi", "ACPI: %p\n", t);
} }
else if (! grub_memcmp (guid, &smbios_guid, sizeof (grub_efi_guid_t))) else if (! VasEBoot_memcmp (guid, &smbios_guid, sizeof (VasEBoot_efi_guid_t)))
{ {
smbios = grub_efi_system_table->configuration_table[i].vendor_table; smbios = VasEBoot_efi_system_table->configuration_table[i].vendor_table;
grub_dprintf ("efi", "SMBIOS: %p\n", smbios); VasEBoot_dprintf ("efi", "SMBIOS: %p\n", smbios);
} }
else if (! grub_memcmp (guid, &smbios3_guid, sizeof (grub_efi_guid_t))) else if (! VasEBoot_memcmp (guid, &smbios3_guid, sizeof (VasEBoot_efi_guid_t)))
{ {
smbios3 = grub_efi_system_table->configuration_table[i].vendor_table; smbios3 = VasEBoot_efi_system_table->configuration_table[i].vendor_table;
grub_dprintf ("efi", "SMBIOS3: %p\n", smbios3); VasEBoot_dprintf ("efi", "SMBIOS3: %p\n", smbios3);
} }
} }
*ebda_seg_ptr = FAKE_EBDA_SEG; *ebda_seg_ptr = FAKE_EBDA_SEG;
*low_mem_ptr = (FAKE_EBDA_SEG >> 6); *low_mem_ptr = (FAKE_EBDA_SEG >> 6);
*((grub_uint16_t *) (FAKE_EBDA_SEG << 4)) = 640 - *low_mem_ptr; *((VasEBoot_uint16_t *) (FAKE_EBDA_SEG << 4)) = 640 - *low_mem_ptr;
if (acpi) if (acpi)
grub_memcpy ((char *) ((FAKE_EBDA_SEG << 4) + 16), acpi, 1024 - 16); VasEBoot_memcpy ((char *) ((FAKE_EBDA_SEG << 4) + 16), acpi, 1024 - 16);
if (use_rom) if (use_rom)
{ {
if (smbios) if (smbios)
grub_memcpy ((char *) SBIOS_ADDR, (char *) smbios, 31); VasEBoot_memcpy ((char *) SBIOS_ADDR, (char *) smbios, 31);
if (smbios3) if (smbios3)
grub_memcpy ((char *) SBIOS_ADDR + 32, (char *) smbios3, 24); VasEBoot_memcpy ((char *) SBIOS_ADDR + 32, (char *) smbios3, 24);
} }
} }
static grub_err_t static VasEBoot_err_t
grub_cmd_fakebios (struct grub_command *cmd __attribute__ ((unused)), VasEBoot_cmd_fakebios (struct VasEBoot_command *cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)), int argc __attribute__ ((unused)),
char *argv[] __attribute__ ((unused))) char *argv[] __attribute__ ((unused)))
{ {
@ -169,66 +169,66 @@ grub_cmd_fakebios (struct grub_command *cmd __attribute__ ((unused)),
return 0; return 0;
} }
static grub_err_t static VasEBoot_err_t
grub_cmd_loadbios (grub_command_t cmd __attribute__ ((unused)), VasEBoot_cmd_loadbios (VasEBoot_command_t cmd __attribute__ ((unused)),
int argc, char *argv[]) int argc, char *argv[])
{ {
grub_file_t file; VasEBoot_file_t file;
int size; int size;
if (argc == 0) if (argc == 0)
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, N_("filename expected"));
if (argc > 1) if (argc > 1)
{ {
file = grub_file_open (argv[1]); file = VasEBoot_file_open (argv[1]);
if (! file) if (! file)
return grub_errno; return VasEBoot_errno;
if (file->size != 4) if (file->size != 4)
grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid int10 dump size"); VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, "invalid int10 dump size");
else else
grub_file_read (file, (void *) 0x40, 4); VasEBoot_file_read (file, (void *) 0x40, 4);
grub_file_close (file); VasEBoot_file_close (file);
if (grub_errno) if (VasEBoot_errno)
return grub_errno; return VasEBoot_errno;
} }
file = grub_file_open (argv[0]); file = VasEBoot_file_open (argv[0]);
if (! file) if (! file)
return grub_errno; return VasEBoot_errno;
size = file->size; size = file->size;
if ((size < 0x10000) || (size > 0x40000)) if ((size < 0x10000) || (size > 0x40000))
grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid bios dump size"); VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, "invalid bios dump size");
else if (enable_rom_area ()) else if (enable_rom_area ())
{ {
grub_file_read (file, (void *) VBIOS_ADDR, size); VasEBoot_file_read (file, (void *) VBIOS_ADDR, size);
fake_bios_data (size <= 0x40000); fake_bios_data (size <= 0x40000);
lock_rom_area (); lock_rom_area ();
} }
grub_file_close (file); VasEBoot_file_close (file);
return grub_errno; return VasEBoot_errno;
} }
static grub_command_t cmd_fakebios, cmd_loadbios; static VasEBoot_command_t cmd_fakebios, cmd_loadbios;
GRUB_MOD_INIT(loadbios) VasEBoot_MOD_INIT(loadbios)
{ {
cmd_fakebios = grub_register_command ("fakebios", grub_cmd_fakebios, cmd_fakebios = VasEBoot_register_command ("fakebios", VasEBoot_cmd_fakebios,
0, N_("Create BIOS-like structures for" 0, N_("Create BIOS-like structures for"
" backward compatibility with" " backward compatibility with"
" existing OS.")); " existing OS."));
cmd_loadbios = grub_register_command ("loadbios", grub_cmd_loadbios, cmd_loadbios = VasEBoot_register_command ("loadbios", VasEBoot_cmd_loadbios,
N_("BIOS_DUMP [INT10_DUMP]"), N_("BIOS_DUMP [INT10_DUMP]"),
N_("Load BIOS dump.")); N_("Load BIOS dump."));
} }
GRUB_MOD_FINI(loadbios) VasEBoot_MOD_FINI(loadbios)
{ {
grub_unregister_command (cmd_fakebios); VasEBoot_unregister_command (cmd_fakebios);
grub_unregister_command (cmd_loadbios); VasEBoot_unregister_command (cmd_loadbios);
} }

View File

@ -1,126 +1,126 @@
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2012 Free Software Foundation, Inc. * Copyright (C) 2012 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/types.h> #include <VasEBoot/types.h>
#include <grub/mm.h> #include <VasEBoot/mm.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/efi/api.h> #include <VasEBoot/efi/api.h>
#include <grub/efi/edid.h> #include <VasEBoot/efi/edid.h>
#include <grub/efi/pci.h> #include <VasEBoot/efi/pci.h>
#include <grub/efi/efi.h> #include <VasEBoot/efi/efi.h>
#include <grub/efi/uga_draw.h> #include <VasEBoot/efi/uga_draw.h>
#include <grub/efi/graphics_output.h> #include <VasEBoot/efi/graphics_output.h>
#include <grub/efi/console_control.h> #include <VasEBoot/efi/console_control.h>
#include <grub/command.h> #include <VasEBoot/command.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
struct known_protocol struct known_protocol
{ {
grub_efi_guid_t guid; VasEBoot_efi_guid_t guid;
const char *name; const char *name;
} known_protocols[] = } known_protocols[] =
{ {
{ GRUB_EFI_DISK_IO_GUID, "disk" }, { VasEBoot_EFI_DISK_IO_GUID, "disk" },
{ GRUB_EFI_BLOCK_IO_GUID, "block" }, { VasEBoot_EFI_BLOCK_IO_GUID, "block" },
{ GRUB_EFI_SERIAL_IO_GUID, "serial" }, { VasEBoot_EFI_SERIAL_IO_GUID, "serial" },
{ GRUB_EFI_SIMPLE_NETWORK_GUID, "network" }, { VasEBoot_EFI_SIMPLE_NETWORK_GUID, "network" },
{ GRUB_EFI_PXE_GUID, "pxe" }, { VasEBoot_EFI_PXE_GUID, "pxe" },
{ GRUB_EFI_DEVICE_PATH_GUID, "device path" }, { VasEBoot_EFI_DEVICE_PATH_GUID, "device path" },
{ GRUB_EFI_PCI_IO_GUID, "PCI" }, { VasEBoot_EFI_PCI_IO_GUID, "PCI" },
{ GRUB_EFI_PCI_ROOT_IO_GUID, "PCI root" }, { VasEBoot_EFI_PCI_ROOT_IO_GUID, "PCI root" },
{ GRUB_EFI_EDID_ACTIVE_GUID, "active EDID" }, { VasEBoot_EFI_EDID_ACTIVE_GUID, "active EDID" },
{ GRUB_EFI_EDID_DISCOVERED_GUID, "discovered EDID" }, { VasEBoot_EFI_EDID_DISCOVERED_GUID, "discovered EDID" },
{ GRUB_EFI_EDID_OVERRIDE_GUID, "override EDID" }, { VasEBoot_EFI_EDID_OVERRIDE_GUID, "override EDID" },
{ GRUB_EFI_GOP_GUID, "GOP" }, { VasEBoot_EFI_GOP_GUID, "GOP" },
{ GRUB_EFI_UGA_DRAW_GUID, "UGA draw" }, { VasEBoot_EFI_UGA_DRAW_GUID, "UGA draw" },
{ GRUB_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID, "simple text output" }, { VasEBoot_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID, "simple text output" },
{ GRUB_EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID, "simple text input" }, { VasEBoot_EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID, "simple text input" },
{ GRUB_EFI_SIMPLE_POINTER_PROTOCOL_GUID, "simple pointer" }, { VasEBoot_EFI_SIMPLE_POINTER_PROTOCOL_GUID, "simple pointer" },
{ GRUB_EFI_CONSOLE_CONTROL_GUID, "console control" }, { VasEBoot_EFI_CONSOLE_CONTROL_GUID, "console control" },
{ GRUB_EFI_ABSOLUTE_POINTER_PROTOCOL_GUID, "absolute pointer" }, { VasEBoot_EFI_ABSOLUTE_POINTER_PROTOCOL_GUID, "absolute pointer" },
{ GRUB_EFI_DRIVER_BINDING_PROTOCOL_GUID, "EFI driver binding" }, { VasEBoot_EFI_DRIVER_BINDING_PROTOCOL_GUID, "EFI driver binding" },
{ GRUB_EFI_LOAD_FILE_PROTOCOL_GUID, "load file" }, { VasEBoot_EFI_LOAD_FILE_PROTOCOL_GUID, "load file" },
{ GRUB_EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID, "simple FS" }, { VasEBoot_EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID, "simple FS" },
{ GRUB_EFI_TAPE_IO_PROTOCOL_GUID, "tape I/O" }, { VasEBoot_EFI_TAPE_IO_PROTOCOL_GUID, "tape I/O" },
{ GRUB_EFI_UNICODE_COLLATION_PROTOCOL_GUID, "unicode collation" }, { VasEBoot_EFI_UNICODE_COLLATION_PROTOCOL_GUID, "unicode collation" },
{ GRUB_EFI_SCSI_IO_PROTOCOL_GUID, "SCSI I/O" }, { VasEBoot_EFI_SCSI_IO_PROTOCOL_GUID, "SCSI I/O" },
{ GRUB_EFI_USB2_HC_PROTOCOL_GUID, "USB host" }, { VasEBoot_EFI_USB2_HC_PROTOCOL_GUID, "USB host" },
{ GRUB_EFI_DEBUG_SUPPORT_PROTOCOL_GUID, "debug support" }, { VasEBoot_EFI_DEBUG_SUPPORT_PROTOCOL_GUID, "debug support" },
{ GRUB_EFI_DEBUGPORT_PROTOCOL_GUID, "debug port" }, { VasEBoot_EFI_DEBUGPORT_PROTOCOL_GUID, "debug port" },
{ GRUB_EFI_DECOMPRESS_PROTOCOL_GUID, "decompress" }, { VasEBoot_EFI_DECOMPRESS_PROTOCOL_GUID, "decompress" },
{ GRUB_EFI_LOADED_IMAGE_PROTOCOL_GUID, "loaded image" }, { VasEBoot_EFI_LOADED_IMAGE_PROTOCOL_GUID, "loaded image" },
{ GRUB_EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID, "device path to text" }, { VasEBoot_EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID, "device path to text" },
{ GRUB_EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID, "device path utilities" }, { VasEBoot_EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID, "device path utilities" },
{ GRUB_EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID, "device path from text" }, { VasEBoot_EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID, "device path from text" },
{ GRUB_EFI_HII_CONFIG_ROUTING_PROTOCOL_GUID, "HII config routing" }, { VasEBoot_EFI_HII_CONFIG_ROUTING_PROTOCOL_GUID, "HII config routing" },
{ GRUB_EFI_HII_DATABASE_PROTOCOL_GUID, "HII database" }, { VasEBoot_EFI_HII_DATABASE_PROTOCOL_GUID, "HII database" },
{ GRUB_EFI_HII_STRING_PROTOCOL_GUID, "HII string" }, { VasEBoot_EFI_HII_STRING_PROTOCOL_GUID, "HII string" },
{ GRUB_EFI_HII_IMAGE_PROTOCOL_GUID, "HII image" }, { VasEBoot_EFI_HII_IMAGE_PROTOCOL_GUID, "HII image" },
{ GRUB_EFI_HII_FONT_PROTOCOL_GUID, "HII font" }, { VasEBoot_EFI_HII_FONT_PROTOCOL_GUID, "HII font" },
{ GRUB_EFI_COMPONENT_NAME2_PROTOCOL_GUID, "component name 2" }, { VasEBoot_EFI_COMPONENT_NAME2_PROTOCOL_GUID, "component name 2" },
{ GRUB_EFI_HII_CONFIGURATION_ACCESS_PROTOCOL_GUID, { VasEBoot_EFI_HII_CONFIGURATION_ACCESS_PROTOCOL_GUID,
"HII configuration access" }, "HII configuration access" },
{ GRUB_EFI_USB_IO_PROTOCOL_GUID, "USB I/O" }, { VasEBoot_EFI_USB_IO_PROTOCOL_GUID, "USB I/O" },
}; };
static grub_err_t static VasEBoot_err_t
grub_cmd_lsefi (grub_command_t cmd __attribute__ ((unused)), VasEBoot_cmd_lsefi (VasEBoot_command_t cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)), int argc __attribute__ ((unused)),
char **args __attribute__ ((unused))) char **args __attribute__ ((unused)))
{ {
grub_efi_handle_t *handles; VasEBoot_efi_handle_t *handles;
grub_efi_uintn_t num_handles; VasEBoot_efi_uintn_t num_handles;
unsigned i, j, k; unsigned i, j, k;
handles = grub_efi_locate_handle (GRUB_EFI_ALL_HANDLES, handles = VasEBoot_efi_locate_handle (VasEBoot_EFI_ALL_HANDLES,
NULL, NULL, &num_handles); NULL, NULL, &num_handles);
for (i = 0; i < num_handles; i++) for (i = 0; i < num_handles; i++)
{ {
grub_efi_handle_t handle = handles[i]; VasEBoot_efi_handle_t handle = handles[i];
grub_efi_status_t status; VasEBoot_efi_status_t status;
grub_efi_uintn_t num_protocols; VasEBoot_efi_uintn_t num_protocols;
grub_efi_packed_guid_t **protocols; VasEBoot_efi_packed_guid_t **protocols;
grub_efi_device_path_t *dp; VasEBoot_efi_device_path_t *dp;
grub_printf ("Handle %p\n", handle); VasEBoot_printf ("Handle %p\n", handle);
dp = grub_efi_get_device_path (handle); dp = VasEBoot_efi_get_device_path (handle);
if (dp) if (dp)
{ {
grub_printf (" "); VasEBoot_printf (" ");
grub_efi_print_device_path (dp); VasEBoot_efi_print_device_path (dp);
} }
status = efi_call_3 (grub_efi_system_table->boot_services->protocols_per_handle, status = efi_call_3 (VasEBoot_efi_system_table->boot_services->protocols_per_handle,
handle, &protocols, &num_protocols); handle, &protocols, &num_protocols);
if (status != GRUB_EFI_SUCCESS) if (status != VasEBoot_EFI_SUCCESS)
grub_printf ("Unable to retrieve protocols\n"); VasEBoot_printf ("Unable to retrieve protocols\n");
for (j = 0; j < num_protocols; j++) for (j = 0; j < num_protocols; j++)
{ {
for (k = 0; k < ARRAY_SIZE (known_protocols); k++) for (k = 0; k < ARRAY_SIZE (known_protocols); k++)
if (grub_memcmp (protocols[j], &known_protocols[k].guid, if (VasEBoot_memcmp (protocols[j], &known_protocols[k].guid,
sizeof (known_protocols[k].guid)) == 0) sizeof (known_protocols[k].guid)) == 0)
break; break;
if (k < ARRAY_SIZE (known_protocols)) if (k < ARRAY_SIZE (known_protocols))
grub_printf (" %s\n", known_protocols[k].name); VasEBoot_printf (" %s\n", known_protocols[k].name);
else else
grub_printf (" %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x\n", VasEBoot_printf (" %08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x\n",
protocols[j]->data1, protocols[j]->data1,
protocols[j]->data2, protocols[j]->data2,
protocols[j]->data3, protocols[j]->data3,
@ -139,15 +139,15 @@ grub_cmd_lsefi (grub_command_t cmd __attribute__ ((unused)),
return 0; return 0;
} }
static grub_command_t cmd; static VasEBoot_command_t cmd;
GRUB_MOD_INIT(lsefi) VasEBoot_MOD_INIT(lsefi)
{ {
cmd = grub_register_command ("lsefi", grub_cmd_lsefi, cmd = VasEBoot_register_command ("lsefi", VasEBoot_cmd_lsefi,
NULL, "Display EFI handles."); NULL, "Display EFI handles.");
} }
GRUB_MOD_FINI(lsefi) VasEBoot_MOD_FINI(lsefi)
{ {
grub_unregister_command (cmd); VasEBoot_unregister_command (cmd);
} }

View File

@ -1,55 +1,55 @@
/* lsefimemmap.c - Display memory map. */ /* lsefimemmap.c - Display memory map. */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2008 Free Software Foundation, Inc. * Copyright (C) 2008 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/types.h> #include <VasEBoot/types.h>
#include <grub/mm.h> #include <VasEBoot/mm.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/efi/api.h> #include <VasEBoot/efi/api.h>
#include <grub/efi/efi.h> #include <VasEBoot/efi/efi.h>
#include <grub/command.h> #include <VasEBoot/command.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
#define ADD_MEMORY_DESCRIPTOR(desc, size) \ #define ADD_MEMORY_DESCRIPTOR(desc, size) \
((grub_efi_memory_descriptor_t *) ((char *) (desc) + (size))) ((VasEBoot_efi_memory_descriptor_t *) ((char *) (desc) + (size)))
static grub_err_t static VasEBoot_err_t
grub_cmd_lsefimmap (grub_command_t cmd __attribute__ ((unused)), VasEBoot_cmd_lsefimmap (VasEBoot_command_t cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)), int argc __attribute__ ((unused)),
char **args __attribute__ ((unused))) char **args __attribute__ ((unused)))
{ {
grub_efi_uintn_t map_size; VasEBoot_efi_uintn_t map_size;
grub_efi_memory_descriptor_t *memory_map; VasEBoot_efi_memory_descriptor_t *memory_map;
grub_efi_memory_descriptor_t *memory_map_end; VasEBoot_efi_memory_descriptor_t *memory_map_end;
grub_efi_memory_descriptor_t *desc; VasEBoot_efi_memory_descriptor_t *desc;
grub_efi_uintn_t desc_size; VasEBoot_efi_uintn_t desc_size;
map_size = 0; map_size = 0;
if (grub_efi_get_memory_map (&map_size, NULL, NULL, &desc_size, 0) < 0) if (VasEBoot_efi_get_memory_map (&map_size, NULL, NULL, &desc_size, 0) < 0)
return 0; return 0;
memory_map = grub_malloc (map_size); memory_map = VasEBoot_malloc (map_size);
if (memory_map == NULL) if (memory_map == NULL)
return grub_errno; return VasEBoot_errno;
if (grub_efi_get_memory_map (&map_size, memory_map, NULL, &desc_size, 0) <= 0) if (VasEBoot_efi_get_memory_map (&map_size, memory_map, NULL, &desc_size, 0) <= 0)
goto fail; goto fail;
grub_printf VasEBoot_printf
("Type Physical start - end #Pages " ("Type Physical start - end #Pages "
" Size Attributes\n"); " Size Attributes\n");
memory_map_end = ADD_MEMORY_DESCRIPTOR (memory_map, map_size); memory_map_end = ADD_MEMORY_DESCRIPTOR (memory_map, map_size);
@ -57,8 +57,8 @@ grub_cmd_lsefimmap (grub_command_t cmd __attribute__ ((unused)),
desc < memory_map_end; desc < memory_map_end;
desc = ADD_MEMORY_DESCRIPTOR (desc, desc_size)) desc = ADD_MEMORY_DESCRIPTOR (desc, desc_size))
{ {
grub_efi_uint64_t size; VasEBoot_efi_uint64_t size;
grub_efi_uint64_t attr; VasEBoot_efi_uint64_t attr;
static const char types_str[][9] = static const char types_str[][9] =
{ {
"reserved", "reserved",
@ -78,12 +78,12 @@ grub_cmd_lsefimmap (grub_command_t cmd __attribute__ ((unused)),
"persist ", "persist ",
}; };
if (desc->type < ARRAY_SIZE (types_str)) if (desc->type < ARRAY_SIZE (types_str))
grub_printf ("%s ", types_str[desc->type]); VasEBoot_printf ("%s ", types_str[desc->type]);
else else
grub_printf ("Unk %02x ", desc->type); VasEBoot_printf ("Unk %02x ", desc->type);
grub_printf (" %016" PRIxGRUB_UINT64_T "-%016" PRIxGRUB_UINT64_T VasEBoot_printf (" %016" PRIxVasEBoot_UINT64_T "-%016" PRIxVasEBoot_UINT64_T
" %08" PRIxGRUB_UINT64_T, " %08" PRIxVasEBoot_UINT64_T,
desc->physical_start, desc->physical_start,
desc->physical_start + (desc->num_pages << 12) - 1, desc->physical_start + (desc->num_pages << 12) - 1,
desc->num_pages); desc->num_pages);
@ -100,61 +100,61 @@ grub_cmd_lsefimmap (grub_command_t cmd __attribute__ ((unused)),
* columns will be off if not, but this is preferable to rounding. * columns will be off if not, but this is preferable to rounding.
*/ */
if (size & 0xfffff) if (size & 0xfffff)
grub_printf (" %6" PRIuGRUB_UINT64_T "KiB", size >> 10); VasEBoot_printf (" %6" PRIuVasEBoot_UINT64_T "KiB", size >> 10);
else if (size & 0x3fffffff) else if (size & 0x3fffffff)
grub_printf (" %6" PRIuGRUB_UINT64_T "MiB", size >> 20); VasEBoot_printf (" %6" PRIuVasEBoot_UINT64_T "MiB", size >> 20);
else if (size & 0xffffffffff) else if (size & 0xffffffffff)
grub_printf (" %6" PRIuGRUB_UINT64_T "GiB", size >> 30); VasEBoot_printf (" %6" PRIuVasEBoot_UINT64_T "GiB", size >> 30);
else if (size & 0x3ffffffffffff) else if (size & 0x3ffffffffffff)
grub_printf (" %6" PRIuGRUB_UINT64_T "TiB", size >> 40); VasEBoot_printf (" %6" PRIuVasEBoot_UINT64_T "TiB", size >> 40);
else if (size & 0xfffffffffffffff) else if (size & 0xfffffffffffffff)
grub_printf (" %6" PRIuGRUB_UINT64_T "PiB", size >> 50); VasEBoot_printf (" %6" PRIuVasEBoot_UINT64_T "PiB", size >> 50);
else else
grub_printf (" %6" PRIuGRUB_UINT64_T "EiB", size >> 60); VasEBoot_printf (" %6" PRIuVasEBoot_UINT64_T "EiB", size >> 60);
attr = desc->attribute; attr = desc->attribute;
if (attr & GRUB_EFI_MEMORY_RUNTIME) if (attr & VasEBoot_EFI_MEMORY_RUNTIME)
grub_printf (" RT"); VasEBoot_printf (" RT");
if (attr & GRUB_EFI_MEMORY_UC) if (attr & VasEBoot_EFI_MEMORY_UC)
grub_printf (" UC"); VasEBoot_printf (" UC");
if (attr & GRUB_EFI_MEMORY_WC) if (attr & VasEBoot_EFI_MEMORY_WC)
grub_printf (" WC"); VasEBoot_printf (" WC");
if (attr & GRUB_EFI_MEMORY_WT) if (attr & VasEBoot_EFI_MEMORY_WT)
grub_printf (" WT"); VasEBoot_printf (" WT");
if (attr & GRUB_EFI_MEMORY_WB) if (attr & VasEBoot_EFI_MEMORY_WB)
grub_printf (" WB"); VasEBoot_printf (" WB");
if (attr & GRUB_EFI_MEMORY_UCE) if (attr & VasEBoot_EFI_MEMORY_UCE)
grub_printf (" UCE"); VasEBoot_printf (" UCE");
if (attr & GRUB_EFI_MEMORY_WP) if (attr & VasEBoot_EFI_MEMORY_WP)
grub_printf (" WP"); VasEBoot_printf (" WP");
if (attr & GRUB_EFI_MEMORY_RP) if (attr & VasEBoot_EFI_MEMORY_RP)
grub_printf (" RP"); VasEBoot_printf (" RP");
if (attr & GRUB_EFI_MEMORY_XP) if (attr & VasEBoot_EFI_MEMORY_XP)
grub_printf (" XP"); VasEBoot_printf (" XP");
if (attr & GRUB_EFI_MEMORY_NV) if (attr & VasEBoot_EFI_MEMORY_NV)
grub_printf (" NV"); VasEBoot_printf (" NV");
if (attr & GRUB_EFI_MEMORY_MORE_RELIABLE) if (attr & VasEBoot_EFI_MEMORY_MORE_RELIABLE)
grub_printf (" MR"); VasEBoot_printf (" MR");
if (attr & GRUB_EFI_MEMORY_RO) if (attr & VasEBoot_EFI_MEMORY_RO)
grub_printf (" RO"); VasEBoot_printf (" RO");
grub_printf ("\n"); VasEBoot_printf ("\n");
} }
fail: fail:
grub_free (memory_map); VasEBoot_free (memory_map);
return 0; return 0;
} }
static grub_command_t cmd; static VasEBoot_command_t cmd;
GRUB_MOD_INIT(lsefimmap) VasEBoot_MOD_INIT(lsefimmap)
{ {
cmd = grub_register_command ("lsefimmap", grub_cmd_lsefimmap, cmd = VasEBoot_register_command ("lsefimmap", VasEBoot_cmd_lsefimmap,
"", "Display EFI memory map."); "", "Display EFI memory map.");
} }
GRUB_MOD_FINI(lsefimmap) VasEBoot_MOD_FINI(lsefimmap)
{ {
grub_unregister_command (cmd); VasEBoot_unregister_command (cmd);
} }

View File

@ -1,122 +1,122 @@
/* lsefisystab.c - Display EFI systab. */ /* lsefisystab.c - Display EFI systab. */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2008 Free Software Foundation, Inc. * Copyright (C) 2008 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/types.h> #include <VasEBoot/types.h>
#include <grub/mm.h> #include <VasEBoot/mm.h>
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/normal.h> #include <VasEBoot/normal.h>
#include <grub/charset.h> #include <VasEBoot/charset.h>
#include <grub/efi/api.h> #include <VasEBoot/efi/api.h>
#include <grub/efi/efi.h> #include <VasEBoot/efi/efi.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
struct guid_mapping struct guid_mapping
{ {
grub_efi_guid_t guid; VasEBoot_efi_guid_t guid;
const char *name; const char *name;
}; };
static const struct guid_mapping guid_mappings[] = static const struct guid_mapping guid_mappings[] =
{ {
{ GRUB_EFI_ACPI_20_TABLE_GUID, "ACPI-2.0"}, { VasEBoot_EFI_ACPI_20_TABLE_GUID, "ACPI-2.0"},
{ GRUB_EFI_ACPI_TABLE_GUID, "ACPI-1.0"}, { VasEBoot_EFI_ACPI_TABLE_GUID, "ACPI-1.0"},
{ GRUB_EFI_CRC32_GUIDED_SECTION_EXTRACTION_GUID, { VasEBoot_EFI_CRC32_GUIDED_SECTION_EXTRACTION_GUID,
"CRC32 GUIDED SECTION EXTRACTION"}, "CRC32 GUIDED SECTION EXTRACTION"},
{ GRUB_EFI_DEBUG_IMAGE_INFO_TABLE_GUID, "DEBUG IMAGE INFO"}, { VasEBoot_EFI_DEBUG_IMAGE_INFO_TABLE_GUID, "DEBUG IMAGE INFO"},
{ GRUB_EFI_DXE_SERVICES_TABLE_GUID, "DXE SERVICES"}, { VasEBoot_EFI_DXE_SERVICES_TABLE_GUID, "DXE SERVICES"},
{ GRUB_EFI_HCDP_TABLE_GUID, "HCDP"}, { VasEBoot_EFI_HCDP_TABLE_GUID, "HCDP"},
{ GRUB_EFI_HOB_LIST_GUID, "HOB LIST"}, { VasEBoot_EFI_HOB_LIST_GUID, "HOB LIST"},
{ GRUB_EFI_LZMA_CUSTOM_DECOMPRESS_GUID, "LZMA CUSTOM DECOMPRESS"}, { VasEBoot_EFI_LZMA_CUSTOM_DECOMPRESS_GUID, "LZMA CUSTOM DECOMPRESS"},
{ GRUB_EFI_MEMORY_TYPE_INFORMATION_GUID, "MEMORY TYPE INFO"}, { VasEBoot_EFI_MEMORY_TYPE_INFORMATION_GUID, "MEMORY TYPE INFO"},
{ GRUB_EFI_MPS_TABLE_GUID, "MPS"}, { VasEBoot_EFI_MPS_TABLE_GUID, "MPS"},
{ GRUB_EFI_SAL_TABLE_GUID, "SAL"}, { VasEBoot_EFI_SAL_TABLE_GUID, "SAL"},
{ GRUB_EFI_SMBIOS_TABLE_GUID, "SMBIOS"}, { VasEBoot_EFI_SMBIOS_TABLE_GUID, "SMBIOS"},
{ GRUB_EFI_SMBIOS3_TABLE_GUID, "SMBIOS3"}, { VasEBoot_EFI_SMBIOS3_TABLE_GUID, "SMBIOS3"},
{ GRUB_EFI_SYSTEM_RESOURCE_TABLE_GUID, "SYSTEM RESOURCE TABLE"}, { VasEBoot_EFI_SYSTEM_RESOURCE_TABLE_GUID, "SYSTEM RESOURCE TABLE"},
{ GRUB_EFI_TIANO_CUSTOM_DECOMPRESS_GUID, "TIANO CUSTOM DECOMPRESS"}, { VasEBoot_EFI_TIANO_CUSTOM_DECOMPRESS_GUID, "TIANO CUSTOM DECOMPRESS"},
{ GRUB_EFI_TSC_FREQUENCY_GUID, "TSC FREQUENCY"}, { VasEBoot_EFI_TSC_FREQUENCY_GUID, "TSC FREQUENCY"},
}; };
static grub_err_t static VasEBoot_err_t
grub_cmd_lsefisystab (struct grub_command *cmd __attribute__ ((unused)), VasEBoot_cmd_lsefisystab (struct VasEBoot_command *cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)), int argc __attribute__ ((unused)),
char **args __attribute__ ((unused))) char **args __attribute__ ((unused)))
{ {
const grub_efi_system_table_t *st = grub_efi_system_table; const VasEBoot_efi_system_table_t *st = VasEBoot_efi_system_table;
grub_efi_configuration_table_t *t; VasEBoot_efi_configuration_table_t *t;
unsigned int i; unsigned int i;
grub_printf ("Address: %p\n", st); VasEBoot_printf ("Address: %p\n", st);
grub_printf ("Signature: %016" PRIxGRUB_UINT64_T " revision: %08x\n", VasEBoot_printf ("Signature: %016" PRIxVasEBoot_UINT64_T " revision: %08x\n",
st->hdr.signature, st->hdr.revision); st->hdr.signature, st->hdr.revision);
{ {
char *vendor; char *vendor;
grub_uint16_t *vendor_utf16; VasEBoot_uint16_t *vendor_utf16;
grub_printf ("Vendor: "); VasEBoot_printf ("Vendor: ");
for (vendor_utf16 = st->firmware_vendor; *vendor_utf16; vendor_utf16++); for (vendor_utf16 = st->firmware_vendor; *vendor_utf16; vendor_utf16++);
vendor = grub_malloc (4 * (vendor_utf16 - st->firmware_vendor) + 1); vendor = VasEBoot_malloc (4 * (vendor_utf16 - st->firmware_vendor) + 1);
if (!vendor) if (!vendor)
return grub_errno; return VasEBoot_errno;
*grub_utf16_to_utf8 ((grub_uint8_t *) vendor, st->firmware_vendor, *VasEBoot_utf16_to_utf8 ((VasEBoot_uint8_t *) vendor, st->firmware_vendor,
vendor_utf16 - st->firmware_vendor) = 0; vendor_utf16 - st->firmware_vendor) = 0;
grub_printf ("%s", vendor); VasEBoot_printf ("%s", vendor);
grub_free (vendor); VasEBoot_free (vendor);
} }
grub_printf (", Version=%x\n", st->firmware_revision); VasEBoot_printf (", Version=%x\n", st->firmware_revision);
grub_printf ("%lld tables:\n", (long long) st->num_table_entries); VasEBoot_printf ("%lld tables:\n", (long long) st->num_table_entries);
t = st->configuration_table; t = st->configuration_table;
for (i = 0; i < st->num_table_entries; i++) for (i = 0; i < st->num_table_entries; i++)
{ {
unsigned int j; unsigned int j;
grub_printf ("%p ", t->vendor_table); VasEBoot_printf ("%p ", t->vendor_table);
grub_printf ("%08x-%04x-%04x-", VasEBoot_printf ("%08x-%04x-%04x-",
t->vendor_guid.data1, t->vendor_guid.data2, t->vendor_guid.data1, t->vendor_guid.data2,
t->vendor_guid.data3); t->vendor_guid.data3);
for (j = 0; j < 8; j++) for (j = 0; j < 8; j++)
grub_printf ("%02x", t->vendor_guid.data4[j]); VasEBoot_printf ("%02x", t->vendor_guid.data4[j]);
for (j = 0; j < ARRAY_SIZE (guid_mappings); j++) for (j = 0; j < ARRAY_SIZE (guid_mappings); j++)
if (grub_memcmp (&guid_mappings[j].guid, &t->vendor_guid, if (VasEBoot_memcmp (&guid_mappings[j].guid, &t->vendor_guid,
sizeof (grub_efi_guid_t)) == 0) sizeof (VasEBoot_efi_guid_t)) == 0)
grub_printf (" %s", guid_mappings[j].name); VasEBoot_printf (" %s", guid_mappings[j].name);
grub_printf ("\n"); VasEBoot_printf ("\n");
t++; t++;
} }
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
} }
static grub_command_t cmd; static VasEBoot_command_t cmd;
GRUB_MOD_INIT(lsefisystab) VasEBoot_MOD_INIT(lsefisystab)
{ {
cmd = grub_register_command ("lsefisystab", grub_cmd_lsefisystab, cmd = VasEBoot_register_command ("lsefisystab", VasEBoot_cmd_lsefisystab,
"", "Display EFI system tables."); "", "Display EFI system tables.");
} }
GRUB_MOD_FINI(lsefisystab) VasEBoot_MOD_FINI(lsefisystab)
{ {
grub_unregister_command (cmd); VasEBoot_unregister_command (cmd);
} }

View File

@ -1,169 +1,169 @@
/* lssal.c - Display EFI SAL systab. */ /* lssal.c - Display EFI SAL systab. */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2008 Free Software Foundation, Inc. * Copyright (C) 2008 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/types.h> #include <VasEBoot/types.h>
#include <grub/mm.h> #include <VasEBoot/mm.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/normal.h> #include <VasEBoot/normal.h>
#include <grub/charset.h> #include <VasEBoot/charset.h>
#include <grub/efi/api.h> #include <VasEBoot/efi/api.h>
#include <grub/efi/efi.h> #include <VasEBoot/efi/efi.h>
#include <grub/dl.h> #include <VasEBoot/dl.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static void static void
disp_sal (void *table) disp_sal (void *table)
{ {
struct grub_efi_sal_system_table *t = table; struct VasEBoot_efi_sal_system_table *t = table;
void *desc; void *desc;
grub_uint32_t len, l, i; VasEBoot_uint32_t len, l, i;
grub_printf ("SAL rev: %02x, signature: %x, len:%x\n", VasEBoot_printf ("SAL rev: %02x, signature: %x, len:%x\n",
t->sal_rev, t->signature, t->total_table_len); t->sal_rev, t->signature, t->total_table_len);
grub_printf ("nbr entry: %d, chksum: %02x, SAL version A: %02x B: %02x\n", VasEBoot_printf ("nbr entry: %d, chksum: %02x, SAL version A: %02x B: %02x\n",
t->entry_count, t->checksum, t->entry_count, t->checksum,
t->sal_a_version, t->sal_b_version); t->sal_a_version, t->sal_b_version);
grub_printf ("OEM-ID: %-32s\n", t->oem_id); VasEBoot_printf ("OEM-ID: %-32s\n", t->oem_id);
grub_printf ("Product-ID: %-32s\n", t->product_id); VasEBoot_printf ("Product-ID: %-32s\n", t->product_id);
desc = t->entries; desc = t->entries;
len = t->total_table_len - sizeof (struct grub_efi_sal_system_table); len = t->total_table_len - sizeof (struct VasEBoot_efi_sal_system_table);
if (t->total_table_len <= sizeof (struct grub_efi_sal_system_table)) if (t->total_table_len <= sizeof (struct VasEBoot_efi_sal_system_table))
return; return;
for (i = 0; i < t->entry_count; i++) for (i = 0; i < t->entry_count; i++)
{ {
switch (*(grub_uint8_t *) desc) switch (*(VasEBoot_uint8_t *) desc)
{ {
case GRUB_EFI_SAL_SYSTEM_TABLE_TYPE_ENTRYPOINT_DESCRIPTOR: case VasEBoot_EFI_SAL_SYSTEM_TABLE_TYPE_ENTRYPOINT_DESCRIPTOR:
{ {
struct grub_efi_sal_system_table_entrypoint_descriptor *c = desc; struct VasEBoot_efi_sal_system_table_entrypoint_descriptor *c = desc;
l = sizeof (*c); l = sizeof (*c);
grub_printf (" Entry point: PAL=%016" PRIxGRUB_UINT64_T VasEBoot_printf (" Entry point: PAL=%016" PRIxVasEBoot_UINT64_T
" SAL=%016" PRIxGRUB_UINT64_T " GP=%016" " SAL=%016" PRIxVasEBoot_UINT64_T " GP=%016"
PRIxGRUB_UINT64_T "\n", PRIxVasEBoot_UINT64_T "\n",
c->pal_proc_addr, c->sal_proc_addr, c->pal_proc_addr, c->sal_proc_addr,
c->global_data_ptr); c->global_data_ptr);
} }
break; break;
case GRUB_EFI_SAL_SYSTEM_TABLE_TYPE_MEMORY_DESCRIPTOR: case VasEBoot_EFI_SAL_SYSTEM_TABLE_TYPE_MEMORY_DESCRIPTOR:
{ {
struct grub_efi_sal_system_table_memory_descriptor *c = desc; struct VasEBoot_efi_sal_system_table_memory_descriptor *c = desc;
l = sizeof (*c); l = sizeof (*c);
grub_printf (" Memory descriptor entry addr=%016" PRIxGRUB_UINT64_T VasEBoot_printf (" Memory descriptor entry addr=%016" PRIxVasEBoot_UINT64_T
" len=%" PRIuGRUB_UINT64_T "KB\n", " len=%" PRIuVasEBoot_UINT64_T "KB\n",
c->addr, c->len * 4); c->addr, c->len * 4);
grub_printf (" sal_used=%d attr=%x AR=%x attr_mask=%x " VasEBoot_printf (" sal_used=%d attr=%x AR=%x attr_mask=%x "
"type=%x usage=%x\n", "type=%x usage=%x\n",
c->sal_used, c->attr, c->ar, c->attr_mask, c->mem_type, c->sal_used, c->attr, c->ar, c->attr_mask, c->mem_type,
c->usage); c->usage);
} }
break; break;
case GRUB_EFI_SAL_SYSTEM_TABLE_TYPE_PLATFORM_FEATURES: case VasEBoot_EFI_SAL_SYSTEM_TABLE_TYPE_PLATFORM_FEATURES:
{ {
struct grub_efi_sal_system_table_platform_features *c = desc; struct VasEBoot_efi_sal_system_table_platform_features *c = desc;
l = sizeof (*c); l = sizeof (*c);
grub_printf (" Platform features: %02x", c->flags); VasEBoot_printf (" Platform features: %02x", c->flags);
if (c->flags & GRUB_EFI_SAL_SYSTEM_TABLE_PLATFORM_FEATURE_BUSLOCK) if (c->flags & VasEBoot_EFI_SAL_SYSTEM_TABLE_PLATFORM_FEATURE_BUSLOCK)
grub_printf (" BusLock"); VasEBoot_printf (" BusLock");
if (c->flags & GRUB_EFI_SAL_SYSTEM_TABLE_PLATFORM_FEATURE_IRQREDIRECT) if (c->flags & VasEBoot_EFI_SAL_SYSTEM_TABLE_PLATFORM_FEATURE_IRQREDIRECT)
grub_printf (" IrqRedirect"); VasEBoot_printf (" IrqRedirect");
if (c->flags & GRUB_EFI_SAL_SYSTEM_TABLE_PLATFORM_FEATURE_IPIREDIRECT) if (c->flags & VasEBoot_EFI_SAL_SYSTEM_TABLE_PLATFORM_FEATURE_IPIREDIRECT)
grub_printf (" IPIRedirect"); VasEBoot_printf (" IPIRedirect");
if (c->flags & GRUB_EFI_SAL_SYSTEM_TABLE_PLATFORM_FEATURE_ITCDRIFT) if (c->flags & VasEBoot_EFI_SAL_SYSTEM_TABLE_PLATFORM_FEATURE_ITCDRIFT)
grub_printf (" ITCDrift"); VasEBoot_printf (" ITCDrift");
grub_printf ("\n"); VasEBoot_printf ("\n");
} }
break; break;
case GRUB_EFI_SAL_SYSTEM_TABLE_TYPE_TRANSLATION_REGISTER_DESCRIPTOR: case VasEBoot_EFI_SAL_SYSTEM_TABLE_TYPE_TRANSLATION_REGISTER_DESCRIPTOR:
{ {
struct grub_efi_sal_system_table_translation_register_descriptor *c struct VasEBoot_efi_sal_system_table_translation_register_descriptor *c
= desc; = desc;
l = sizeof (*c); l = sizeof (*c);
grub_printf (" TR type=%d num=%d va=%016" PRIxGRUB_UINT64_T VasEBoot_printf (" TR type=%d num=%d va=%016" PRIxVasEBoot_UINT64_T
" pte=%016" PRIxGRUB_UINT64_T "\n", " pte=%016" PRIxVasEBoot_UINT64_T "\n",
c->register_type, c->register_number, c->register_type, c->register_number,
c->addr, c->page_size); c->addr, c->page_size);
} }
break; break;
case GRUB_EFI_SAL_SYSTEM_TABLE_TYPE_PURGE_TRANSLATION_COHERENCE: case VasEBoot_EFI_SAL_SYSTEM_TABLE_TYPE_PURGE_TRANSLATION_COHERENCE:
{ {
struct grub_efi_sal_system_table_purge_translation_coherence *c struct VasEBoot_efi_sal_system_table_purge_translation_coherence *c
= desc; = desc;
l = sizeof (*c); l = sizeof (*c);
grub_printf (" PTC coherence nbr=%d addr=%016" PRIxGRUB_UINT64_T "\n", VasEBoot_printf (" PTC coherence nbr=%d addr=%016" PRIxVasEBoot_UINT64_T "\n",
c->ndomains, c->coherence); c->ndomains, c->coherence);
} }
break; break;
case GRUB_EFI_SAL_SYSTEM_TABLE_TYPE_AP_WAKEUP: case VasEBoot_EFI_SAL_SYSTEM_TABLE_TYPE_AP_WAKEUP:
{ {
struct grub_efi_sal_system_table_ap_wakeup *c = desc; struct VasEBoot_efi_sal_system_table_ap_wakeup *c = desc;
l = sizeof (*c); l = sizeof (*c);
grub_printf (" AP wake-up: mec=%d vect=%" PRIxGRUB_UINT64_T "\n", VasEBoot_printf (" AP wake-up: mec=%d vect=%" PRIxVasEBoot_UINT64_T "\n",
c->mechanism, c->vector); c->mechanism, c->vector);
} }
break; break;
default: default:
grub_printf (" unknown entry 0x%x\n", *(grub_uint8_t *)desc); VasEBoot_printf (" unknown entry 0x%x\n", *(VasEBoot_uint8_t *)desc);
return; return;
} }
desc = (grub_uint8_t *)desc + l; desc = (VasEBoot_uint8_t *)desc + l;
if (len <= l) if (len <= l)
return; return;
len -= l; len -= l;
} }
} }
static grub_err_t static VasEBoot_err_t
grub_cmd_lssal (struct grub_command *cmd __attribute__ ((unused)), VasEBoot_cmd_lssal (struct VasEBoot_command *cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)), int argc __attribute__ ((unused)),
char **args __attribute__ ((unused))) char **args __attribute__ ((unused)))
{ {
const grub_efi_system_table_t *st = grub_efi_system_table; const VasEBoot_efi_system_table_t *st = VasEBoot_efi_system_table;
grub_efi_configuration_table_t *t = st->configuration_table; VasEBoot_efi_configuration_table_t *t = st->configuration_table;
unsigned int i; unsigned int i;
grub_efi_packed_guid_t guid = GRUB_EFI_SAL_TABLE_GUID; VasEBoot_efi_packed_guid_t guid = VasEBoot_EFI_SAL_TABLE_GUID;
for (i = 0; i < st->num_table_entries; i++) for (i = 0; i < st->num_table_entries; i++)
{ {
if (grub_memcmp (&guid, &t->vendor_guid, if (VasEBoot_memcmp (&guid, &t->vendor_guid,
sizeof (grub_efi_packed_guid_t)) == 0) sizeof (VasEBoot_efi_packed_guid_t)) == 0)
{ {
disp_sal (t->vendor_table); disp_sal (t->vendor_table);
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
} }
t++; t++;
} }
grub_printf ("SAL not found\n"); VasEBoot_printf ("SAL not found\n");
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
} }
static grub_command_t cmd; static VasEBoot_command_t cmd;
GRUB_MOD_INIT(lssal) VasEBoot_MOD_INIT(lssal)
{ {
cmd = grub_register_command ("lssal", grub_cmd_lssal, "", cmd = VasEBoot_register_command ("lssal", VasEBoot_cmd_lssal, "",
"Display SAL system table."); "Display SAL system table.");
} }
GRUB_MOD_FINI(lssal) VasEBoot_MOD_FINI(lssal)
{ {
grub_unregister_command (cmd); VasEBoot_unregister_command (cmd);
} }

View File

@ -1,59 +1,59 @@
/* smbios.c - get smbios tables. */ /* smbios.c - get smbios tables. */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2015 Free Software Foundation, Inc. * Copyright (C) 2015 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/smbios.h> #include <VasEBoot/smbios.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/efi/efi.h> #include <VasEBoot/efi/efi.h>
#include <grub/efi/api.h> #include <VasEBoot/efi/api.h>
struct grub_smbios_eps * struct VasEBoot_smbios_eps *
grub_machine_smbios_get_eps (void) VasEBoot_machine_smbios_get_eps (void)
{ {
unsigned i; unsigned i;
static grub_efi_packed_guid_t smbios_guid = GRUB_EFI_SMBIOS_TABLE_GUID; static VasEBoot_efi_packed_guid_t smbios_guid = VasEBoot_EFI_SMBIOS_TABLE_GUID;
for (i = 0; i < grub_efi_system_table->num_table_entries; i++) for (i = 0; i < VasEBoot_efi_system_table->num_table_entries; i++)
{ {
grub_efi_packed_guid_t *guid = VasEBoot_efi_packed_guid_t *guid =
&grub_efi_system_table->configuration_table[i].vendor_guid; &VasEBoot_efi_system_table->configuration_table[i].vendor_guid;
if (! grub_memcmp (guid, &smbios_guid, sizeof (grub_efi_packed_guid_t))) if (! VasEBoot_memcmp (guid, &smbios_guid, sizeof (VasEBoot_efi_packed_guid_t)))
return (struct grub_smbios_eps *) return (struct VasEBoot_smbios_eps *)
grub_efi_system_table->configuration_table[i].vendor_table; VasEBoot_efi_system_table->configuration_table[i].vendor_table;
} }
return 0; return 0;
} }
struct grub_smbios_eps3 * struct VasEBoot_smbios_eps3 *
grub_machine_smbios_get_eps3 (void) VasEBoot_machine_smbios_get_eps3 (void)
{ {
unsigned i; unsigned i;
static grub_efi_packed_guid_t smbios3_guid = GRUB_EFI_SMBIOS3_TABLE_GUID; static VasEBoot_efi_packed_guid_t smbios3_guid = VasEBoot_EFI_SMBIOS3_TABLE_GUID;
for (i = 0; i < grub_efi_system_table->num_table_entries; i++) for (i = 0; i < VasEBoot_efi_system_table->num_table_entries; i++)
{ {
grub_efi_packed_guid_t *guid = VasEBoot_efi_packed_guid_t *guid =
&grub_efi_system_table->configuration_table[i].vendor_guid; &VasEBoot_efi_system_table->configuration_table[i].vendor_guid;
if (! grub_memcmp (guid, &smbios3_guid, sizeof (grub_efi_packed_guid_t))) if (! VasEBoot_memcmp (guid, &smbios3_guid, sizeof (VasEBoot_efi_packed_guid_t)))
return (struct grub_smbios_eps3 *) return (struct VasEBoot_smbios_eps3 *)
grub_efi_system_table->configuration_table[i].vendor_table; VasEBoot_efi_system_table->configuration_table[i].vendor_table;
} }
return 0; return 0;
} }

View File

@ -1,71 +1,71 @@
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc. * Copyright (C) 2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/script_sh.h> #include <VasEBoot/script_sh.h>
#include <grub/command.h> #include <VasEBoot/command.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
#include <grub/term.h> #include <VasEBoot/term.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static grub_err_t static VasEBoot_err_t
grub_cmd_eval (grub_command_t cmd __attribute__((__unused__)), VasEBoot_cmd_eval (VasEBoot_command_t cmd __attribute__((__unused__)),
int argc, char *argv[]) int argc, char *argv[])
{ {
int i; int i;
grub_size_t size = argc; /* +1 for final zero */ VasEBoot_size_t size = argc; /* +1 for final zero */
char *str, *p; char *str, *p;
grub_err_t ret; VasEBoot_err_t ret;
if (argc == 0) if (argc == 0)
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
for (i = 0; i < argc; i++) for (i = 0; i < argc; i++)
size += grub_strlen (argv[i]); size += VasEBoot_strlen (argv[i]);
str = p = grub_malloc (size); str = p = VasEBoot_malloc (size);
if (!str) if (!str)
return grub_errno; return VasEBoot_errno;
for (i = 0; i < argc; i++) for (i = 0; i < argc; i++)
{ {
p = grub_stpcpy (p, argv[i]); p = VasEBoot_stpcpy (p, argv[i]);
*p++ = ' '; *p++ = ' ';
} }
*--p = '\0'; *--p = '\0';
ret = grub_script_execute_sourcecode (str); ret = VasEBoot_script_execute_sourcecode (str);
grub_free (str); VasEBoot_free (str);
return ret; return ret;
} }
static grub_command_t cmd; static VasEBoot_command_t cmd;
GRUB_MOD_INIT(eval) VasEBoot_MOD_INIT(eval)
{ {
cmd = grub_register_command ("eval", grub_cmd_eval, N_("STRING ..."), cmd = VasEBoot_register_command ("eval", VasEBoot_cmd_eval, N_("STRING ..."),
N_("Evaluate arguments as GRUB commands")); N_("Evaluate arguments as VasEBoot commands"));
} }
GRUB_MOD_FINI(eval) VasEBoot_MOD_FINI(eval)
{ {
grub_unregister_command (cmd); VasEBoot_unregister_command (cmd);
} }

View File

@ -1,41 +1,41 @@
/* extcmd.c - support extended command */ /* extcmd.c - support extended command */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc. * Copyright (C) 2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/mm.h> #include <VasEBoot/mm.h>
#include <grub/list.h> #include <VasEBoot/list.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/extcmd.h> #include <VasEBoot/extcmd.h>
#include <grub/script_sh.h> #include <VasEBoot/script_sh.h>
#include <grub/dl.h> #include <VasEBoot/dl.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
grub_err_t VasEBoot_err_t
grub_extcmd_dispatcher (struct grub_command *cmd, int argc, char **args, VasEBoot_extcmd_dispatcher (struct VasEBoot_command *cmd, int argc, char **args,
struct grub_script *script) struct VasEBoot_script *script)
{ {
int new_argc; int new_argc;
char **new_args; char **new_args;
struct grub_arg_list *state; struct VasEBoot_arg_list *state;
struct grub_extcmd_context context; struct VasEBoot_extcmd_context context;
grub_err_t ret; VasEBoot_err_t ret;
grub_extcmd_t ext = cmd->data; VasEBoot_extcmd_t ext = cmd->data;
context.state = 0; context.state = 0;
context.extcmd = ext; context.extcmd = ext;
@ -47,49 +47,49 @@ grub_extcmd_dispatcher (struct grub_command *cmd, int argc, char **args,
return ret; return ret;
} }
state = grub_arg_list_alloc (ext, argc, args); state = VasEBoot_arg_list_alloc (ext, argc, args);
if (grub_arg_parse (ext, argc, args, state, &new_args, &new_argc)) if (VasEBoot_arg_parse (ext, argc, args, state, &new_args, &new_argc))
{ {
context.state = state; context.state = state;
ret = (ext->func) (&context, new_argc, new_args); ret = (ext->func) (&context, new_argc, new_args);
grub_free (new_args); VasEBoot_free (new_args);
grub_free (state); VasEBoot_free (state);
return ret; return ret;
} }
grub_free (state); VasEBoot_free (state);
return grub_errno; return VasEBoot_errno;
} }
static grub_err_t static VasEBoot_err_t
grub_extcmd_dispatch (struct grub_command *cmd, int argc, char **args) VasEBoot_extcmd_dispatch (struct VasEBoot_command *cmd, int argc, char **args)
{ {
return grub_extcmd_dispatcher (cmd, argc, args, 0); return VasEBoot_extcmd_dispatcher (cmd, argc, args, 0);
} }
grub_extcmd_t VasEBoot_extcmd_t
grub_register_extcmd_prio (const char *name, grub_extcmd_func_t func, VasEBoot_register_extcmd_prio (const char *name, VasEBoot_extcmd_func_t func,
grub_command_flags_t flags, const char *summary, VasEBoot_command_flags_t flags, const char *summary,
const char *description, const char *description,
const struct grub_arg_option *parser, const struct VasEBoot_arg_option *parser,
int prio) int prio)
{ {
grub_extcmd_t ext; VasEBoot_extcmd_t ext;
grub_command_t cmd; VasEBoot_command_t cmd;
ext = (grub_extcmd_t) grub_malloc (sizeof (*ext)); ext = (VasEBoot_extcmd_t) VasEBoot_malloc (sizeof (*ext));
if (! ext) if (! ext)
return 0; return 0;
cmd = grub_register_command_prio (name, grub_extcmd_dispatch, cmd = VasEBoot_register_command_prio (name, VasEBoot_extcmd_dispatch,
summary, description, prio); summary, description, prio);
if (! cmd) if (! cmd)
{ {
grub_free (ext); VasEBoot_free (ext);
return 0; return 0;
} }
cmd->flags = (flags | GRUB_COMMAND_FLAG_EXTCMD); cmd->flags = (flags | VasEBoot_COMMAND_FLAG_EXTCMD);
cmd->data = ext; cmd->data = ext;
ext->cmd = cmd; ext->cmd = cmd;
@ -100,19 +100,19 @@ grub_register_extcmd_prio (const char *name, grub_extcmd_func_t func,
return ext; return ext;
} }
grub_extcmd_t VasEBoot_extcmd_t
grub_register_extcmd (const char *name, grub_extcmd_func_t func, VasEBoot_register_extcmd (const char *name, VasEBoot_extcmd_func_t func,
grub_command_flags_t flags, const char *summary, VasEBoot_command_flags_t flags, const char *summary,
const char *description, const char *description,
const struct grub_arg_option *parser) const struct VasEBoot_arg_option *parser)
{ {
return grub_register_extcmd_prio (name, func, flags, return VasEBoot_register_extcmd_prio (name, func, flags,
summary, description, parser, 1); summary, description, parser, 1);
} }
void void
grub_unregister_extcmd (grub_extcmd_t ext) VasEBoot_unregister_extcmd (VasEBoot_extcmd_t ext)
{ {
grub_unregister_command (ext->cmd); VasEBoot_unregister_command (ext->cmd);
grub_free (ext); VasEBoot_free (ext);
} }

View File

@ -1,40 +1,40 @@
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2013 Free Software Foundation, Inc. * Copyright (C) 2013 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/mm.h> #include <VasEBoot/mm.h>
#include <grub/env.h> #include <VasEBoot/env.h>
#include <grub/command.h> #include <VasEBoot/command.h>
#include <grub/extcmd.h> #include <VasEBoot/extcmd.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
#include <grub/file.h> #include <VasEBoot/file.h>
#include <grub/elf.h> #include <VasEBoot/elf.h>
#include <grub/xen_file.h> #include <VasEBoot/xen_file.h>
#include <grub/efi/pe32.h> #include <VasEBoot/efi/pe32.h>
#include <grub/i386/linux.h> #include <VasEBoot/i386/linux.h>
#include <grub/xnu.h> #include <VasEBoot/xnu.h>
#include <grub/machoload.h> #include <VasEBoot/machoload.h>
#include <grub/fileid.h> #include <VasEBoot/fileid.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static const struct grub_arg_option options[] = { static const struct VasEBoot_arg_option options[] = {
{"is-i386-xen-pae-domu", 0, 0, {"is-i386-xen-pae-domu", 0, 0,
N_("Check if FILE can be booted as i386 PAE Xen unprivileged guest kernel"), N_("Check if FILE can be booted as i386 PAE Xen unprivileged guest kernel"),
0, 0}, 0, 0},
@ -138,18 +138,18 @@ enum
}; };
static grub_err_t static VasEBoot_err_t
grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args) VasEBoot_cmd_file (VasEBoot_extcmd_context_t ctxt, int argc, char **args)
{ {
grub_file_t file = 0; VasEBoot_file_t file = 0;
grub_elf_t elf = 0; VasEBoot_elf_t elf = 0;
grub_err_t err; VasEBoot_err_t err;
int type = -1, i; int type = -1, i;
int ret = 0; int ret = 0;
grub_macho_t macho = 0; VasEBoot_macho_t macho = 0;
if (argc == 0) if (argc == 0)
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, N_("filename expected"));
for (i = OPT_TYPE_MIN; i <= OPT_TYPE_MAX; i++) for (i = OPT_TYPE_MIN; i <= OPT_TYPE_MAX; i++)
if (ctxt->state[i].set) if (ctxt->state[i].set)
{ {
@ -158,26 +158,26 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
type = i; type = i;
continue; continue;
} }
return grub_error (GRUB_ERR_BAD_ARGUMENT, "multiple types specified"); return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, "multiple types specified");
} }
if (type == -1) if (type == -1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no type specified"); return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, "no type specified");
file = grub_file_open (args[0]); file = VasEBoot_file_open (args[0]);
if (!file) if (!file)
return grub_errno; return VasEBoot_errno;
switch (type) switch (type)
{ {
case IS_BIOS_BOOTSECTOR: case IS_BIOS_BOOTSECTOR:
{ {
grub_uint16_t sig; VasEBoot_uint16_t sig;
if (grub_file_size (file) != 512) if (VasEBoot_file_size (file) != 512)
break; break;
if (grub_file_seek (file, 510) == (grub_size_t) -1) if (VasEBoot_file_seek (file, 510) == (VasEBoot_size_t) -1)
break; break;
if (grub_file_read (file, &sig, 2) != 2) if (VasEBoot_file_read (file, &sig, 2) != 2)
break; break;
if (sig != grub_cpu_to_le16_compile_time (0xaa55)) if (sig != VasEBoot_cpu_to_le16_compile_time (0xaa55))
break; break;
ret = 1; ret = 1;
break; break;
@ -186,7 +186,7 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
{ {
Elf64_Ehdr ehdr; Elf64_Ehdr ehdr;
if (grub_file_read (file, &ehdr, sizeof (ehdr)) != sizeof (ehdr)) if (VasEBoot_file_read (file, &ehdr, sizeof (ehdr)) != sizeof (ehdr))
break; break;
if (ehdr.e_ident[EI_MAG0] != ELFMAG0 if (ehdr.e_ident[EI_MAG0] != ELFMAG0
@ -199,7 +199,7 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
if (ehdr.e_ident[EI_CLASS] != ELFCLASS64 if (ehdr.e_ident[EI_CLASS] != ELFCLASS64
|| ehdr.e_ident[EI_DATA] != ELFDATA2LSB || ehdr.e_ident[EI_DATA] != ELFDATA2LSB
|| ehdr.e_machine != grub_cpu_to_le16_compile_time (EM_IA_64)) || ehdr.e_machine != VasEBoot_cpu_to_le16_compile_time (EM_IA_64))
break; break;
ret = 1; ret = 1;
@ -211,7 +211,7 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
{ {
Elf64_Ehdr ehdr; Elf64_Ehdr ehdr;
if (grub_file_read (file, &ehdr, sizeof (ehdr)) != sizeof (ehdr)) if (VasEBoot_file_read (file, &ehdr, sizeof (ehdr)) != sizeof (ehdr))
break; break;
if (ehdr.e_ident[EI_MAG0] != ELFMAG0 if (ehdr.e_ident[EI_MAG0] != ELFMAG0
@ -226,8 +226,8 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
|| ehdr.e_ident[EI_DATA] != ELFDATA2MSB) || ehdr.e_ident[EI_DATA] != ELFDATA2MSB)
break; break;
if (ehdr.e_machine != grub_cpu_to_le16_compile_time (EM_SPARCV9) if (ehdr.e_machine != VasEBoot_cpu_to_le16_compile_time (EM_SPARCV9)
|| ehdr.e_type != grub_cpu_to_be16_compile_time (ET_EXEC)) || ehdr.e_type != VasEBoot_cpu_to_be16_compile_time (ET_EXEC))
break; break;
ret = 1; ret = 1;
@ -239,7 +239,7 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
{ {
Elf32_Ehdr ehdr; Elf32_Ehdr ehdr;
if (grub_file_read (file, &ehdr, sizeof (ehdr)) != sizeof (ehdr)) if (VasEBoot_file_read (file, &ehdr, sizeof (ehdr)) != sizeof (ehdr))
break; break;
if (ehdr.e_ident[EI_MAG0] != ELFMAG0 if (ehdr.e_ident[EI_MAG0] != ELFMAG0
@ -251,13 +251,13 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
break; break;
if (ehdr.e_ident[EI_DATA] != ELFDATA2MSB if (ehdr.e_ident[EI_DATA] != ELFDATA2MSB
|| (ehdr.e_machine != grub_cpu_to_le16_compile_time (EM_PPC) || (ehdr.e_machine != VasEBoot_cpu_to_le16_compile_time (EM_PPC)
&& ehdr.e_machine != && ehdr.e_machine !=
grub_cpu_to_le16_compile_time (EM_PPC64))) VasEBoot_cpu_to_le16_compile_time (EM_PPC64)))
break; break;
if (ehdr.e_type != grub_cpu_to_be16_compile_time (ET_EXEC) if (ehdr.e_type != VasEBoot_cpu_to_be16_compile_time (ET_EXEC)
&& ehdr.e_type != grub_cpu_to_be16_compile_time (ET_DYN)) && ehdr.e_type != VasEBoot_cpu_to_be16_compile_time (ET_DYN))
break; break;
ret = 1; ret = 1;
@ -269,7 +269,7 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
{ {
Elf32_Ehdr ehdr; Elf32_Ehdr ehdr;
if (grub_file_read (file, &ehdr, sizeof (ehdr)) != sizeof (ehdr)) if (VasEBoot_file_read (file, &ehdr, sizeof (ehdr)) != sizeof (ehdr))
break; break;
if (ehdr.e_ident[EI_MAG0] != ELFMAG0 if (ehdr.e_ident[EI_MAG0] != ELFMAG0
@ -281,8 +281,8 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
break; break;
if (ehdr.e_ident[EI_DATA] != ELFDATA2MSB if (ehdr.e_ident[EI_DATA] != ELFDATA2MSB
|| ehdr.e_machine != grub_cpu_to_be16_compile_time (EM_MIPS) || ehdr.e_machine != VasEBoot_cpu_to_be16_compile_time (EM_MIPS)
|| ehdr.e_type != grub_cpu_to_be16_compile_time (ET_EXEC)) || ehdr.e_type != VasEBoot_cpu_to_be16_compile_time (ET_EXEC))
break; break;
ret = 1; ret = 1;
@ -296,14 +296,14 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
{ {
int is32, is64; int is32, is64;
elf = grub_elf_file (file, file->name); elf = VasEBoot_elf_file (file, file->name);
if (elf->ehdr.ehdr32.e_type != grub_cpu_to_le16_compile_time (ET_EXEC) if (elf->ehdr.ehdr32.e_type != VasEBoot_cpu_to_le16_compile_time (ET_EXEC)
|| elf->ehdr.ehdr32.e_ident[EI_DATA] != ELFDATA2LSB) || elf->ehdr.ehdr32.e_ident[EI_DATA] != ELFDATA2LSB)
break; break;
is32 = grub_elf_is_elf32 (elf); is32 = VasEBoot_elf_is_elf32 (elf);
is64 = grub_elf_is_elf64 (elf); is64 = VasEBoot_elf_is_elf64 (elf);
if (!is32 && !is64) if (!is32 && !is64)
break; break;
if (!is32 && type == IS_X86_KNETBSD32) if (!is32 && type == IS_X86_KNETBSD32)
@ -311,9 +311,9 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
if (!is64 && type == IS_X86_KNETBSD64) if (!is64 && type == IS_X86_KNETBSD64)
break; break;
if (is64) if (is64)
ret = grub_file_check_netbsd64 (elf); ret = VasEBoot_file_check_netbsd64 (elf);
if (is32) if (is32)
ret = grub_file_check_netbsd32 (elf); ret = VasEBoot_file_check_netbsd32 (elf);
break; break;
} }
@ -324,7 +324,7 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
Elf32_Ehdr ehdr; Elf32_Ehdr ehdr;
int is32, is64; int is32, is64;
if (grub_file_read (file, &ehdr, sizeof (ehdr)) != sizeof (ehdr)) if (VasEBoot_file_read (file, &ehdr, sizeof (ehdr)) != sizeof (ehdr))
break; break;
if (ehdr.e_ident[EI_MAG0] != ELFMAG0 if (ehdr.e_ident[EI_MAG0] != ELFMAG0
@ -335,16 +335,16 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
|| ehdr.e_version != EV_CURRENT) || ehdr.e_version != EV_CURRENT)
break; break;
if (ehdr.e_type != grub_cpu_to_le16_compile_time (ET_EXEC) if (ehdr.e_type != VasEBoot_cpu_to_le16_compile_time (ET_EXEC)
|| ehdr.e_ident[EI_DATA] != ELFDATA2LSB) || ehdr.e_ident[EI_DATA] != ELFDATA2LSB)
break; break;
if (ehdr.e_ident[EI_OSABI] != ELFOSABI_FREEBSD) if (ehdr.e_ident[EI_OSABI] != ELFOSABI_FREEBSD)
break; break;
is32 = (ehdr.e_machine == grub_cpu_to_le16_compile_time (EM_386) is32 = (ehdr.e_machine == VasEBoot_cpu_to_le16_compile_time (EM_386)
&& ehdr.e_ident[EI_CLASS] == ELFCLASS32); && ehdr.e_ident[EI_CLASS] == ELFCLASS32);
is64 = (ehdr.e_machine == grub_cpu_to_le16_compile_time (EM_X86_64) is64 = (ehdr.e_machine == VasEBoot_cpu_to_le16_compile_time (EM_X86_64)
&& ehdr.e_ident[EI_CLASS] == ELFCLASS64); && ehdr.e_ident[EI_CLASS] == ELFCLASS64);
if (!is32 && !is64) if (!is32 && !is64)
break; break;
@ -362,7 +362,7 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
{ {
Elf32_Ehdr ehdr; Elf32_Ehdr ehdr;
if (grub_file_read (file, &ehdr, sizeof (ehdr)) != sizeof (ehdr)) if (VasEBoot_file_read (file, &ehdr, sizeof (ehdr)) != sizeof (ehdr))
break; break;
if (ehdr.e_ident[EI_MAG0] != ELFMAG0 if (ehdr.e_ident[EI_MAG0] != ELFMAG0
@ -373,8 +373,8 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
|| ehdr.e_version != EV_CURRENT) || ehdr.e_version != EV_CURRENT)
break; break;
if (ehdr.e_machine != grub_cpu_to_le16_compile_time (EM_MIPS) if (ehdr.e_machine != VasEBoot_cpu_to_le16_compile_time (EM_MIPS)
|| ehdr.e_type != grub_cpu_to_le16_compile_time (ET_EXEC)) || ehdr.e_type != VasEBoot_cpu_to_le16_compile_time (ET_EXEC))
break; break;
ret = 1; ret = 1;
@ -383,21 +383,21 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
} }
case IS_ARM_LINUX: case IS_ARM_LINUX:
{ {
grub_uint32_t sig, sig_pi; VasEBoot_uint32_t sig, sig_pi;
if (grub_file_read (file, &sig_pi, 4) != 4) if (VasEBoot_file_read (file, &sig_pi, 4) != 4)
break; break;
/* Raspberry pi. */ /* Raspberry pi. */
if (sig_pi == grub_cpu_to_le32_compile_time (0xea000006)) if (sig_pi == VasEBoot_cpu_to_le32_compile_time (0xea000006))
{ {
ret = 1; ret = 1;
break; break;
} }
if (grub_file_seek (file, 0x24) == (grub_size_t) -1) if (VasEBoot_file_seek (file, 0x24) == (VasEBoot_size_t) -1)
break; break;
if (grub_file_read (file, &sig, 4) != 4) if (VasEBoot_file_read (file, &sig, 4) != 4)
break; break;
if (sig == grub_cpu_to_le32_compile_time (0x016f2818)) if (sig == VasEBoot_cpu_to_le32_compile_time (0x016f2818))
{ {
ret = 1; ret = 1;
break; break;
@ -406,13 +406,13 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
} }
case IS_ARM64_LINUX: case IS_ARM64_LINUX:
{ {
grub_uint32_t sig; VasEBoot_uint32_t sig;
if (grub_file_seek (file, 0x38) == (grub_size_t) -1) if (VasEBoot_file_seek (file, 0x38) == (VasEBoot_size_t) -1)
break; break;
if (grub_file_read (file, &sig, 4) != 4) if (VasEBoot_file_read (file, &sig, 4) != 4)
break; break;
if (sig == grub_cpu_to_le32_compile_time (0x644d5241)) if (sig == VasEBoot_cpu_to_le32_compile_time (0x644d5241))
{ {
ret = 1; ret = 1;
break; break;
@ -421,54 +421,54 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
} }
case IS_PAE_DOMU ... IS_DOM0: case IS_PAE_DOMU ... IS_DOM0:
{ {
struct grub_xen_file_info xen_inf; struct VasEBoot_xen_file_info xen_inf;
elf = grub_xen_file (file); elf = VasEBoot_xen_file (file);
if (!elf) if (!elf)
break; break;
err = grub_xen_get_info (elf, &xen_inf); err = VasEBoot_xen_get_info (elf, &xen_inf);
if (err) if (err)
break; break;
/* Unfortuntely no way to check if kernel supports dom0. */ /* Unfortuntely no way to check if kernel supports dom0. */
if (type == IS_DOM0) if (type == IS_DOM0)
ret = 1; ret = 1;
if (type == IS_PAE_DOMU) if (type == IS_PAE_DOMU)
ret = (xen_inf.arch == GRUB_XEN_FILE_I386_PAE ret = (xen_inf.arch == VasEBoot_XEN_FILE_I386_PAE
|| xen_inf.arch == GRUB_XEN_FILE_I386_PAE_BIMODE); || xen_inf.arch == VasEBoot_XEN_FILE_I386_PAE_BIMODE);
if (type == IS_64_DOMU) if (type == IS_64_DOMU)
ret = (xen_inf.arch == GRUB_XEN_FILE_X86_64); ret = (xen_inf.arch == VasEBoot_XEN_FILE_X86_64);
break; break;
} }
case IS_MULTIBOOT: case IS_MULTIBOOT:
case IS_MULTIBOOT2: case IS_MULTIBOOT2:
{ {
grub_uint32_t *buffer; VasEBoot_uint32_t *buffer;
grub_ssize_t len; VasEBoot_ssize_t len;
grub_size_t search_size; VasEBoot_size_t search_size;
grub_uint32_t *header; VasEBoot_uint32_t *header;
grub_uint32_t magic; VasEBoot_uint32_t magic;
grub_size_t step; VasEBoot_size_t step;
if (type == IS_MULTIBOOT2) if (type == IS_MULTIBOOT2)
{ {
search_size = 32768; search_size = 32768;
magic = grub_cpu_to_le32_compile_time (0xe85250d6); magic = VasEBoot_cpu_to_le32_compile_time (0xe85250d6);
step = 2; step = 2;
} }
else else
{ {
search_size = 8192; search_size = 8192;
magic = grub_cpu_to_le32_compile_time (0x1BADB002); magic = VasEBoot_cpu_to_le32_compile_time (0x1BADB002);
step = 1; step = 1;
} }
buffer = grub_malloc (search_size); buffer = VasEBoot_malloc (search_size);
if (!buffer) if (!buffer)
break; break;
len = grub_file_read (file, buffer, search_size); len = VasEBoot_file_read (file, buffer, search_size);
if (len < 32) if (len < 32)
{ {
grub_free (buffer); VasEBoot_free (buffer);
break; break;
} }
@ -480,36 +480,36 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
header += step) header += step)
{ {
if (header[0] == magic if (header[0] == magic
&& !(grub_le_to_cpu32 (header[0]) && !(VasEBoot_le_to_cpu32 (header[0])
+ grub_le_to_cpu32 (header[1]) + VasEBoot_le_to_cpu32 (header[1])
+ grub_le_to_cpu32 (header[2]) + VasEBoot_le_to_cpu32 (header[2])
+ (type == IS_MULTIBOOT2 + (type == IS_MULTIBOOT2
? grub_le_to_cpu32 (header[3]) : 0))) ? VasEBoot_le_to_cpu32 (header[3]) : 0)))
{ {
ret = 1; ret = 1;
break; break;
} }
} }
grub_free (buffer); VasEBoot_free (buffer);
break; break;
} }
case IS_X86_LINUX32: case IS_X86_LINUX32:
case IS_X86_LINUX: case IS_X86_LINUX:
{ {
struct linux_kernel_header lh; struct linux_kernel_header lh;
if (grub_file_read (file, &lh, sizeof (lh)) != sizeof (lh)) if (VasEBoot_file_read (file, &lh, sizeof (lh)) != sizeof (lh))
break; break;
if (lh.boot_flag != grub_cpu_to_le16_compile_time (0xaa55)) if (lh.boot_flag != VasEBoot_cpu_to_le16_compile_time (0xaa55))
break; break;
if (lh.setup_sects > GRUB_LINUX_MAX_SETUP_SECTS) if (lh.setup_sects > VasEBoot_LINUX_MAX_SETUP_SECTS)
break; break;
/* FIXME: some really old kernels (< 1.3.73) will fail this. */ /* FIXME: some really old kernels (< 1.3.73) will fail this. */
if (lh.header != if (lh.header !=
grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE) VasEBoot_cpu_to_le32_compile_time (VasEBoot_LINUX_MAGIC_SIGNATURE)
|| grub_le_to_cpu16 (lh.version) < 0x0200) || VasEBoot_le_to_cpu16 (lh.version) < 0x0200)
break; break;
if (type == IS_X86_LINUX) if (type == IS_X86_LINUX)
@ -521,24 +521,24 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
/* FIXME: 2.03 is not always good enough (Linux 2.4 can be 2.03 and /* FIXME: 2.03 is not always good enough (Linux 2.4 can be 2.03 and
still not support 32-bit boot. */ still not support 32-bit boot. */
if (lh.header != if (lh.header !=
grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE) VasEBoot_cpu_to_le32_compile_time (VasEBoot_LINUX_MAGIC_SIGNATURE)
|| grub_le_to_cpu16 (lh.version) < 0x0203) || VasEBoot_le_to_cpu16 (lh.version) < 0x0203)
break; break;
if (!(lh.loadflags & GRUB_LINUX_FLAG_BIG_KERNEL)) if (!(lh.loadflags & VasEBoot_LINUX_FLAG_BIG_KERNEL))
break; break;
ret = 1; ret = 1;
break; break;
} }
case IS_HIBERNATED: case IS_HIBERNATED:
{ {
grub_uint8_t hibr_file_magic[4]; VasEBoot_uint8_t hibr_file_magic[4];
if (grub_file_read (file, &hibr_file_magic, sizeof (hibr_file_magic)) if (VasEBoot_file_read (file, &hibr_file_magic, sizeof (hibr_file_magic))
!= sizeof (hibr_file_magic)) != sizeof (hibr_file_magic))
break; break;
if (grub_memcmp ("hibr", hibr_file_magic, sizeof (hibr_file_magic)) == if (VasEBoot_memcmp ("hibr", hibr_file_magic, sizeof (hibr_file_magic)) ==
0 0
|| grub_memcmp ("HIBR", hibr_file_magic, || VasEBoot_memcmp ("HIBR", hibr_file_magic,
sizeof (hibr_file_magic)) == 0) sizeof (hibr_file_magic)) == 0)
ret = 1; ret = 1;
break; break;
@ -546,7 +546,7 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
case IS_XNU64: case IS_XNU64:
case IS_XNU32: case IS_XNU32:
{ {
macho = grub_macho_open (args[0], (type == IS_XNU64)); macho = VasEBoot_macho_open (args[0], (type == IS_XNU64));
if (!macho) if (!macho)
break; break;
/* FIXME: more checks? */ /* FIXME: more checks? */
@ -555,12 +555,12 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
} }
case IS_XNU_HIBR: case IS_XNU_HIBR:
{ {
struct grub_xnu_hibernate_header hibhead; struct VasEBoot_xnu_hibernate_header hibhead;
if (grub_file_read (file, &hibhead, sizeof (hibhead)) if (VasEBoot_file_read (file, &hibhead, sizeof (hibhead))
!= sizeof (hibhead)) != sizeof (hibhead))
break; break;
if (hibhead.magic != if (hibhead.magic !=
grub_cpu_to_le32_compile_time (GRUB_XNU_HIBERNATE_MAGIC)) VasEBoot_cpu_to_le32_compile_time (VasEBoot_XNU_HIBERNATE_MAGIC))
break; break;
ret = 1; ret = 1;
break; break;
@ -572,75 +572,75 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
case IS_ARM_EFI: case IS_ARM_EFI:
{ {
char signature[4]; char signature[4];
grub_uint32_t pe_offset; VasEBoot_uint32_t pe_offset;
struct grub_pe32_coff_header coff_head; struct VasEBoot_pe32_coff_header coff_head;
if (grub_file_read (file, signature, 2) != 2) if (VasEBoot_file_read (file, signature, 2) != 2)
break; break;
if (signature[0] != 'M' || signature[1] != 'Z') if (signature[0] != 'M' || signature[1] != 'Z')
break; break;
if ((grub_ssize_t) grub_file_seek (file, 0x3c) == -1) if ((VasEBoot_ssize_t) VasEBoot_file_seek (file, 0x3c) == -1)
break; break;
if (grub_file_read (file, &pe_offset, 4) != 4) if (VasEBoot_file_read (file, &pe_offset, 4) != 4)
break; break;
if ((grub_ssize_t) grub_file_seek (file, grub_le_to_cpu32 (pe_offset)) if ((VasEBoot_ssize_t) VasEBoot_file_seek (file, VasEBoot_le_to_cpu32 (pe_offset))
== -1) == -1)
break; break;
if (grub_file_read (file, signature, 4) != 4) if (VasEBoot_file_read (file, signature, 4) != 4)
break; break;
if (signature[0] != 'P' || signature[1] != 'E' if (signature[0] != 'P' || signature[1] != 'E'
|| signature[2] != '\0' || signature[3] != '\0') || signature[2] != '\0' || signature[3] != '\0')
break; break;
if (grub_file_read (file, &coff_head, sizeof (coff_head)) if (VasEBoot_file_read (file, &coff_head, sizeof (coff_head))
!= sizeof (coff_head)) != sizeof (coff_head))
break; break;
if (type == IS_32_EFI if (type == IS_32_EFI
&& coff_head.machine != && coff_head.machine !=
grub_cpu_to_le16_compile_time (GRUB_PE32_MACHINE_I386)) VasEBoot_cpu_to_le16_compile_time (VasEBoot_PE32_MACHINE_I386))
break; break;
if (type == IS_64_EFI if (type == IS_64_EFI
&& coff_head.machine != && coff_head.machine !=
grub_cpu_to_le16_compile_time (GRUB_PE32_MACHINE_X86_64)) VasEBoot_cpu_to_le16_compile_time (VasEBoot_PE32_MACHINE_X86_64))
break; break;
if (type == IS_IA_EFI if (type == IS_IA_EFI
&& coff_head.machine != && coff_head.machine !=
grub_cpu_to_le16_compile_time (GRUB_PE32_MACHINE_IA64)) VasEBoot_cpu_to_le16_compile_time (VasEBoot_PE32_MACHINE_IA64))
break; break;
if (type == IS_ARM64_EFI if (type == IS_ARM64_EFI
&& coff_head.machine != && coff_head.machine !=
grub_cpu_to_le16_compile_time (GRUB_PE32_MACHINE_ARM64)) VasEBoot_cpu_to_le16_compile_time (VasEBoot_PE32_MACHINE_ARM64))
break; break;
if (type == IS_ARM_EFI if (type == IS_ARM_EFI
&& coff_head.machine != && coff_head.machine !=
grub_cpu_to_le16_compile_time (GRUB_PE32_MACHINE_ARMTHUMB_MIXED)) VasEBoot_cpu_to_le16_compile_time (VasEBoot_PE32_MACHINE_ARMTHUMB_MIXED))
break; break;
if (type == IS_IA_EFI || type == IS_64_EFI || type == IS_ARM64_EFI) if (type == IS_IA_EFI || type == IS_64_EFI || type == IS_ARM64_EFI)
{ {
struct grub_pe64_optional_header o64; struct VasEBoot_pe64_optional_header o64;
if (grub_file_read (file, &o64, sizeof (o64)) != sizeof (o64)) if (VasEBoot_file_read (file, &o64, sizeof (o64)) != sizeof (o64))
break; break;
if (o64.magic != if (o64.magic !=
grub_cpu_to_le16_compile_time (GRUB_PE32_PE64_MAGIC)) VasEBoot_cpu_to_le16_compile_time (VasEBoot_PE32_PE64_MAGIC))
break; break;
if (o64.subsystem != if (o64.subsystem !=
grub_cpu_to_le16_compile_time VasEBoot_cpu_to_le16_compile_time
(GRUB_PE32_SUBSYSTEM_EFI_APPLICATION)) (VasEBoot_PE32_SUBSYSTEM_EFI_APPLICATION))
break; break;
ret = 1; ret = 1;
break; break;
} }
if (type == IS_32_EFI || type == IS_ARM_EFI) if (type == IS_32_EFI || type == IS_ARM_EFI)
{ {
struct grub_pe32_optional_header o32; struct VasEBoot_pe32_optional_header o32;
if (grub_file_read (file, &o32, sizeof (o32)) != sizeof (o32)) if (VasEBoot_file_read (file, &o32, sizeof (o32)) != sizeof (o32))
break; break;
if (o32.magic != if (o32.magic !=
grub_cpu_to_le16_compile_time (GRUB_PE32_PE32_MAGIC)) VasEBoot_cpu_to_le16_compile_time (VasEBoot_PE32_PE32_MAGIC))
break; break;
if (o32.subsystem != if (o32.subsystem !=
grub_cpu_to_le16_compile_time VasEBoot_cpu_to_le16_compile_time
(GRUB_PE32_SUBSYSTEM_EFI_APPLICATION)) (VasEBoot_PE32_SUBSYSTEM_EFI_APPLICATION))
break; break;
ret = 1; ret = 1;
break; break;
@ -650,30 +650,30 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
} }
if (elf) if (elf)
grub_elf_close (elf); VasEBoot_elf_close (elf);
else if (macho) else if (macho)
grub_macho_close (macho); VasEBoot_macho_close (macho);
else if (file) else if (file)
grub_file_close (file); VasEBoot_file_close (file);
if (!ret && (grub_errno == GRUB_ERR_BAD_OS || grub_errno == GRUB_ERR_NONE)) if (!ret && (VasEBoot_errno == VasEBoot_ERR_BAD_OS || VasEBoot_errno == VasEBoot_ERR_NONE))
/* TRANSLATORS: it's a standalone boolean value, /* TRANSLATORS: it's a standalone boolean value,
opposite of "true". */ opposite of "true". */
grub_error (GRUB_ERR_TEST_FAILURE, N_("false")); VasEBoot_error (VasEBoot_ERR_TEST_FAILURE, N_("false"));
return grub_errno; return VasEBoot_errno;
} }
static grub_extcmd_t cmd; static VasEBoot_extcmd_t cmd;
GRUB_MOD_INIT(file) VasEBoot_MOD_INIT(file)
{ {
cmd = grub_register_extcmd ("file", grub_cmd_file, 0, cmd = VasEBoot_register_extcmd ("file", VasEBoot_cmd_file, 0,
N_("OPTIONS FILE"), N_("OPTIONS FILE"),
N_("Check if FILE is of specified type."), N_("Check if FILE is of specified type."),
options); options);
} }
GRUB_MOD_FINI(file) VasEBoot_MOD_FINI(file)
{ {
grub_unregister_extcmd (cmd); VasEBoot_unregister_extcmd (cmd);
} }

View File

@ -1,5 +1,5 @@
#define GRUB_TARGET_WORDSIZE 32 #define VasEBoot_TARGET_WORDSIZE 32
#define XX 32 #define XX 32
#define ehdrXX ehdr32 #define ehdrXX ehdr32
#define grub_file_check_netbsdXX grub_file_check_netbsd32 #define VasEBoot_file_check_netbsdXX VasEBoot_file_check_netbsd32
#include "fileXX.c" #include "fileXX.c"

View File

@ -1,5 +1,5 @@
#define GRUB_TARGET_WORDSIZE 64 #define VasEBoot_TARGET_WORDSIZE 64
#define XX 64 #define XX 64
#define ehdrXX ehdr64 #define ehdrXX ehdr64
#define grub_file_check_netbsdXX grub_file_check_netbsd64 #define VasEBoot_file_check_netbsdXX VasEBoot_file_check_netbsd64
#include "fileXX.c" #include "fileXX.c"

View File

@ -1,48 +1,48 @@
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2013 Free Software Foundation, Inc. * Copyright (C) 2013 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/fileid.h> #include <VasEBoot/fileid.h>
#include <grub/elfload.h> #include <VasEBoot/elfload.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#pragma GCC diagnostic ignored "-Wcast-align" #pragma GCC diagnostic ignored "-Wcast-align"
int int
grub_file_check_netbsdXX (grub_elf_t elf) VasEBoot_file_check_netbsdXX (VasEBoot_elf_t elf)
{ {
Elf_Shdr *s, *s0; Elf_Shdr *s, *s0;
grub_size_t shnum = elf->ehdr.ehdrXX.e_shnum; VasEBoot_size_t shnum = elf->ehdr.ehdrXX.e_shnum;
grub_size_t shentsize = elf->ehdr.ehdrXX.e_shentsize; VasEBoot_size_t shentsize = elf->ehdr.ehdrXX.e_shentsize;
grub_size_t shsize = shnum * shentsize; VasEBoot_size_t shsize = shnum * shentsize;
grub_off_t stroff; VasEBoot_off_t stroff;
if (!shnum || !shentsize) if (!shnum || !shentsize)
return 0; return 0;
s0 = grub_malloc (shsize); s0 = VasEBoot_malloc (shsize);
if (!s0) if (!s0)
return 0; return 0;
if (grub_file_seek (elf->file, elf->ehdr.ehdrXX.e_shoff) == (grub_off_t) -1) if (VasEBoot_file_seek (elf->file, elf->ehdr.ehdrXX.e_shoff) == (VasEBoot_off_t) -1)
goto fail; goto fail;
if (grub_file_read (elf->file, s0, shsize) != (grub_ssize_t) shsize) if (VasEBoot_file_read (elf->file, s0, shsize) != (VasEBoot_ssize_t) shsize)
goto fail; goto fail;
s = (Elf_Shdr *) ((char *) s0 + elf->ehdr.ehdrXX.e_shstrndx * shentsize); s = (Elf_Shdr *) ((char *) s0 + elf->ehdr.ehdrXX.e_shstrndx * shentsize);
@ -52,23 +52,23 @@ grub_file_check_netbsdXX (grub_elf_t elf)
s = (Elf_Shdr *) ((char *) s + shentsize)) s = (Elf_Shdr *) ((char *) s + shentsize))
{ {
char name[sizeof(".note.netbsd.ident")]; char name[sizeof(".note.netbsd.ident")];
grub_memset (name, 0, sizeof (name)); VasEBoot_memset (name, 0, sizeof (name));
if (grub_file_seek (elf->file, stroff + s->sh_name) == (grub_off_t) -1) if (VasEBoot_file_seek (elf->file, stroff + s->sh_name) == (VasEBoot_off_t) -1)
goto fail; goto fail;
if (grub_file_read (elf->file, name, sizeof (name)) != (grub_ssize_t) sizeof (name)) if (VasEBoot_file_read (elf->file, name, sizeof (name)) != (VasEBoot_ssize_t) sizeof (name))
{ {
if (grub_errno) if (VasEBoot_errno)
goto fail; goto fail;
continue; continue;
} }
if (grub_memcmp (name, ".note.netbsd.ident", if (VasEBoot_memcmp (name, ".note.netbsd.ident",
sizeof(".note.netbsd.ident")) != 0) sizeof(".note.netbsd.ident")) != 0)
continue; continue;
grub_free (s0); VasEBoot_free (s0);
return 1; return 1;
} }
fail: fail:
grub_free (s0); VasEBoot_free (s0);
return 0; return 0;
} }

View File

@ -1,31 +1,31 @@
/* fwconfig.c - command to read config from qemu fwconfig */ /* fwconfig.c - command to read config from qemu fwconfig */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2015 CoreOS, Inc. * Copyright (C) 2015 CoreOS, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/extcmd.h> #include <VasEBoot/extcmd.h>
#include <grub/env.h> #include <VasEBoot/env.h>
#include <grub/cpu/io.h> #include <VasEBoot/cpu/io.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
#include <grub/mm.h> #include <VasEBoot/mm.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
#define SELECTOR 0x510 #define SELECTOR 0x510
#define DATA 0x511 #define DATA 0x511
@ -33,90 +33,90 @@ GRUB_MOD_LICENSE ("GPLv3+");
#define SIGNATURE_INDEX 0x00 #define SIGNATURE_INDEX 0x00
#define DIRECTORY_INDEX 0x19 #define DIRECTORY_INDEX 0x19
static grub_extcmd_t cmd_read_fwconfig; static VasEBoot_extcmd_t cmd_read_fwconfig;
struct grub_qemu_fwcfgfile { struct VasEBoot_qemu_fwcfgfile {
grub_uint32_t size; VasEBoot_uint32_t size;
grub_uint16_t select; VasEBoot_uint16_t select;
grub_uint16_t reserved; VasEBoot_uint16_t reserved;
char name[56]; char name[56];
}; };
static const struct grub_arg_option options[] = static const struct VasEBoot_arg_option options[] =
{ {
{0, 'v', 0, N_("Save read value into variable VARNAME."), {0, 'v', 0, N_("Save read value into variable VARNAME."),
N_("VARNAME"), ARG_TYPE_STRING}, N_("VARNAME"), ARG_TYPE_STRING},
{0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0}
}; };
static grub_err_t static VasEBoot_err_t
grub_cmd_fwconfig (grub_extcmd_context_t ctxt __attribute__ ((unused)), VasEBoot_cmd_fwconfig (VasEBoot_extcmd_context_t ctxt __attribute__ ((unused)),
int argc, char **argv) int argc, char **argv)
{ {
grub_uint32_t i, j, value = 0; VasEBoot_uint32_t i, j, value = 0;
struct grub_qemu_fwcfgfile file; struct VasEBoot_qemu_fwcfgfile file;
char fwsig[4], signature[4] = { 'Q', 'E', 'M', 'U' }; char fwsig[4], signature[4] = { 'Q', 'E', 'M', 'U' };
if (argc != 2) if (argc != 2)
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("two arguments expected")); return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, N_("two arguments expected"));
/* Verify that we have meaningful hardware here */ /* Verify that we have meaningful hardware here */
grub_outw(SIGNATURE_INDEX, SELECTOR); VasEBoot_outw(SIGNATURE_INDEX, SELECTOR);
for (i=0; i<sizeof(fwsig); i++) for (i=0; i<sizeof(fwsig); i++)
fwsig[i] = grub_inb(DATA); fwsig[i] = VasEBoot_inb(DATA);
if (grub_memcmp(fwsig, signature, sizeof(signature)) != 0) if (VasEBoot_memcmp(fwsig, signature, sizeof(signature)) != 0)
return grub_error (GRUB_ERR_BAD_DEVICE, N_("invalid fwconfig hardware signature: got 0x%x%x%x%x"), fwsig[0], fwsig[1], fwsig[2], fwsig[3]); return VasEBoot_error (VasEBoot_ERR_BAD_DEVICE, N_("invalid fwconfig hardware signature: got 0x%x%x%x%x"), fwsig[0], fwsig[1], fwsig[2], fwsig[3]);
/* Find out how many file entries we have */ /* Find out how many file entries we have */
grub_outw(DIRECTORY_INDEX, SELECTOR); VasEBoot_outw(DIRECTORY_INDEX, SELECTOR);
value = grub_inb(DATA) | grub_inb(DATA) << 8 | grub_inb(DATA) << 16 | grub_inb(DATA) << 24; value = VasEBoot_inb(DATA) | VasEBoot_inb(DATA) << 8 | VasEBoot_inb(DATA) << 16 | VasEBoot_inb(DATA) << 24;
value = grub_be_to_cpu32(value); value = VasEBoot_be_to_cpu32(value);
/* Read the file description for each file */ /* Read the file description for each file */
for (i=0; i<value; i++) for (i=0; i<value; i++)
{ {
for (j=0; j<sizeof(file); j++) for (j=0; j<sizeof(file); j++)
{ {
((char *)&file)[j] = grub_inb(DATA); ((char *)&file)[j] = VasEBoot_inb(DATA);
} }
/* Check whether it matches what we're looking for, and if so read the file */ /* Check whether it matches what we're looking for, and if so read the file */
if (grub_strncmp(file.name, argv[0], sizeof(file.name)) == 0) if (VasEBoot_strncmp(file.name, argv[0], sizeof(file.name)) == 0)
{ {
grub_uint32_t filesize = grub_be_to_cpu32(file.size); VasEBoot_uint32_t filesize = VasEBoot_be_to_cpu32(file.size);
grub_uint16_t location = grub_be_to_cpu16(file.select); VasEBoot_uint16_t location = VasEBoot_be_to_cpu16(file.select);
char *data = grub_malloc(filesize+1); char *data = VasEBoot_malloc(filesize+1);
if (!data) if (!data)
return grub_error (GRUB_ERR_OUT_OF_MEMORY, N_("can't allocate buffer for data")); return VasEBoot_error (VasEBoot_ERR_OUT_OF_MEMORY, N_("can't allocate buffer for data"));
grub_outw(location, SELECTOR); VasEBoot_outw(location, SELECTOR);
for (j=0; j<filesize; j++) for (j=0; j<filesize; j++)
{ {
data[j] = grub_inb(DATA); data[j] = VasEBoot_inb(DATA);
} }
data[filesize] = '\0'; data[filesize] = '\0';
grub_env_set (argv[1], data); VasEBoot_env_set (argv[1], data);
grub_free(data); VasEBoot_free(data);
return 0; return 0;
} }
} }
return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("couldn't find entry %s"), argv[0]); return VasEBoot_error (VasEBoot_ERR_FILE_NOT_FOUND, N_("couldn't find entry %s"), argv[0]);
} }
GRUB_MOD_INIT(fwconfig) VasEBoot_MOD_INIT(fwconfig)
{ {
cmd_read_fwconfig = cmd_read_fwconfig =
grub_register_extcmd ("fwconfig", grub_cmd_fwconfig, 0, VasEBoot_register_extcmd ("fwconfig", VasEBoot_cmd_fwconfig, 0,
N_("PATH VAR"), N_("PATH VAR"),
N_("Set VAR to the contents of fwconfig PATH"), N_("Set VAR to the contents of fwconfig PATH"),
options); options);
} }
GRUB_MOD_FINI(fwconfig) VasEBoot_MOD_FINI(fwconfig)
{ {
grub_unregister_extcmd (cmd_read_fwconfig); VasEBoot_unregister_extcmd (cmd_read_fwconfig);
} }

View File

@ -1,34 +1,34 @@
/* gptprio.c - manage priority based partition selection. */ /* gptprio.c - manage priority based partition selection. */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc. * Copyright (C) 2009 Free Software Foundation, Inc.
* Copyright (C) 2014 CoreOS, Inc. * Copyright (C) 2014 CoreOS, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/device.h> #include <VasEBoot/device.h>
#include <grub/env.h> #include <VasEBoot/env.h>
#include <grub/err.h> #include <VasEBoot/err.h>
#include <grub/extcmd.h> #include <VasEBoot/extcmd.h>
#include <grub/gpt_partition.h> #include <VasEBoot/gpt_partition.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static const struct grub_arg_option options_next[] = { static const struct VasEBoot_arg_option options_next[] = {
{"set-device", 'd', 0, {"set-device", 'd', 0,
N_("Set a variable to the name of selected partition."), N_("Set a variable to the name of selected partition."),
N_("VARNAME"), ARG_TYPE_STRING}, N_("VARNAME"), ARG_TYPE_STRING},
@ -45,67 +45,67 @@ enum options_next
}; };
static unsigned int static unsigned int
grub_gptprio_priority (struct grub_gpt_partentry *entry) VasEBoot_gptprio_priority (struct VasEBoot_gpt_partentry *entry)
{ {
return (unsigned int) grub_gpt_entry_attribute return (unsigned int) VasEBoot_gpt_entry_attribute
(entry, GRUB_GPT_PART_ATTR_OFFSET_GPTPRIO_PRIORITY, 4); (entry, VasEBoot_GPT_PART_ATTR_OFFSET_GPTPRIO_PRIORITY, 4);
} }
static unsigned int static unsigned int
grub_gptprio_tries_left (struct grub_gpt_partentry *entry) VasEBoot_gptprio_tries_left (struct VasEBoot_gpt_partentry *entry)
{ {
return (unsigned int) grub_gpt_entry_attribute return (unsigned int) VasEBoot_gpt_entry_attribute
(entry, GRUB_GPT_PART_ATTR_OFFSET_GPTPRIO_TRIES_LEFT, 4); (entry, VasEBoot_GPT_PART_ATTR_OFFSET_GPTPRIO_TRIES_LEFT, 4);
} }
static void static void
grub_gptprio_set_tries_left (struct grub_gpt_partentry *entry, VasEBoot_gptprio_set_tries_left (struct VasEBoot_gpt_partentry *entry,
unsigned int tries_left) unsigned int tries_left)
{ {
grub_gpt_entry_set_attribute VasEBoot_gpt_entry_set_attribute
(entry, tries_left, GRUB_GPT_PART_ATTR_OFFSET_GPTPRIO_TRIES_LEFT, 4); (entry, tries_left, VasEBoot_GPT_PART_ATTR_OFFSET_GPTPRIO_TRIES_LEFT, 4);
} }
static unsigned int static unsigned int
grub_gptprio_successful (struct grub_gpt_partentry *entry) VasEBoot_gptprio_successful (struct VasEBoot_gpt_partentry *entry)
{ {
return (unsigned int) grub_gpt_entry_attribute return (unsigned int) VasEBoot_gpt_entry_attribute
(entry, GRUB_GPT_PART_ATTR_OFFSET_GPTPRIO_SUCCESSFUL, 1); (entry, VasEBoot_GPT_PART_ATTR_OFFSET_GPTPRIO_SUCCESSFUL, 1);
} }
static grub_err_t static VasEBoot_err_t
grub_find_next (const char *disk_name, VasEBoot_find_next (const char *disk_name,
const grub_gpt_part_type_t *part_type, const VasEBoot_gpt_part_type_t *part_type,
char **part_name, char **part_guid) char **part_name, char **part_guid)
{ {
struct grub_gpt_partentry *part, *part_found = NULL; struct VasEBoot_gpt_partentry *part, *part_found = NULL;
grub_device_t dev = NULL; VasEBoot_device_t dev = NULL;
grub_gpt_t gpt = NULL; VasEBoot_gpt_t gpt = NULL;
grub_uint32_t i, part_index; VasEBoot_uint32_t i, part_index;
dev = grub_device_open (disk_name); dev = VasEBoot_device_open (disk_name);
if (!dev) if (!dev)
goto done; goto done;
gpt = grub_gpt_read (dev->disk); gpt = VasEBoot_gpt_read (dev->disk);
if (!gpt) if (!gpt)
goto done; goto done;
if (grub_gpt_repair (dev->disk, gpt)) if (VasEBoot_gpt_repair (dev->disk, gpt))
goto done; goto done;
for (i = 0; (part = grub_gpt_get_partentry (gpt, i)) != NULL; i++) for (i = 0; (part = VasEBoot_gpt_get_partentry (gpt, i)) != NULL; i++)
{ {
if (grub_memcmp (part_type, &part->type, sizeof (*part_type)) == 0) if (VasEBoot_memcmp (part_type, &part->type, sizeof (*part_type)) == 0)
{ {
unsigned int priority, tries_left, successful, old_priority = 0; unsigned int priority, tries_left, successful, old_priority = 0;
priority = grub_gptprio_priority (part); priority = VasEBoot_gptprio_priority (part);
tries_left = grub_gptprio_tries_left (part); tries_left = VasEBoot_gptprio_tries_left (part);
successful = grub_gptprio_successful (part); successful = VasEBoot_gptprio_successful (part);
if (part_found) if (part_found)
old_priority = grub_gptprio_priority (part_found); old_priority = VasEBoot_gptprio_priority (part_found);
if ((tries_left || successful) && priority > old_priority) if ((tries_left || successful) && priority > old_priority)
{ {
@ -117,66 +117,66 @@ grub_find_next (const char *disk_name,
if (!part_found) if (!part_found)
{ {
grub_error (GRUB_ERR_UNKNOWN_DEVICE, N_("no such partition")); VasEBoot_error (VasEBoot_ERR_UNKNOWN_DEVICE, N_("no such partition"));
goto done; goto done;
} }
if (grub_gptprio_tries_left (part_found)) if (VasEBoot_gptprio_tries_left (part_found))
{ {
unsigned int tries_left = grub_gptprio_tries_left (part_found); unsigned int tries_left = VasEBoot_gptprio_tries_left (part_found);
grub_gptprio_set_tries_left (part_found, tries_left - 1); VasEBoot_gptprio_set_tries_left (part_found, tries_left - 1);
if (grub_gpt_update (gpt)) if (VasEBoot_gpt_update (gpt))
goto done; goto done;
if (grub_gpt_write (dev->disk, gpt)) if (VasEBoot_gpt_write (dev->disk, gpt))
goto done; goto done;
} }
*part_name = grub_xasprintf ("%s,gpt%u", disk_name, part_index + 1); *part_name = VasEBoot_xasprintf ("%s,gpt%u", disk_name, part_index + 1);
if (!*part_name) if (!*part_name)
goto done; goto done;
*part_guid = grub_gpt_guid_to_str (&part_found->guid); *part_guid = VasEBoot_gpt_guid_to_str (&part_found->guid);
if (!*part_guid) if (!*part_guid)
goto done; goto done;
grub_errno = GRUB_ERR_NONE; VasEBoot_errno = VasEBoot_ERR_NONE;
done: done:
grub_gpt_free (gpt); VasEBoot_gpt_free (gpt);
if (dev) if (dev)
grub_device_close (dev); VasEBoot_device_close (dev);
return grub_errno; return VasEBoot_errno;
} }
static grub_err_t static VasEBoot_err_t
grub_cmd_next (grub_extcmd_context_t ctxt, int argc, char **args) VasEBoot_cmd_next (VasEBoot_extcmd_context_t ctxt, int argc, char **args)
{ {
struct grub_arg_list *state = ctxt->state; struct VasEBoot_arg_list *state = ctxt->state;
char *p, *root = NULL, *part_name = NULL, *part_guid = NULL; char *p, *root = NULL, *part_name = NULL, *part_guid = NULL;
/* TODO: Add a uuid parser and a command line flag for providing type. */ /* TODO: Add a uuid parser and a command line flag for providing type. */
grub_gpt_part_type_t part_type = GRUB_GPT_PARTITION_TYPE_USR_X86_64; VasEBoot_gpt_part_type_t part_type = VasEBoot_GPT_PARTITION_TYPE_USR_X86_64;
if (!state[NEXT_SET_DEVICE].set || !state[NEXT_SET_UUID].set) if (!state[NEXT_SET_DEVICE].set || !state[NEXT_SET_UUID].set)
{ {
grub_error (GRUB_ERR_INVALID_COMMAND, N_("-d and -u are required")); VasEBoot_error (VasEBoot_ERR_INVALID_COMMAND, N_("-d and -u are required"));
goto done; goto done;
} }
if (argc == 0) if (argc == 0)
root = grub_strdup (grub_env_get ("root")); root = VasEBoot_strdup (VasEBoot_env_get ("root"));
else if (argc == 1) else if (argc == 1)
root = grub_strdup (args[0]); root = VasEBoot_strdup (args[0]);
else else
{ {
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("unexpected arguments")); VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, N_("unexpected arguments"));
goto done; goto done;
} }
@ -184,40 +184,40 @@ grub_cmd_next (grub_extcmd_context_t ctxt, int argc, char **args)
goto done; goto done;
/* To make using $root practical strip off the partition name. */ /* To make using $root practical strip off the partition name. */
p = grub_strchr (root, ','); p = VasEBoot_strchr (root, ',');
if (p) if (p)
*p = '\0'; *p = '\0';
if (grub_find_next (root, &part_type, &part_name, &part_guid)) if (VasEBoot_find_next (root, &part_type, &part_name, &part_guid))
goto done; goto done;
if (grub_env_set (state[NEXT_SET_DEVICE].arg, part_name)) if (VasEBoot_env_set (state[NEXT_SET_DEVICE].arg, part_name))
goto done; goto done;
if (grub_env_set (state[NEXT_SET_UUID].arg, part_guid)) if (VasEBoot_env_set (state[NEXT_SET_UUID].arg, part_guid))
goto done; goto done;
grub_errno = GRUB_ERR_NONE; VasEBoot_errno = VasEBoot_ERR_NONE;
done: done:
grub_free (root); VasEBoot_free (root);
grub_free (part_name); VasEBoot_free (part_name);
grub_free (part_guid); VasEBoot_free (part_guid);
return grub_errno; return VasEBoot_errno;
} }
static grub_extcmd_t cmd_next; static VasEBoot_extcmd_t cmd_next;
GRUB_MOD_INIT(gptprio) VasEBoot_MOD_INIT(gptprio)
{ {
cmd_next = grub_register_extcmd ("gptprio.next", grub_cmd_next, 0, cmd_next = VasEBoot_register_extcmd ("gptprio.next", VasEBoot_cmd_next, 0,
N_("-d VARNAME -u VARNAME [DEVICE]"), N_("-d VARNAME -u VARNAME [DEVICE]"),
N_("Select next partition to boot."), N_("Select next partition to boot."),
options_next); options_next);
} }
GRUB_MOD_FINI(gptprio) VasEBoot_MOD_FINI(gptprio)
{ {
grub_unregister_extcmd (cmd_next); VasEBoot_unregister_extcmd (cmd_next);
} }

View File

@ -1,36 +1,36 @@
/* gptrepair.c - verify and restore GPT info from alternate location. */ /* gptrepair.c - verify and restore GPT info from alternate location. */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc. * Copyright (C) 2009 Free Software Foundation, Inc.
* Copyright (C) 2014 CoreOS, Inc. * Copyright (C) 2014 CoreOS, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/command.h> #include <VasEBoot/command.h>
#include <grub/device.h> #include <VasEBoot/device.h>
#include <grub/err.h> #include <VasEBoot/err.h>
#include <grub/gpt_partition.h> #include <VasEBoot/gpt_partition.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static char * static char *
trim_dev_name (char *name) trim_dev_name (char *name)
{ {
grub_size_t len = grub_strlen (name); VasEBoot_size_t len = VasEBoot_strlen (name);
if (len && name[0] == '(' && name[len - 1] == ')') if (len && name[0] == '(' && name[len - 1] == ')')
{ {
name[len - 1] = '\0'; name[len - 1] = '\0';
@ -39,72 +39,72 @@ trim_dev_name (char *name)
return name; return name;
} }
static grub_err_t static VasEBoot_err_t
grub_cmd_gptrepair (grub_command_t cmd __attribute__ ((unused)), VasEBoot_cmd_gptrepair (VasEBoot_command_t cmd __attribute__ ((unused)),
int argc, char **args) int argc, char **args)
{ {
grub_device_t dev = NULL; VasEBoot_device_t dev = NULL;
grub_gpt_t gpt = NULL; VasEBoot_gpt_t gpt = NULL;
char *dev_name; char *dev_name;
if (argc != 1 || !grub_strlen(args[0])) if (argc != 1 || !VasEBoot_strlen(args[0]))
return grub_error (GRUB_ERR_BAD_ARGUMENT, "device name required"); return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, "device name required");
dev_name = trim_dev_name (args[0]); dev_name = trim_dev_name (args[0]);
dev = grub_device_open (dev_name); dev = VasEBoot_device_open (dev_name);
if (!dev) if (!dev)
goto done; goto done;
if (!dev->disk) if (!dev->disk)
{ {
grub_error (GRUB_ERR_BAD_ARGUMENT, "not a disk"); VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, "not a disk");
goto done; goto done;
} }
gpt = grub_gpt_read (dev->disk); gpt = VasEBoot_gpt_read (dev->disk);
if (!gpt) if (!gpt)
goto done; goto done;
if (grub_gpt_both_valid (gpt)) if (VasEBoot_gpt_both_valid (gpt))
{ {
grub_printf_ (N_("GPT already valid, %s unmodified.\n"), dev_name); VasEBoot_printf_ (N_("GPT already valid, %s unmodified.\n"), dev_name);
goto done; goto done;
} }
if (!grub_gpt_primary_valid (gpt)) if (!VasEBoot_gpt_primary_valid (gpt))
grub_printf_ (N_("Found invalid primary GPT on %s\n"), dev_name); VasEBoot_printf_ (N_("Found invalid primary GPT on %s\n"), dev_name);
if (!grub_gpt_backup_valid (gpt)) if (!VasEBoot_gpt_backup_valid (gpt))
grub_printf_ (N_("Found invalid backup GPT on %s\n"), dev_name); VasEBoot_printf_ (N_("Found invalid backup GPT on %s\n"), dev_name);
if (grub_gpt_repair (dev->disk, gpt)) if (VasEBoot_gpt_repair (dev->disk, gpt))
goto done; goto done;
if (grub_gpt_write (dev->disk, gpt)) if (VasEBoot_gpt_write (dev->disk, gpt))
goto done; goto done;
grub_printf_ (N_("Repaired GPT on %s\n"), dev_name); VasEBoot_printf_ (N_("Repaired GPT on %s\n"), dev_name);
done: done:
if (gpt) if (gpt)
grub_gpt_free (gpt); VasEBoot_gpt_free (gpt);
if (dev) if (dev)
grub_device_close (dev); VasEBoot_device_close (dev);
return grub_errno; return VasEBoot_errno;
} }
static grub_command_t cmd; static VasEBoot_command_t cmd;
GRUB_MOD_INIT(gptrepair) VasEBoot_MOD_INIT(gptrepair)
{ {
cmd = grub_register_command ("gptrepair", grub_cmd_gptrepair, cmd = VasEBoot_register_command ("gptrepair", VasEBoot_cmd_gptrepair,
N_("DEVICE"), N_("DEVICE"),
N_("Verify and repair GPT on drive DEVICE.")); N_("Verify and repair GPT on drive DEVICE."));
} }
GRUB_MOD_FINI(gptrepair) VasEBoot_MOD_FINI(gptrepair)
{ {
grub_unregister_command (cmd); VasEBoot_unregister_command (cmd);
} }

View File

@ -1,47 +1,47 @@
/* gptsync.c - fill the mbr based on gpt entries */ /* gptsync.c - fill the mbr based on gpt entries */
/* XXX: I don't know what to do if sector size isn't 512 bytes */ /* XXX: I don't know what to do if sector size isn't 512 bytes */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc. * Copyright (C) 2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/command.h> #include <VasEBoot/command.h>
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/device.h> #include <VasEBoot/device.h>
#include <grub/disk.h> #include <VasEBoot/disk.h>
#include <grub/msdos_partition.h> #include <VasEBoot/msdos_partition.h>
#include <grub/partition.h> #include <VasEBoot/partition.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/mm.h> #include <VasEBoot/mm.h>
#include <grub/fs.h> #include <VasEBoot/fs.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
/* Convert a LBA address to a CHS address in the INT 13 format. */ /* Convert a LBA address to a CHS address in the INT 13 format. */
/* Taken from grub1. */ /* Taken from VasEBoot1. */
/* XXX: use hardcoded geometry of C = 1024, H = 255, S = 63. /* XXX: use hardcoded geometry of C = 1024, H = 255, S = 63.
Is it a problem? Is it a problem?
*/ */
static void static void
lba_to_chs (grub_uint32_t lba, grub_uint8_t *cl, grub_uint8_t *ch, lba_to_chs (VasEBoot_uint32_t lba, VasEBoot_uint8_t *cl, VasEBoot_uint8_t *ch,
grub_uint8_t *dh) VasEBoot_uint8_t *dh)
{ {
grub_uint32_t cylinder, head, sector; VasEBoot_uint32_t cylinder, head, sector;
grub_uint32_t sectors = 63, heads = 255, cylinders = 1024; VasEBoot_uint32_t sectors = 63, heads = 255, cylinders = 1024;
sector = lba % sectors + 1; sector = lba % sectors + 1;
head = (lba / sectors) % heads; head = (lba / sectors) % heads;
@ -58,92 +58,92 @@ lba_to_chs (grub_uint32_t lba, grub_uint8_t *cl, grub_uint8_t *ch,
*dh = head; *dh = head;
} }
static grub_err_t static VasEBoot_err_t
grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)), VasEBoot_cmd_gptsync (VasEBoot_command_t cmd __attribute__ ((unused)),
int argc, char **args) int argc, char **args)
{ {
grub_device_t dev; VasEBoot_device_t dev;
struct grub_msdos_partition_mbr mbr; struct VasEBoot_msdos_partition_mbr mbr;
struct grub_partition *partition; struct VasEBoot_partition *partition;
grub_disk_addr_t first_sector; VasEBoot_disk_addr_t first_sector;
int numactive = 0; int numactive = 0;
int i; int i;
if (argc < 1) if (argc < 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "device name required"); return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, "device name required");
if (argc > 4) if (argc > 4)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "only 3 partitions can be " return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, "only 3 partitions can be "
"in hybrid MBR"); "in hybrid MBR");
if (args[0][0] == '(' && args[0][grub_strlen (args[0]) - 1] == ')') if (args[0][0] == '(' && args[0][VasEBoot_strlen (args[0]) - 1] == ')')
{ {
args[0][grub_strlen (args[0]) - 1] = 0; args[0][VasEBoot_strlen (args[0]) - 1] = 0;
dev = grub_device_open (args[0] + 1); dev = VasEBoot_device_open (args[0] + 1);
args[0][grub_strlen (args[0])] = ')'; args[0][VasEBoot_strlen (args[0])] = ')';
} }
else else
dev = grub_device_open (args[0]); dev = VasEBoot_device_open (args[0]);
if (! dev) if (! dev)
return grub_errno; return VasEBoot_errno;
if (! dev->disk) if (! dev->disk)
{ {
grub_device_close (dev); VasEBoot_device_close (dev);
return grub_error (GRUB_ERR_BAD_ARGUMENT, "not a disk"); return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, "not a disk");
} }
/* Read the protective MBR. */ /* Read the protective MBR. */
if (grub_disk_read (dev->disk, 0, 0, sizeof (mbr), &mbr)) if (VasEBoot_disk_read (dev->disk, 0, 0, sizeof (mbr), &mbr))
{ {
grub_device_close (dev); VasEBoot_device_close (dev);
return grub_errno; return VasEBoot_errno;
} }
/* Check if it is valid. */ /* Check if it is valid. */
if (mbr.signature != grub_cpu_to_le16_compile_time (GRUB_PC_PARTITION_SIGNATURE)) if (mbr.signature != VasEBoot_cpu_to_le16_compile_time (VasEBoot_PC_PARTITION_SIGNATURE))
{ {
grub_device_close (dev); VasEBoot_device_close (dev);
return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature"); return VasEBoot_error (VasEBoot_ERR_BAD_PART_TABLE, "no signature");
} }
/* Make sure the MBR is a protective MBR and not a normal MBR. */ /* Make sure the MBR is a protective MBR and not a normal MBR. */
for (i = 0; i < 4; i++) for (i = 0; i < 4; i++)
if (mbr.entries[i].type == GRUB_PC_PARTITION_TYPE_GPT_DISK) if (mbr.entries[i].type == VasEBoot_PC_PARTITION_TYPE_GPT_DISK)
break; break;
if (i == 4) if (i == 4)
{ {
grub_device_close (dev); VasEBoot_device_close (dev);
return grub_error (GRUB_ERR_BAD_PART_TABLE, "no GPT partition map found"); return VasEBoot_error (VasEBoot_ERR_BAD_PART_TABLE, "no GPT partition map found");
} }
first_sector = dev->disk->total_sectors; first_sector = dev->disk->total_sectors;
for (i = 1; i < argc; i++) for (i = 1; i < argc; i++)
{ {
char *separator, csep = 0; char *separator, csep = 0;
grub_uint8_t type; VasEBoot_uint8_t type;
separator = grub_strchr (args[i], '+'); separator = VasEBoot_strchr (args[i], '+');
if (! separator) if (! separator)
separator = grub_strchr (args[i], '-'); separator = VasEBoot_strchr (args[i], '-');
if (separator) if (separator)
{ {
csep = *separator; csep = *separator;
*separator = 0; *separator = 0;
} }
partition = grub_partition_probe (dev->disk, args[i]); partition = VasEBoot_partition_probe (dev->disk, args[i]);
if (separator) if (separator)
*separator = csep; *separator = csep;
if (! partition) if (! partition)
{ {
grub_device_close (dev); VasEBoot_device_close (dev);
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, return VasEBoot_error (VasEBoot_ERR_UNKNOWN_DEVICE,
N_("no such partition")); N_("no such partition"));
} }
if (partition->start + partition->len > 0xffffffff) if (partition->start + partition->len > 0xffffffff)
{ {
grub_device_close (dev); VasEBoot_device_close (dev);
return grub_error (GRUB_ERR_OUT_OF_RANGE, return VasEBoot_error (VasEBoot_ERR_OUT_OF_RANGE,
"only partitions residing in the first 2TB " "only partitions residing in the first 2TB "
"can be present in hybrid MBR"); "can be present in hybrid MBR");
} }
@ -153,31 +153,31 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)),
first_sector = partition->start; first_sector = partition->start;
if (separator && *(separator + 1)) if (separator && *(separator + 1))
type = grub_strtoul (separator + 1, 0, 0); type = VasEBoot_strtoul (separator + 1, 0, 0);
else else
{ {
grub_fs_t fs = 0; VasEBoot_fs_t fs = 0;
dev->disk->partition = partition; dev->disk->partition = partition;
fs = grub_fs_probe (dev); fs = VasEBoot_fs_probe (dev);
/* Unknown filesystem isn't fatal. */ /* Unknown filesystem isn't fatal. */
if (grub_errno == GRUB_ERR_UNKNOWN_FS) if (VasEBoot_errno == VasEBoot_ERR_UNKNOWN_FS)
{ {
fs = 0; fs = 0;
grub_errno = GRUB_ERR_NONE; VasEBoot_errno = VasEBoot_ERR_NONE;
} }
if (fs && grub_strcmp (fs->name, "ntfs") == 0) if (fs && VasEBoot_strcmp (fs->name, "ntfs") == 0)
type = GRUB_PC_PARTITION_TYPE_NTFS; type = VasEBoot_PC_PARTITION_TYPE_NTFS;
else if (fs && grub_strcmp (fs->name, "fat") == 0) else if (fs && VasEBoot_strcmp (fs->name, "fat") == 0)
/* FIXME: detect FAT16. */ /* FIXME: detect FAT16. */
type = GRUB_PC_PARTITION_TYPE_FAT32_LBA; type = VasEBoot_PC_PARTITION_TYPE_FAT32_LBA;
else if (fs && (grub_strcmp (fs->name, "hfsplus") == 0 else if (fs && (VasEBoot_strcmp (fs->name, "hfsplus") == 0
|| grub_strcmp (fs->name, "hfs") == 0)) || VasEBoot_strcmp (fs->name, "hfs") == 0))
type = GRUB_PC_PARTITION_TYPE_HFS; type = VasEBoot_PC_PARTITION_TYPE_HFS;
else else
/* FIXME: detect more types. */ /* FIXME: detect more types. */
type = GRUB_PC_PARTITION_TYPE_EXT2FS; type = VasEBoot_PC_PARTITION_TYPE_EXT2FS;
dev->disk->partition = 0; dev->disk->partition = 0;
} }
@ -188,13 +188,13 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)),
numactive++; numactive++;
if (numactive == 2) if (numactive == 2)
{ {
grub_device_close (dev); VasEBoot_device_close (dev);
return grub_error (GRUB_ERR_BAD_ARGUMENT, return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT,
"only one partition can be active"); "only one partition can be active");
} }
} }
mbr.entries[i].type = type; mbr.entries[i].type = type;
mbr.entries[i].start = grub_cpu_to_le32 (partition->start); mbr.entries[i].start = VasEBoot_cpu_to_le32 (partition->start);
lba_to_chs (partition->start, lba_to_chs (partition->start,
&(mbr.entries[i].start_sector), &(mbr.entries[i].start_sector),
&(mbr.entries[i].start_cylinder), &(mbr.entries[i].start_cylinder),
@ -203,11 +203,11 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)),
&(mbr.entries[i].end_sector), &(mbr.entries[i].end_sector),
&(mbr.entries[i].end_cylinder), &(mbr.entries[i].end_cylinder),
&(mbr.entries[i].end_head)); &(mbr.entries[i].end_head));
mbr.entries[i].length = grub_cpu_to_le32 (partition->len); mbr.entries[i].length = VasEBoot_cpu_to_le32 (partition->len);
grub_free (partition); VasEBoot_free (partition);
} }
for (; i < 4; i++) for (; i < 4; i++)
grub_memset (&(mbr.entries[i]), 0, sizeof (mbr.entries[i])); VasEBoot_memset (&(mbr.entries[i]), 0, sizeof (mbr.entries[i]));
/* The protective partition. */ /* The protective partition. */
if (first_sector > 0xffffffff) if (first_sector > 0xffffffff)
@ -215,8 +215,8 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)),
else else
first_sector--; first_sector--;
mbr.entries[0].flag = 0; mbr.entries[0].flag = 0;
mbr.entries[0].type = GRUB_PC_PARTITION_TYPE_GPT_DISK; mbr.entries[0].type = VasEBoot_PC_PARTITION_TYPE_GPT_DISK;
mbr.entries[0].start = grub_cpu_to_le32_compile_time (1); mbr.entries[0].start = VasEBoot_cpu_to_le32_compile_time (1);
lba_to_chs (1, lba_to_chs (1,
&(mbr.entries[0].start_sector), &(mbr.entries[0].start_sector),
&(mbr.entries[0].start_cylinder), &(mbr.entries[0].start_cylinder),
@ -225,30 +225,30 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)),
&(mbr.entries[0].end_sector), &(mbr.entries[0].end_sector),
&(mbr.entries[0].end_cylinder), &(mbr.entries[0].end_cylinder),
&(mbr.entries[0].end_head)); &(mbr.entries[0].end_head));
mbr.entries[0].length = grub_cpu_to_le32 (first_sector); mbr.entries[0].length = VasEBoot_cpu_to_le32 (first_sector);
mbr.signature = grub_cpu_to_le16_compile_time (GRUB_PC_PARTITION_SIGNATURE); mbr.signature = VasEBoot_cpu_to_le16_compile_time (VasEBoot_PC_PARTITION_SIGNATURE);
if (grub_disk_write (dev->disk, 0, 0, sizeof (mbr), &mbr)) if (VasEBoot_disk_write (dev->disk, 0, 0, sizeof (mbr), &mbr))
{ {
grub_device_close (dev); VasEBoot_device_close (dev);
return grub_errno; return VasEBoot_errno;
} }
grub_device_close (dev); VasEBoot_device_close (dev);
grub_printf_ (N_("New MBR is written to `%s'\n"), args[0]); VasEBoot_printf_ (N_("New MBR is written to `%s'\n"), args[0]);
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
} }
static grub_command_t cmd; static VasEBoot_command_t cmd;
GRUB_MOD_INIT(gptsync) VasEBoot_MOD_INIT(gptsync)
{ {
(void) mod; /* To stop warning. */ (void) mod; /* To stop warning. */
cmd = grub_register_command ("gptsync", grub_cmd_gptsync, cmd = VasEBoot_register_command ("gptsync", VasEBoot_cmd_gptsync,
N_("DEVICE [PARTITION[+/-[TYPE]]] ..."), N_("DEVICE [PARTITION[+/-[TYPE]]] ..."),
/* TRANSLATORS: MBR type is one-byte partition /* TRANSLATORS: MBR type is one-byte partition
type id. */ type id. */
@ -260,7 +260,7 @@ GRUB_MOD_INIT(gptsync)
"Only one partition can be active.")); "Only one partition can be active."));
} }
GRUB_MOD_FINI(gptsync) VasEBoot_MOD_FINI(gptsync)
{ {
grub_unregister_command (cmd); VasEBoot_unregister_command (cmd);
} }

View File

@ -1,47 +1,47 @@
/* halt.c - command to halt the computer. */ /* halt.c - command to halt the computer. */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2005,2007,2008 Free Software Foundation, Inc. * Copyright (C) 2005,2007,2008 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/command.h> #include <VasEBoot/command.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static grub_err_t __attribute__ ((noreturn)) static VasEBoot_err_t __attribute__ ((noreturn))
grub_cmd_halt (grub_command_t cmd __attribute__ ((unused)), VasEBoot_cmd_halt (VasEBoot_command_t cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)), int argc __attribute__ ((unused)),
char **args __attribute__ ((unused))) char **args __attribute__ ((unused)))
{ {
grub_halt (); VasEBoot_halt ();
} }
static grub_command_t cmd; static VasEBoot_command_t cmd;
GRUB_MOD_INIT(halt) VasEBoot_MOD_INIT(halt)
{ {
cmd = grub_register_command ("halt", grub_cmd_halt, cmd = VasEBoot_register_command ("halt", VasEBoot_cmd_halt,
0, N_("Halts the computer. This command does" 0, N_("Halts the computer. This command does"
" not work on all firmware implementations.")); " not work on all firmware implementations."));
} }
GRUB_MOD_FINI(halt) VasEBoot_MOD_FINI(halt)
{ {
grub_unregister_command (cmd); VasEBoot_unregister_command (cmd);
} }

View File

@ -1,34 +1,34 @@
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc. * Copyright (C) 2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/extcmd.h> #include <VasEBoot/extcmd.h>
#include <grub/file.h> #include <VasEBoot/file.h>
#include <grub/disk.h> #include <VasEBoot/disk.h>
#include <grub/mm.h> #include <VasEBoot/mm.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/crypto.h> #include <VasEBoot/crypto.h>
#include <grub/normal.h> #include <VasEBoot/normal.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static const struct grub_arg_option options[] = { static const struct VasEBoot_arg_option options[] = {
{"hash", 'h', 0, N_("Specify hash to use."), N_("HASH"), ARG_TYPE_STRING}, {"hash", 'h', 0, N_("Specify hash to use."), N_("HASH"), ARG_TYPE_STRING},
{"check", 'c', 0, N_("Check hashes of files with hash list FILE."), {"check", 'c', 0, N_("Check hashes of files with hash list FILE."),
N_("FILE"), ARG_TYPE_STRING}, N_("FILE"), ARG_TYPE_STRING},
@ -60,24 +60,24 @@ hextoval (char c)
return -1; return -1;
} }
static grub_err_t static VasEBoot_err_t
hash_file (grub_file_t file, const gcry_md_spec_t *hash, void *result) hash_file (VasEBoot_file_t file, const gcry_md_spec_t *hash, void *result)
{ {
void *context; void *context;
grub_uint8_t *readbuf; VasEBoot_uint8_t *readbuf;
#define BUF_SIZE 4096 #define BUF_SIZE 4096
readbuf = grub_malloc (BUF_SIZE); readbuf = VasEBoot_malloc (BUF_SIZE);
if (!readbuf) if (!readbuf)
return grub_errno; return VasEBoot_errno;
context = grub_zalloc (hash->contextsize); context = VasEBoot_zalloc (hash->contextsize);
if (!readbuf || !context) if (!readbuf || !context)
goto fail; goto fail;
hash->init (context); hash->init (context);
while (1) while (1)
{ {
grub_ssize_t r; VasEBoot_ssize_t r;
r = grub_file_read (file, readbuf, BUF_SIZE); r = VasEBoot_file_read (file, readbuf, BUF_SIZE);
if (r < 0) if (r < 0)
goto fail; goto fail;
if (r == 0) if (r == 0)
@ -85,42 +85,42 @@ hash_file (grub_file_t file, const gcry_md_spec_t *hash, void *result)
hash->write (context, readbuf, r); hash->write (context, readbuf, r);
} }
hash->final (context); hash->final (context);
grub_memcpy (result, hash->read (context), hash->mdlen); VasEBoot_memcpy (result, hash->read (context), hash->mdlen);
grub_free (readbuf); VasEBoot_free (readbuf);
grub_free (context); VasEBoot_free (context);
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
fail: fail:
grub_free (readbuf); VasEBoot_free (readbuf);
grub_free (context); VasEBoot_free (context);
return grub_errno; return VasEBoot_errno;
} }
static grub_err_t static VasEBoot_err_t
check_list (const gcry_md_spec_t *hash, const char *hashfilename, check_list (const gcry_md_spec_t *hash, const char *hashfilename,
const char *prefix, int keep, int uncompress) const char *prefix, int keep, int uncompress)
{ {
grub_file_t hashlist, file; VasEBoot_file_t hashlist, file;
char *buf = NULL; char *buf = NULL;
grub_uint8_t expected[GRUB_CRYPTO_MAX_MDLEN]; VasEBoot_uint8_t expected[VasEBoot_CRYPTO_MAX_MDLEN];
grub_uint8_t actual[GRUB_CRYPTO_MAX_MDLEN]; VasEBoot_uint8_t actual[VasEBoot_CRYPTO_MAX_MDLEN];
grub_err_t err; VasEBoot_err_t err;
unsigned i; unsigned i;
unsigned unread = 0, mismatch = 0; unsigned unread = 0, mismatch = 0;
if (hash->mdlen > GRUB_CRYPTO_MAX_MDLEN) if (hash->mdlen > VasEBoot_CRYPTO_MAX_MDLEN)
return grub_error (GRUB_ERR_BUG, "mdlen is too long"); return VasEBoot_error (VasEBoot_ERR_BUG, "mdlen is too long");
hashlist = grub_file_open (hashfilename); hashlist = VasEBoot_file_open (hashfilename);
if (!hashlist) if (!hashlist)
return grub_errno; return VasEBoot_errno;
while (grub_free (buf), (buf = grub_file_getline (hashlist))) while (VasEBoot_free (buf), (buf = VasEBoot_file_getline (hashlist)))
{ {
const char *p = buf; const char *p = buf;
while (grub_isspace (p[0])) while (VasEBoot_isspace (p[0]))
p++; p++;
for (i = 0; i < hash->mdlen; i++) for (i = 0; i < hash->mdlen; i++)
{ {
@ -128,79 +128,79 @@ check_list (const gcry_md_spec_t *hash, const char *hashfilename,
high = hextoval (*p++); high = hextoval (*p++);
low = hextoval (*p++); low = hextoval (*p++);
if (high < 0 || low < 0) if (high < 0 || low < 0)
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "invalid hash list"); return VasEBoot_error (VasEBoot_ERR_BAD_FILE_TYPE, "invalid hash list");
expected[i] = (high << 4) | low; expected[i] = (high << 4) | low;
} }
if ((p[0] != ' ' && p[0] != '\t') || (p[1] != ' ' && p[1] != '\t')) if ((p[0] != ' ' && p[0] != '\t') || (p[1] != ' ' && p[1] != '\t'))
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "invalid hash list"); return VasEBoot_error (VasEBoot_ERR_BAD_FILE_TYPE, "invalid hash list");
p += 2; p += 2;
if (prefix) if (prefix)
{ {
char *filename; char *filename;
filename = grub_xasprintf ("%s/%s", prefix, p); filename = VasEBoot_xasprintf ("%s/%s", prefix, p);
if (!filename) if (!filename)
return grub_errno; return VasEBoot_errno;
if (!uncompress) if (!uncompress)
grub_file_filter_disable_compression (); VasEBoot_file_filter_disable_compression ();
file = grub_file_open (filename); file = VasEBoot_file_open (filename);
grub_free (filename); VasEBoot_free (filename);
} }
else else
{ {
if (!uncompress) if (!uncompress)
grub_file_filter_disable_compression (); VasEBoot_file_filter_disable_compression ();
file = grub_file_open (p); file = VasEBoot_file_open (p);
} }
if (!file) if (!file)
{ {
grub_file_close (hashlist); VasEBoot_file_close (hashlist);
grub_free (buf); VasEBoot_free (buf);
return grub_errno; return VasEBoot_errno;
} }
err = hash_file (file, hash, actual); err = hash_file (file, hash, actual);
grub_file_close (file); VasEBoot_file_close (file);
if (err) if (err)
{ {
grub_printf_ (N_("%s: READ ERROR\n"), p); VasEBoot_printf_ (N_("%s: READ ERROR\n"), p);
if (!keep) if (!keep)
{ {
grub_file_close (hashlist); VasEBoot_file_close (hashlist);
grub_free (buf); VasEBoot_free (buf);
return err; return err;
} }
grub_print_error (); VasEBoot_print_error ();
grub_errno = GRUB_ERR_NONE; VasEBoot_errno = VasEBoot_ERR_NONE;
unread++; unread++;
continue; continue;
} }
if (grub_crypto_memcmp (expected, actual, hash->mdlen) != 0) if (VasEBoot_crypto_memcmp (expected, actual, hash->mdlen) != 0)
{ {
grub_printf_ (N_("%s: HASH MISMATCH\n"), p); VasEBoot_printf_ (N_("%s: HASH MISMATCH\n"), p);
if (!keep) if (!keep)
{ {
grub_file_close (hashlist); VasEBoot_file_close (hashlist);
grub_free (buf); VasEBoot_free (buf);
return grub_error (GRUB_ERR_TEST_FAILURE, return VasEBoot_error (VasEBoot_ERR_TEST_FAILURE,
"hash of '%s' mismatches", p); "hash of '%s' mismatches", p);
} }
mismatch++; mismatch++;
continue; continue;
} }
grub_printf_ (N_("%s: OK\n"), p); VasEBoot_printf_ (N_("%s: OK\n"), p);
} }
if (mismatch || unread) if (mismatch || unread)
return grub_error (GRUB_ERR_TEST_FAILURE, return VasEBoot_error (VasEBoot_ERR_TEST_FAILURE,
"%d files couldn't be read and hash " "%d files couldn't be read and hash "
"of %d files mismatches", unread, mismatch); "of %d files mismatches", unread, mismatch);
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
} }
static grub_err_t static VasEBoot_err_t
grub_cmd_hashsum (struct grub_extcmd_context *ctxt, VasEBoot_cmd_hashsum (struct VasEBoot_extcmd_context *ctxt,
int argc, char **args) int argc, char **args)
{ {
struct grub_arg_list *state = ctxt->state; struct VasEBoot_arg_list *state = ctxt->state;
const char *hashname = NULL; const char *hashname = NULL;
const char *prefix = NULL; const char *prefix = NULL;
const gcry_md_spec_t *hash; const gcry_md_spec_t *hash;
@ -210,20 +210,20 @@ grub_cmd_hashsum (struct grub_extcmd_context *ctxt,
unsigned unread = 0; unsigned unread = 0;
for (i = 0; i < ARRAY_SIZE (aliases); i++) for (i = 0; i < ARRAY_SIZE (aliases); i++)
if (grub_strcmp (ctxt->extcmd->cmd->name, aliases[i].name) == 0) if (VasEBoot_strcmp (ctxt->extcmd->cmd->name, aliases[i].name) == 0)
hashname = aliases[i].hashname; hashname = aliases[i].hashname;
if (state[0].set) if (state[0].set)
hashname = state[0].arg; hashname = state[0].arg;
if (!hashname) if (!hashname)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no hash specified"); return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, "no hash specified");
hash = grub_crypto_lookup_md_by_name (hashname); hash = VasEBoot_crypto_lookup_md_by_name (hashname);
if (!hash) if (!hash)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "unknown hash"); return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, "unknown hash");
if (hash->mdlen > GRUB_CRYPTO_MAX_MDLEN) if (hash->mdlen > VasEBoot_CRYPTO_MAX_MDLEN)
return grub_error (GRUB_ERR_BUG, "mdlen is too long"); return VasEBoot_error (VasEBoot_ERR_BUG, "mdlen is too long");
if (state[2].set) if (state[2].set)
prefix = state[2].arg; prefix = state[2].arg;
@ -231,56 +231,56 @@ grub_cmd_hashsum (struct grub_extcmd_context *ctxt,
if (state[1].set) if (state[1].set)
{ {
if (argc != 0) if (argc != 0)
return grub_error (GRUB_ERR_BAD_ARGUMENT, return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT,
"--check is incompatible with file list"); "--check is incompatible with file list");
return check_list (hash, state[1].arg, prefix, keep, uncompress); return check_list (hash, state[1].arg, prefix, keep, uncompress);
} }
for (i = 0; i < (unsigned) argc; i++) for (i = 0; i < (unsigned) argc; i++)
{ {
GRUB_PROPERLY_ALIGNED_ARRAY (result, GRUB_CRYPTO_MAX_MDLEN); VasEBoot_PROPERLY_ALIGNED_ARRAY (result, VasEBoot_CRYPTO_MAX_MDLEN);
grub_file_t file; VasEBoot_file_t file;
grub_err_t err; VasEBoot_err_t err;
unsigned j; unsigned j;
if (!uncompress) if (!uncompress)
grub_file_filter_disable_compression (); VasEBoot_file_filter_disable_compression ();
file = grub_file_open (args[i]); file = VasEBoot_file_open (args[i]);
if (!file) if (!file)
{ {
if (!keep) if (!keep)
return grub_errno; return VasEBoot_errno;
grub_print_error (); VasEBoot_print_error ();
grub_errno = GRUB_ERR_NONE; VasEBoot_errno = VasEBoot_ERR_NONE;
unread++; unread++;
continue; continue;
} }
err = hash_file (file, hash, result); err = hash_file (file, hash, result);
grub_file_close (file); VasEBoot_file_close (file);
if (err) if (err)
{ {
if (!keep) if (!keep)
return err; return err;
grub_print_error (); VasEBoot_print_error ();
grub_errno = GRUB_ERR_NONE; VasEBoot_errno = VasEBoot_ERR_NONE;
unread++; unread++;
continue; continue;
} }
for (j = 0; j < hash->mdlen; j++) for (j = 0; j < hash->mdlen; j++)
grub_printf ("%02x", ((grub_uint8_t *) result)[j]); VasEBoot_printf ("%02x", ((VasEBoot_uint8_t *) result)[j]);
grub_printf (" %s\n", args[i]); VasEBoot_printf (" %s\n", args[i]);
} }
if (unread) if (unread)
return grub_error (GRUB_ERR_TEST_FAILURE, "%d files couldn't be read", return VasEBoot_error (VasEBoot_ERR_TEST_FAILURE, "%d files couldn't be read",
unread); unread);
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
} }
static grub_extcmd_t cmd, cmd_md5, cmd_sha1, cmd_sha256, cmd_sha512, cmd_crc; static VasEBoot_extcmd_t cmd, cmd_md5, cmd_sha1, cmd_sha256, cmd_sha512, cmd_crc;
GRUB_MOD_INIT(hashsum) VasEBoot_MOD_INIT(hashsum)
{ {
cmd = grub_register_extcmd ("hashsum", grub_cmd_hashsum, 0, cmd = VasEBoot_register_extcmd ("hashsum", VasEBoot_cmd_hashsum, 0,
N_("-h HASH [-c FILE [-p PREFIX]] " N_("-h HASH [-c FILE [-p PREFIX]] "
"[FILE1 [FILE2 ...]]"), "[FILE1 [FILE2 ...]]"),
/* TRANSLATORS: "hash checksum" is just to /* TRANSLATORS: "hash checksum" is just to
@ -288,40 +288,40 @@ GRUB_MOD_INIT(hashsum)
just "hash". */ just "hash". */
N_("Compute or check hash checksum."), N_("Compute or check hash checksum."),
options); options);
cmd_md5 = grub_register_extcmd ("md5sum", grub_cmd_hashsum, 0, cmd_md5 = VasEBoot_register_extcmd ("md5sum", VasEBoot_cmd_hashsum, 0,
N_("[-c FILE [-p PREFIX]] " N_("[-c FILE [-p PREFIX]] "
"[FILE1 [FILE2 ...]]"), "[FILE1 [FILE2 ...]]"),
N_("Compute or check hash checksum."), N_("Compute or check hash checksum."),
options); options);
cmd_sha1 = grub_register_extcmd ("sha1sum", grub_cmd_hashsum, 0, cmd_sha1 = VasEBoot_register_extcmd ("sha1sum", VasEBoot_cmd_hashsum, 0,
N_("[-c FILE [-p PREFIX]] " N_("[-c FILE [-p PREFIX]] "
"[FILE1 [FILE2 ...]]"), "[FILE1 [FILE2 ...]]"),
N_("Compute or check hash checksum."), N_("Compute or check hash checksum."),
options); options);
cmd_sha256 = grub_register_extcmd ("sha256sum", grub_cmd_hashsum, 0, cmd_sha256 = VasEBoot_register_extcmd ("sha256sum", VasEBoot_cmd_hashsum, 0,
N_("[-c FILE [-p PREFIX]] " N_("[-c FILE [-p PREFIX]] "
"[FILE1 [FILE2 ...]]"), "[FILE1 [FILE2 ...]]"),
N_("Compute or check hash checksum."), N_("Compute or check hash checksum."),
options); options);
cmd_sha512 = grub_register_extcmd ("sha512sum", grub_cmd_hashsum, 0, cmd_sha512 = VasEBoot_register_extcmd ("sha512sum", VasEBoot_cmd_hashsum, 0,
N_("[-c FILE [-p PREFIX]] " N_("[-c FILE [-p PREFIX]] "
"[FILE1 [FILE2 ...]]"), "[FILE1 [FILE2 ...]]"),
N_("Compute or check hash checksum."), N_("Compute or check hash checksum."),
options); options);
cmd_crc = grub_register_extcmd ("crc", grub_cmd_hashsum, 0, cmd_crc = VasEBoot_register_extcmd ("crc", VasEBoot_cmd_hashsum, 0,
N_("[-c FILE [-p PREFIX]] " N_("[-c FILE [-p PREFIX]] "
"[FILE1 [FILE2 ...]]"), "[FILE1 [FILE2 ...]]"),
N_("Compute or check hash checksum."), N_("Compute or check hash checksum."),
options); options);
} }
GRUB_MOD_FINI(hashsum) VasEBoot_MOD_FINI(hashsum)
{ {
grub_unregister_extcmd (cmd); VasEBoot_unregister_extcmd (cmd);
grub_unregister_extcmd (cmd_md5); VasEBoot_unregister_extcmd (cmd_md5);
grub_unregister_extcmd (cmd_sha1); VasEBoot_unregister_extcmd (cmd_sha1);
grub_unregister_extcmd (cmd_sha256); VasEBoot_unregister_extcmd (cmd_sha256);
grub_unregister_extcmd (cmd_sha512); VasEBoot_unregister_extcmd (cmd_sha512);
grub_unregister_extcmd (cmd_crc); VasEBoot_unregister_extcmd (cmd_crc);
} }

View File

@ -1,35 +1,35 @@
/* hdparm.c - command to get/set ATA disk parameters. */ /* hdparm.c - command to get/set ATA disk parameters. */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc. * Copyright (C) 2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/ata.h> #include <VasEBoot/ata.h>
#include <grub/scsi.h> #include <VasEBoot/scsi.h>
#include <grub/disk.h> #include <VasEBoot/disk.h>
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/mm.h> #include <VasEBoot/mm.h>
#include <grub/lib/hexdump.h> #include <VasEBoot/lib/hexdump.h>
#include <grub/extcmd.h> #include <VasEBoot/extcmd.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static const struct grub_arg_option options[] = { static const struct VasEBoot_arg_option options[] = {
{"apm", 'B', 0, N_("Set Advanced Power Management\n" {"apm", 'B', 0, N_("Set Advanced Power Management\n"
"(1=low, ..., 254=high, 255=off)."), "(1=low, ..., 254=high, 255=off)."),
0, ARG_TYPE_INT}, 0, ARG_TYPE_INT},
@ -54,22 +54,22 @@ static const struct grub_arg_option options[] = {
{0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0}
}; };
enum grub_ata_smart_commands enum VasEBoot_ata_smart_commands
{ {
GRUB_ATA_FEAT_SMART_ENABLE = 0xd8, VasEBoot_ATA_FEAT_SMART_ENABLE = 0xd8,
GRUB_ATA_FEAT_SMART_DISABLE = 0xd9, VasEBoot_ATA_FEAT_SMART_DISABLE = 0xd9,
GRUB_ATA_FEAT_SMART_STATUS = 0xda, VasEBoot_ATA_FEAT_SMART_STATUS = 0xda,
}; };
static int quiet = 0; static int quiet = 0;
static grub_err_t static VasEBoot_err_t
grub_hdparm_do_ata_cmd (grub_ata_t ata, grub_uint8_t cmd, VasEBoot_hdparm_do_ata_cmd (VasEBoot_ata_t ata, VasEBoot_uint8_t cmd,
grub_uint8_t features, grub_uint8_t sectors, VasEBoot_uint8_t features, VasEBoot_uint8_t sectors,
void * buffer, int size) void * buffer, int size)
{ {
struct grub_disk_ata_pass_through_parms apt; struct VasEBoot_disk_ata_pass_through_parms apt;
grub_memset (&apt, 0, sizeof (apt)); VasEBoot_memset (&apt, 0, sizeof (apt));
apt.taskfile.cmd = cmd; apt.taskfile.cmd = cmd;
apt.taskfile.features = features; apt.taskfile.features = features;
@ -80,18 +80,18 @@ grub_hdparm_do_ata_cmd (grub_ata_t ata, grub_uint8_t cmd,
apt.size = size; apt.size = size;
if (ata->dev->readwrite (ata, &apt, 0)) if (ata->dev->readwrite (ata, &apt, 0))
return grub_errno; return VasEBoot_errno;
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
} }
static int static int
grub_hdparm_do_check_powermode_cmd (grub_ata_t ata) VasEBoot_hdparm_do_check_powermode_cmd (VasEBoot_ata_t ata)
{ {
struct grub_disk_ata_pass_through_parms apt; struct VasEBoot_disk_ata_pass_through_parms apt;
grub_memset (&apt, 0, sizeof (apt)); VasEBoot_memset (&apt, 0, sizeof (apt));
apt.taskfile.cmd = GRUB_ATA_CMD_CHECK_POWER_MODE; apt.taskfile.cmd = VasEBoot_ATA_CMD_CHECK_POWER_MODE;
apt.taskfile.disk = 0xE0; apt.taskfile.disk = 0xE0;
if (ata->dev->readwrite (ata, &apt, 0)) if (ata->dev->readwrite (ata, &apt, 0))
@ -101,12 +101,12 @@ grub_hdparm_do_check_powermode_cmd (grub_ata_t ata)
} }
static int static int
grub_hdparm_do_smart_cmd (grub_ata_t ata, grub_uint8_t features) VasEBoot_hdparm_do_smart_cmd (VasEBoot_ata_t ata, VasEBoot_uint8_t features)
{ {
struct grub_disk_ata_pass_through_parms apt; struct VasEBoot_disk_ata_pass_through_parms apt;
grub_memset (&apt, 0, sizeof (apt)); VasEBoot_memset (&apt, 0, sizeof (apt));
apt.taskfile.cmd = GRUB_ATA_CMD_SMART; apt.taskfile.cmd = VasEBoot_ATA_CMD_SMART;
apt.taskfile.features = features; apt.taskfile.features = features;
apt.taskfile.lba_mid = 0x4f; apt.taskfile.lba_mid = 0x4f;
apt.taskfile.lba_high = 0xc2; apt.taskfile.lba_high = 0xc2;
@ -115,7 +115,7 @@ grub_hdparm_do_smart_cmd (grub_ata_t ata, grub_uint8_t features)
if (ata->dev->readwrite (ata, &apt, 0)) if (ata->dev->readwrite (ata, &apt, 0))
return -1; return -1;
if (features == GRUB_ATA_FEAT_SMART_STATUS) if (features == VasEBoot_ATA_FEAT_SMART_STATUS)
{ {
if ( apt.taskfile.lba_mid == 0x4f if ( apt.taskfile.lba_mid == 0x4f
&& apt.taskfile.lba_high == 0xc2) && apt.taskfile.lba_high == 0xc2)
@ -129,118 +129,118 @@ grub_hdparm_do_smart_cmd (grub_ata_t ata, grub_uint8_t features)
return 0; return 0;
} }
static grub_err_t static VasEBoot_err_t
grub_hdparm_simple_cmd (const char * msg, VasEBoot_hdparm_simple_cmd (const char * msg,
grub_ata_t ata, grub_uint8_t cmd) VasEBoot_ata_t ata, VasEBoot_uint8_t cmd)
{ {
if (! quiet && msg) if (! quiet && msg)
grub_printf ("%s", msg); VasEBoot_printf ("%s", msg);
grub_err_t err = grub_hdparm_do_ata_cmd (ata, cmd, 0, 0, NULL, 0); VasEBoot_err_t err = VasEBoot_hdparm_do_ata_cmd (ata, cmd, 0, 0, NULL, 0);
if (! quiet && msg) if (! quiet && msg)
grub_printf ("%s\n", ! err ? "" : ": not supported"); VasEBoot_printf ("%s\n", ! err ? "" : ": not supported");
return err; return err;
} }
static grub_err_t static VasEBoot_err_t
grub_hdparm_set_val_cmd (const char * msg, int val, VasEBoot_hdparm_set_val_cmd (const char * msg, int val,
grub_ata_t ata, grub_uint8_t cmd, VasEBoot_ata_t ata, VasEBoot_uint8_t cmd,
grub_uint8_t features, grub_uint8_t sectors) VasEBoot_uint8_t features, VasEBoot_uint8_t sectors)
{ {
if (! quiet && msg && *msg) if (! quiet && msg && *msg)
{ {
if (val >= 0) if (val >= 0)
grub_printf ("Set %s to %d", msg, val); VasEBoot_printf ("Set %s to %d", msg, val);
else else
grub_printf ("Disable %s", msg); VasEBoot_printf ("Disable %s", msg);
} }
grub_err_t err = grub_hdparm_do_ata_cmd (ata, cmd, features, sectors, VasEBoot_err_t err = VasEBoot_hdparm_do_ata_cmd (ata, cmd, features, sectors,
NULL, 0); NULL, 0);
if (! quiet && msg) if (! quiet && msg)
grub_printf ("%s\n", ! err ? "" : ": not supported"); VasEBoot_printf ("%s\n", ! err ? "" : ": not supported");
return err; return err;
} }
static const char * static const char *
le16_to_char (grub_uint16_t *dest, const grub_uint16_t * src16, unsigned bytes) le16_to_char (VasEBoot_uint16_t *dest, const VasEBoot_uint16_t * src16, unsigned bytes)
{ {
unsigned i; unsigned i;
for (i = 0; i < bytes / 2; i++) for (i = 0; i < bytes / 2; i++)
dest[i] = grub_swap_bytes16 (src16[i]); dest[i] = VasEBoot_swap_bytes16 (src16[i]);
dest[i] = 0; dest[i] = 0;
return (char *) dest; return (char *) dest;
} }
static void static void
grub_hdparm_print_identify (const grub_uint16_t * idw) VasEBoot_hdparm_print_identify (const VasEBoot_uint16_t * idw)
{ {
/* Print identity strings. */ /* Print identity strings. */
grub_uint16_t tmp[21]; VasEBoot_uint16_t tmp[21];
grub_printf ("Model: \"%.40s\"\n", le16_to_char (tmp, &idw[27], 40)); VasEBoot_printf ("Model: \"%.40s\"\n", le16_to_char (tmp, &idw[27], 40));
grub_printf ("Firmware: \"%.8s\"\n", le16_to_char (tmp, &idw[23], 8)); VasEBoot_printf ("Firmware: \"%.8s\"\n", le16_to_char (tmp, &idw[23], 8));
grub_printf ("Serial: \"%.20s\"\n", le16_to_char (tmp, &idw[10], 20)); VasEBoot_printf ("Serial: \"%.20s\"\n", le16_to_char (tmp, &idw[10], 20));
/* Print AAM, APM and SMART settings. */ /* Print AAM, APM and SMART settings. */
grub_uint16_t features1 = grub_le_to_cpu16 (idw[82]); VasEBoot_uint16_t features1 = VasEBoot_le_to_cpu16 (idw[82]);
grub_uint16_t features2 = grub_le_to_cpu16 (idw[83]); VasEBoot_uint16_t features2 = VasEBoot_le_to_cpu16 (idw[83]);
grub_uint16_t enabled1 = grub_le_to_cpu16 (idw[85]); VasEBoot_uint16_t enabled1 = VasEBoot_le_to_cpu16 (idw[85]);
grub_uint16_t enabled2 = grub_le_to_cpu16 (idw[86]); VasEBoot_uint16_t enabled2 = VasEBoot_le_to_cpu16 (idw[86]);
grub_printf ("Automatic Acoustic Management: "); VasEBoot_printf ("Automatic Acoustic Management: ");
if (features2 & 0x0200) if (features2 & 0x0200)
{ {
if (enabled2 & 0x0200) if (enabled2 & 0x0200)
{ {
grub_uint16_t aam = grub_le_to_cpu16 (idw[94]); VasEBoot_uint16_t aam = VasEBoot_le_to_cpu16 (idw[94]);
grub_printf ("%u (128=quiet, ..., 254=fast, recommended=%u)\n", VasEBoot_printf ("%u (128=quiet, ..., 254=fast, recommended=%u)\n",
aam & 0xff, (aam >> 8) & 0xff); aam & 0xff, (aam >> 8) & 0xff);
} }
else else
grub_printf ("disabled\n"); VasEBoot_printf ("disabled\n");
} }
else else
grub_printf ("not supported\n"); VasEBoot_printf ("not supported\n");
grub_printf ("Advanced Power Management: "); VasEBoot_printf ("Advanced Power Management: ");
if (features2 & 0x0008) if (features2 & 0x0008)
{ {
if (enabled2 & 0x0008) if (enabled2 & 0x0008)
grub_printf ("%u (1=low, ..., 254=high)\n", VasEBoot_printf ("%u (1=low, ..., 254=high)\n",
grub_le_to_cpu16 (idw[91]) & 0xff); VasEBoot_le_to_cpu16 (idw[91]) & 0xff);
else else
grub_printf ("disabled\n"); VasEBoot_printf ("disabled\n");
} }
else else
grub_printf ("not supported\n"); VasEBoot_printf ("not supported\n");
grub_printf ("SMART Feature Set: "); VasEBoot_printf ("SMART Feature Set: ");
if (features1 & 0x0001) if (features1 & 0x0001)
grub_printf ("%sabled\n", (enabled1 & 0x0001 ? "en" : "dis")); VasEBoot_printf ("%sabled\n", (enabled1 & 0x0001 ? "en" : "dis"));
else else
grub_printf ("not supported\n"); VasEBoot_printf ("not supported\n");
/* Print security settings. */ /* Print security settings. */
grub_uint16_t security = grub_le_to_cpu16 (idw[128]); VasEBoot_uint16_t security = VasEBoot_le_to_cpu16 (idw[128]);
grub_printf ("ATA Security: "); VasEBoot_printf ("ATA Security: ");
if (security & 0x0001) if (security & 0x0001)
grub_printf ("%s, %s, %s, %s\n", VasEBoot_printf ("%s, %s, %s, %s\n",
(security & 0x0002 ? "ENABLED" : "disabled"), (security & 0x0002 ? "ENABLED" : "disabled"),
(security & 0x0004 ? "**LOCKED**" : "not locked"), (security & 0x0004 ? "**LOCKED**" : "not locked"),
(security & 0x0008 ? "frozen" : "NOT FROZEN"), (security & 0x0008 ? "frozen" : "NOT FROZEN"),
(security & 0x0010 ? "COUNT EXPIRED" : "count not expired")); (security & 0x0010 ? "COUNT EXPIRED" : "count not expired"));
else else
grub_printf ("not supported\n"); VasEBoot_printf ("not supported\n");
} }
static void static void
grub_hdparm_print_standby_tout (int timeout) VasEBoot_hdparm_print_standby_tout (int timeout)
{ {
if (timeout == 0) if (timeout == 0)
grub_printf ("off"); VasEBoot_printf ("off");
else if (timeout <= 252 || timeout == 255) else if (timeout <= 252 || timeout == 255)
{ {
int h = 0, m = 0 , s = 0; int h = 0, m = 0 , s = 0;
@ -263,31 +263,31 @@ grub_hdparm_print_standby_tout (int timeout)
h = m / 60; h = m / 60;
m %= 60; m %= 60;
} }
grub_printf ("%02d:%02d:%02d", h, m, s); VasEBoot_printf ("%02d:%02d:%02d", h, m, s);
} }
else else
grub_printf ("invalid or vendor-specific"); VasEBoot_printf ("invalid or vendor-specific");
} }
static int get_int_arg (const struct grub_arg_list *state) static int get_int_arg (const struct VasEBoot_arg_list *state)
{ {
return (state->set ? (int)grub_strtoul (state->arg, 0, 0) : -1); return (state->set ? (int)VasEBoot_strtoul (state->arg, 0, 0) : -1);
} }
static grub_err_t static VasEBoot_err_t
grub_cmd_hdparm (grub_extcmd_context_t ctxt, int argc, char **args) VasEBoot_cmd_hdparm (VasEBoot_extcmd_context_t ctxt, int argc, char **args)
{ {
struct grub_arg_list *state = ctxt->state; struct VasEBoot_arg_list *state = ctxt->state;
struct grub_ata *ata; struct VasEBoot_ata *ata;
const char *diskname; const char *diskname;
/* Check command line. */ /* Check command line. */
if (argc != 1) if (argc != 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected")); return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, N_("one argument expected"));
if (args[0][0] == '(') if (args[0][0] == '(')
{ {
grub_size_t len = grub_strlen (args[0]); VasEBoot_size_t len = VasEBoot_strlen (args[0]);
if (args[0][len - 1] == ')') if (args[0][len - 1] == ')')
args[0][len - 1] = 0; args[0][len - 1] = 0;
diskname = &args[0][1]; diskname = &args[0][1];
@ -310,41 +310,41 @@ grub_cmd_hdparm (grub_extcmd_context_t ctxt, int argc, char **args)
quiet = state[i++].set; quiet = state[i++].set;
/* Open disk. */ /* Open disk. */
grub_disk_t disk = grub_disk_open (diskname); VasEBoot_disk_t disk = VasEBoot_disk_open (diskname);
if (! disk) if (! disk)
return grub_errno; return VasEBoot_errno;
switch (disk->dev->id) switch (disk->dev->id)
{ {
case GRUB_DISK_DEVICE_ATA_ID: case VasEBoot_DISK_DEVICE_ATA_ID:
ata = disk->data; ata = disk->data;
break; break;
case GRUB_DISK_DEVICE_SCSI_ID: case VasEBoot_DISK_DEVICE_SCSI_ID:
if (((disk->id >> GRUB_SCSI_ID_SUBSYSTEM_SHIFT) & 0xFF) if (((disk->id >> VasEBoot_SCSI_ID_SUBSYSTEM_SHIFT) & 0xFF)
== GRUB_SCSI_SUBSYSTEM_PATA == VasEBoot_SCSI_SUBSYSTEM_PATA
|| (((disk->id >> GRUB_SCSI_ID_SUBSYSTEM_SHIFT) & 0xFF) || (((disk->id >> VasEBoot_SCSI_ID_SUBSYSTEM_SHIFT) & 0xFF)
== GRUB_SCSI_SUBSYSTEM_AHCI)) == VasEBoot_SCSI_SUBSYSTEM_AHCI))
{ {
ata = ((struct grub_scsi *) disk->data)->data; ata = ((struct VasEBoot_scsi *) disk->data)->data;
break; break;
} }
/* FALLTHROUGH */ /* FALLTHROUGH */
default: default:
grub_disk_close (disk); VasEBoot_disk_close (disk);
return grub_error (GRUB_ERR_IO, "not an ATA device"); return VasEBoot_error (VasEBoot_ERR_IO, "not an ATA device");
} }
/* Change settings. */ /* Change settings. */
if (aam >= 0) if (aam >= 0)
grub_hdparm_set_val_cmd ("Automatic Acoustic Management", (aam ? aam : -1), VasEBoot_hdparm_set_val_cmd ("Automatic Acoustic Management", (aam ? aam : -1),
ata, GRUB_ATA_CMD_SET_FEATURES, ata, VasEBoot_ATA_CMD_SET_FEATURES,
(aam ? 0x42 : 0xc2), aam); (aam ? 0x42 : 0xc2), aam);
if (apm >= 0) if (apm >= 0)
grub_hdparm_set_val_cmd ("Advanced Power Management", VasEBoot_hdparm_set_val_cmd ("Advanced Power Management",
(apm != 255 ? apm : -1), ata, (apm != 255 ? apm : -1), ata,
GRUB_ATA_CMD_SET_FEATURES, VasEBoot_ATA_CMD_SET_FEATURES,
(apm != 255 ? 0x05 : 0x85), (apm != 255 ? 0x05 : 0x85),
(apm != 255 ? apm : 0)); (apm != 255 ? apm : 0));
@ -352,39 +352,39 @@ grub_cmd_hdparm (grub_extcmd_context_t ctxt, int argc, char **args)
{ {
if (! quiet) if (! quiet)
{ {
grub_printf ("Set standby timeout to %d (", standby_tout); VasEBoot_printf ("Set standby timeout to %d (", standby_tout);
grub_hdparm_print_standby_tout (standby_tout); VasEBoot_hdparm_print_standby_tout (standby_tout);
grub_printf (")"); VasEBoot_printf (")");
} }
/* The IDLE cmd sets disk to idle mode and configures standby timer. */ /* The IDLE cmd sets disk to idle mode and configures standby timer. */
grub_hdparm_set_val_cmd ("", -1, ata, GRUB_ATA_CMD_IDLE, 0, standby_tout); VasEBoot_hdparm_set_val_cmd ("", -1, ata, VasEBoot_ATA_CMD_IDLE, 0, standby_tout);
} }
if (enable_smart >= 0) if (enable_smart >= 0)
{ {
if (! quiet) if (! quiet)
grub_printf ("%sable SMART operations", (enable_smart ? "En" : "Dis")); VasEBoot_printf ("%sable SMART operations", (enable_smart ? "En" : "Dis"));
int err = grub_hdparm_do_smart_cmd (ata, (enable_smart ? int err = VasEBoot_hdparm_do_smart_cmd (ata, (enable_smart ?
GRUB_ATA_FEAT_SMART_ENABLE : GRUB_ATA_FEAT_SMART_DISABLE)); VasEBoot_ATA_FEAT_SMART_ENABLE : VasEBoot_ATA_FEAT_SMART_DISABLE));
if (! quiet) if (! quiet)
grub_printf ("%s\n", err ? ": not supported" : ""); VasEBoot_printf ("%s\n", err ? ": not supported" : "");
} }
if (sec_freeze) if (sec_freeze)
grub_hdparm_simple_cmd ("Freeze security settings", ata, VasEBoot_hdparm_simple_cmd ("Freeze security settings", ata,
GRUB_ATA_CMD_SECURITY_FREEZE_LOCK); VasEBoot_ATA_CMD_SECURITY_FREEZE_LOCK);
/* Print/dump IDENTIFY. */ /* Print/dump IDENTIFY. */
if (ident || dumpid) if (ident || dumpid)
{ {
grub_uint16_t buf[GRUB_DISK_SECTOR_SIZE / 2]; VasEBoot_uint16_t buf[VasEBoot_DISK_SECTOR_SIZE / 2];
if (grub_hdparm_do_ata_cmd (ata, GRUB_ATA_CMD_IDENTIFY_DEVICE, if (VasEBoot_hdparm_do_ata_cmd (ata, VasEBoot_ATA_CMD_IDENTIFY_DEVICE,
0, 0, buf, sizeof (buf))) 0, 0, buf, sizeof (buf)))
grub_printf ("Cannot read ATA IDENTIFY data\n"); VasEBoot_printf ("Cannot read ATA IDENTIFY data\n");
else else
{ {
if (ident) if (ident)
grub_hdparm_print_identify (buf); VasEBoot_hdparm_print_identify (buf);
if (dumpid) if (dumpid)
hexdump (0, (char *) buf, sizeof (buf)); hexdump (0, (char *) buf, sizeof (buf));
} }
@ -393,12 +393,12 @@ grub_cmd_hdparm (grub_extcmd_context_t ctxt, int argc, char **args)
/* Check power mode. */ /* Check power mode. */
if (power) if (power)
{ {
grub_printf ("Disk power mode is: "); VasEBoot_printf ("Disk power mode is: ");
int mode = grub_hdparm_do_check_powermode_cmd (ata); int mode = VasEBoot_hdparm_do_check_powermode_cmd (ata);
if (mode < 0) if (mode < 0)
grub_printf ("unknown\n"); VasEBoot_printf ("unknown\n");
else else
grub_printf ("%s (0x%02x)\n", VasEBoot_printf ("%s (0x%02x)\n",
(mode == 0xff ? "active/idle" : (mode == 0xff ? "active/idle" :
mode == 0x80 ? "idle" : mode == 0x80 ? "idle" :
mode == 0x00 ? "standby" : "unknown"), mode); mode == 0x00 ? "standby" : "unknown"), mode);
@ -409,39 +409,39 @@ grub_cmd_hdparm (grub_extcmd_context_t ctxt, int argc, char **args)
if (health) if (health)
{ {
if (! quiet) if (! quiet)
grub_printf ("SMART status is: "); VasEBoot_printf ("SMART status is: ");
int err = grub_hdparm_do_smart_cmd (ata, GRUB_ATA_FEAT_SMART_STATUS); int err = VasEBoot_hdparm_do_smart_cmd (ata, VasEBoot_ATA_FEAT_SMART_STATUS);
if (! quiet) if (! quiet)
grub_printf ("%s\n", (err < 0 ? "unknown" : VasEBoot_printf ("%s\n", (err < 0 ? "unknown" :
err == 0 ? "OK" : "*BAD*")); err == 0 ? "OK" : "*BAD*"));
status = (err > 0); status = (err > 0);
} }
/* Change power mode. */ /* Change power mode. */
if (standby_now) if (standby_now)
grub_hdparm_simple_cmd ("Set disk to standby mode", ata, VasEBoot_hdparm_simple_cmd ("Set disk to standby mode", ata,
GRUB_ATA_CMD_STANDBY_IMMEDIATE); VasEBoot_ATA_CMD_STANDBY_IMMEDIATE);
if (sleep_now) if (sleep_now)
grub_hdparm_simple_cmd ("Set disk to sleep mode", ata, VasEBoot_hdparm_simple_cmd ("Set disk to sleep mode", ata,
GRUB_ATA_CMD_SLEEP); VasEBoot_ATA_CMD_SLEEP);
grub_disk_close (disk); VasEBoot_disk_close (disk);
grub_errno = GRUB_ERR_NONE; VasEBoot_errno = VasEBoot_ERR_NONE;
return status; return status;
} }
static grub_extcmd_t cmd; static VasEBoot_extcmd_t cmd;
GRUB_MOD_INIT(hdparm) VasEBoot_MOD_INIT(hdparm)
{ {
cmd = grub_register_extcmd ("hdparm", grub_cmd_hdparm, 0, cmd = VasEBoot_register_extcmd ("hdparm", VasEBoot_cmd_hdparm, 0,
N_("[OPTIONS] DISK"), N_("[OPTIONS] DISK"),
N_("Get/set ATA disk parameters."), options); N_("Get/set ATA disk parameters."), options);
} }
GRUB_MOD_FINI(hdparm) VasEBoot_MOD_FINI(hdparm)
{ {
grub_unregister_extcmd (cmd); VasEBoot_unregister_extcmd (cmd);
} }

View File

@ -1,35 +1,35 @@
/* help.c - command to show a help text. */ /* help.c - command to show a help text. */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2005,2007,2008,2009 Free Software Foundation, Inc. * Copyright (C) 2005,2007,2008,2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/term.h> #include <VasEBoot/term.h>
#include <grub/extcmd.h> #include <VasEBoot/extcmd.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
#include <grub/mm.h> #include <VasEBoot/mm.h>
#include <grub/normal.h> #include <VasEBoot/normal.h>
#include <grub/charset.h> #include <VasEBoot/charset.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static grub_err_t static VasEBoot_err_t
grub_cmd_help (grub_extcmd_context_t ctxt __attribute__ ((unused)), int argc, VasEBoot_cmd_help (VasEBoot_extcmd_context_t ctxt __attribute__ ((unused)), int argc,
char **args) char **args)
{ {
int cnt = 0; int cnt = 0;
@ -37,69 +37,69 @@ grub_cmd_help (grub_extcmd_context_t ctxt __attribute__ ((unused)), int argc,
if (argc == 0) if (argc == 0)
{ {
grub_command_t cmd; VasEBoot_command_t cmd;
FOR_COMMANDS(cmd) FOR_COMMANDS(cmd)
{ {
if ((cmd->prio & GRUB_COMMAND_FLAG_ACTIVE)) if ((cmd->prio & VasEBoot_COMMAND_FLAG_ACTIVE))
{ {
struct grub_term_output *term; struct VasEBoot_term_output *term;
const char *summary_translated = _(cmd->summary); const char *summary_translated = _(cmd->summary);
char *command_help; char *command_help;
grub_uint32_t *unicode_command_help; VasEBoot_uint32_t *unicode_command_help;
grub_uint32_t *unicode_last_position; VasEBoot_uint32_t *unicode_last_position;
command_help = grub_xasprintf ("%s %s", cmd->name, summary_translated); command_help = VasEBoot_xasprintf ("%s %s", cmd->name, summary_translated);
if (!command_help) if (!command_help)
break; break;
grub_utf8_to_ucs4_alloc (command_help, &unicode_command_help, VasEBoot_utf8_to_ucs4_alloc (command_help, &unicode_command_help,
&unicode_last_position); &unicode_last_position);
FOR_ACTIVE_TERM_OUTPUTS(term) FOR_ACTIVE_TERM_OUTPUTS(term)
{ {
unsigned stringwidth; unsigned stringwidth;
grub_uint32_t *unicode_last_screen_position; VasEBoot_uint32_t *unicode_last_screen_position;
unicode_last_screen_position = unicode_command_help; unicode_last_screen_position = unicode_command_help;
stringwidth = 0; stringwidth = 0;
while (unicode_last_screen_position < unicode_last_position && while (unicode_last_screen_position < unicode_last_position &&
stringwidth < ((grub_term_width (term) / 2) - 2)) stringwidth < ((VasEBoot_term_width (term) / 2) - 2))
{ {
struct grub_unicode_glyph glyph; struct VasEBoot_unicode_glyph glyph;
unicode_last_screen_position unicode_last_screen_position
+= grub_unicode_aglomerate_comb (unicode_last_screen_position, += VasEBoot_unicode_aglomerate_comb (unicode_last_screen_position,
unicode_last_position unicode_last_position
- unicode_last_screen_position, - unicode_last_screen_position,
&glyph); &glyph);
stringwidth stringwidth
+= grub_term_getcharwidth (term, &glyph); += VasEBoot_term_getcharwidth (term, &glyph);
} }
grub_print_ucs4 (unicode_command_help, VasEBoot_print_ucs4 (unicode_command_help,
unicode_last_screen_position, 0, 0, term); unicode_last_screen_position, 0, 0, term);
if (!(cnt % 2)) if (!(cnt % 2))
grub_print_spaces (term, grub_term_width (term) / 2 VasEBoot_print_spaces (term, VasEBoot_term_width (term) / 2
- stringwidth); - stringwidth);
} }
if (cnt % 2) if (cnt % 2)
grub_printf ("\n"); VasEBoot_printf ("\n");
cnt++; cnt++;
grub_free (command_help); VasEBoot_free (command_help);
grub_free (unicode_command_help); VasEBoot_free (unicode_command_help);
} }
} }
if (!(cnt % 2)) if (!(cnt % 2))
grub_printf ("\n"); VasEBoot_printf ("\n");
} }
else else
{ {
int i; int i;
grub_command_t cmd_iter, cmd, cmd_next; VasEBoot_command_t cmd_iter, cmd, cmd_next;
for (i = 0; i < argc; i++) for (i = 0; i < argc; i++)
{ {
@ -107,29 +107,29 @@ grub_cmd_help (grub_extcmd_context_t ctxt __attribute__ ((unused)), int argc,
FOR_COMMANDS_SAFE (cmd_iter, cmd_next) FOR_COMMANDS_SAFE (cmd_iter, cmd_next)
{ {
if (!(cmd_iter->prio & GRUB_COMMAND_FLAG_ACTIVE)) if (!(cmd_iter->prio & VasEBoot_COMMAND_FLAG_ACTIVE))
continue; continue;
if (grub_strncmp (cmd_iter->name, currarg, if (VasEBoot_strncmp (cmd_iter->name, currarg,
grub_strlen (currarg)) != 0) VasEBoot_strlen (currarg)) != 0)
continue; continue;
if (cmd_iter->flags & GRUB_COMMAND_FLAG_DYNCMD) if (cmd_iter->flags & VasEBoot_COMMAND_FLAG_DYNCMD)
cmd = grub_dyncmd_get_cmd (cmd_iter); cmd = VasEBoot_dyncmd_get_cmd (cmd_iter);
else else
cmd = cmd_iter; cmd = cmd_iter;
if (!cmd) if (!cmd)
{ {
grub_print_error (); VasEBoot_print_error ();
continue; continue;
} }
if (cnt++ > 0) if (cnt++ > 0)
grub_printf ("\n\n"); VasEBoot_printf ("\n\n");
if ((cmd->flags & GRUB_COMMAND_FLAG_EXTCMD) && if ((cmd->flags & VasEBoot_COMMAND_FLAG_EXTCMD) &&
! (cmd->flags & GRUB_COMMAND_FLAG_DYNCMD)) ! (cmd->flags & VasEBoot_COMMAND_FLAG_DYNCMD))
grub_arg_show_help ((grub_extcmd_t) cmd->data); VasEBoot_arg_show_help ((VasEBoot_extcmd_t) cmd->data);
else else
grub_printf ("%s %s %s\n%s\n", _("Usage:"), cmd->name, VasEBoot_printf ("%s %s %s\n%s\n", _("Usage:"), cmd->name,
_(cmd->summary), _(cmd->description)); _(cmd->summary), _(cmd->description));
} }
} }
@ -138,16 +138,16 @@ grub_cmd_help (grub_extcmd_context_t ctxt __attribute__ ((unused)), int argc,
return 0; return 0;
} }
static grub_extcmd_t cmd; static VasEBoot_extcmd_t cmd;
GRUB_MOD_INIT(help) VasEBoot_MOD_INIT(help)
{ {
cmd = grub_register_extcmd ("help", grub_cmd_help, 0, cmd = VasEBoot_register_extcmd ("help", VasEBoot_cmd_help, 0,
N_("[PATTERN ...]"), N_("[PATTERN ...]"),
N_("Show a help message."), 0); N_("Show a help message."), 0);
} }
GRUB_MOD_FINI(help) VasEBoot_MOD_FINI(help)
{ {
grub_unregister_extcmd (cmd); VasEBoot_unregister_extcmd (cmd);
} }

View File

@ -1,79 +1,79 @@
/* hexdump.c - command to dump the contents of a file or memory */ /* hexdump.c - command to dump the contents of a file or memory */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2007,2008,2009 Free Software Foundation, Inc. * Copyright (C) 2007,2008,2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/file.h> #include <VasEBoot/file.h>
#include <grub/disk.h> #include <VasEBoot/disk.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/lib/hexdump.h> #include <VasEBoot/lib/hexdump.h>
#include <grub/extcmd.h> #include <VasEBoot/extcmd.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static const struct grub_arg_option options[] = { static const struct VasEBoot_arg_option options[] = {
{"skip", 's', 0, N_("Skip offset bytes from the beginning of file."), 0, {"skip", 's', 0, N_("Skip offset bytes from the beginning of file."), 0,
ARG_TYPE_INT}, ARG_TYPE_INT},
{"length", 'n', 0, N_("Read only LENGTH bytes."), 0, ARG_TYPE_INT}, {"length", 'n', 0, N_("Read only LENGTH bytes."), 0, ARG_TYPE_INT},
{0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0}
}; };
static grub_err_t static VasEBoot_err_t
grub_cmd_hexdump (grub_extcmd_context_t ctxt, int argc, char **args) VasEBoot_cmd_hexdump (VasEBoot_extcmd_context_t ctxt, int argc, char **args)
{ {
struct grub_arg_list *state = ctxt->state; struct VasEBoot_arg_list *state = ctxt->state;
char buf[GRUB_DISK_SECTOR_SIZE * 4]; char buf[VasEBoot_DISK_SECTOR_SIZE * 4];
grub_ssize_t size, length; VasEBoot_ssize_t size, length;
grub_disk_addr_t skip; VasEBoot_disk_addr_t skip;
int namelen; int namelen;
if (argc != 1) if (argc != 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("filename expected")); return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, N_("filename expected"));
namelen = grub_strlen (args[0]); namelen = VasEBoot_strlen (args[0]);
skip = (state[0].set) ? grub_strtoull (state[0].arg, 0, 0) : 0; skip = (state[0].set) ? VasEBoot_strtoull (state[0].arg, 0, 0) : 0;
length = (state[1].set) ? grub_strtoul (state[1].arg, 0, 0) : 256; length = (state[1].set) ? VasEBoot_strtoul (state[1].arg, 0, 0) : 256;
if (!grub_strcmp (args[0], "(mem)")) if (!VasEBoot_strcmp (args[0], "(mem)"))
hexdump (skip, (char *) (grub_addr_t) skip, length); hexdump (skip, (char *) (VasEBoot_addr_t) skip, length);
else if ((args[0][0] == '(') && (args[0][namelen - 1] == ')')) else if ((args[0][0] == '(') && (args[0][namelen - 1] == ')'))
{ {
grub_disk_t disk; VasEBoot_disk_t disk;
grub_disk_addr_t sector; VasEBoot_disk_addr_t sector;
grub_size_t ofs; VasEBoot_size_t ofs;
args[0][namelen - 1] = 0; args[0][namelen - 1] = 0;
disk = grub_disk_open (&args[0][1]); disk = VasEBoot_disk_open (&args[0][1]);
if (! disk) if (! disk)
return 0; return 0;
sector = (skip >> (GRUB_DISK_SECTOR_BITS + 2)) * 4; sector = (skip >> (VasEBoot_DISK_SECTOR_BITS + 2)) * 4;
ofs = skip & (GRUB_DISK_SECTOR_SIZE * 4 - 1); ofs = skip & (VasEBoot_DISK_SECTOR_SIZE * 4 - 1);
while (length) while (length)
{ {
grub_size_t len; VasEBoot_size_t len;
len = length; len = length;
if (len > sizeof (buf)) if (len > sizeof (buf))
len = sizeof (buf); len = sizeof (buf);
if (grub_disk_read (disk, sector, ofs, len, buf)) if (VasEBoot_disk_read (disk, sector, ofs, len, buf))
break; break;
hexdump (skip, buf, len); hexdump (skip, buf, len);
@ -84,19 +84,19 @@ grub_cmd_hexdump (grub_extcmd_context_t ctxt, int argc, char **args)
sector += 4; sector += 4;
} }
grub_disk_close (disk); VasEBoot_disk_close (disk);
} }
else else
{ {
grub_file_t file; VasEBoot_file_t file;
file = grub_file_open (args[0]); file = VasEBoot_file_open (args[0]);
if (! file) if (! file)
return 0; return 0;
file->offset = skip; file->offset = skip;
while ((size = grub_file_read (file, buf, sizeof (buf))) > 0) while ((size = VasEBoot_file_read (file, buf, sizeof (buf))) > 0)
{ {
unsigned long len; unsigned long len;
@ -111,23 +111,23 @@ grub_cmd_hexdump (grub_extcmd_context_t ctxt, int argc, char **args)
} }
} }
grub_file_close (file); VasEBoot_file_close (file);
} }
return 0; return 0;
} }
static grub_extcmd_t cmd; static VasEBoot_extcmd_t cmd;
GRUB_MOD_INIT (hexdump) VasEBoot_MOD_INIT (hexdump)
{ {
cmd = grub_register_extcmd ("hexdump", grub_cmd_hexdump, 0, cmd = VasEBoot_register_extcmd ("hexdump", VasEBoot_cmd_hexdump, 0,
N_("[OPTIONS] FILE_OR_DEVICE"), N_("[OPTIONS] FILE_OR_DEVICE"),
N_("Show raw contents of a file or memory."), N_("Show raw contents of a file or memory."),
options); options);
} }
GRUB_MOD_FINI (hexdump) VasEBoot_MOD_FINI (hexdump)
{ {
grub_unregister_extcmd (cmd); VasEBoot_unregister_extcmd (cmd);
} }

View File

@ -1,64 +1,64 @@
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2009,2013 Free Software Foundation, Inc. * Copyright (C) 2009,2013 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/command.h> #include <VasEBoot/command.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/cmos.h> #include <VasEBoot/cmos.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static grub_err_t static VasEBoot_err_t
grub_cmd_cmosdump (struct grub_command *cmd __attribute__ ((unused)), VasEBoot_cmd_cmosdump (struct VasEBoot_command *cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)), char *argv[] __attribute__ ((unused))) int argc __attribute__ ((unused)), char *argv[] __attribute__ ((unused)))
{ {
int i; int i;
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
{ {
grub_err_t err; VasEBoot_err_t err;
grub_uint8_t value; VasEBoot_uint8_t value;
if ((i & 0xf) == 0) if ((i & 0xf) == 0)
grub_printf ("%02x: ", i); VasEBoot_printf ("%02x: ", i);
err = grub_cmos_read (i, &value); err = VasEBoot_cmos_read (i, &value);
if (err) if (err)
return err; return err;
grub_printf ("%02x ", value); VasEBoot_printf ("%02x ", value);
if ((i & 0xf) == 0xf) if ((i & 0xf) == 0xf)
grub_printf ("\n"); VasEBoot_printf ("\n");
} }
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
} }
static grub_command_t cmd; static VasEBoot_command_t cmd;
GRUB_MOD_INIT(cmosdump) VasEBoot_MOD_INIT(cmosdump)
{ {
cmd = grub_register_command ("cmosdump", grub_cmd_cmosdump, cmd = VasEBoot_register_command ("cmosdump", VasEBoot_cmd_cmosdump,
0, 0,
N_("Show raw dump of the CMOS contents.")); N_("Show raw dump of the CMOS contents."));
} }
GRUB_MOD_FINI(cmosdump) VasEBoot_MOD_FINI(cmosdump)
{ {
grub_unregister_command (cmd); VasEBoot_unregister_command (cmd);
} }

View File

@ -1,124 +1,124 @@
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc. * Copyright (C) 2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/command.h> #include <VasEBoot/command.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/cmos.h> #include <VasEBoot/cmos.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static grub_err_t static VasEBoot_err_t
parse_args (int argc, char *argv[], int *byte, int *bit) parse_args (int argc, char *argv[], int *byte, int *bit)
{ {
char *rest; char *rest;
if (argc != 1) if (argc != 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "address required"); return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, "address required");
*byte = grub_strtoul (argv[0], &rest, 0); *byte = VasEBoot_strtoul (argv[0], &rest, 0);
if (*rest != ':') if (*rest != ':')
return grub_error (GRUB_ERR_BAD_ARGUMENT, "address required"); return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, "address required");
*bit = grub_strtoul (rest + 1, 0, 0); *bit = VasEBoot_strtoul (rest + 1, 0, 0);
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
} }
static grub_err_t static VasEBoot_err_t
grub_cmd_cmostest (struct grub_command *cmd __attribute__ ((unused)), VasEBoot_cmd_cmostest (struct VasEBoot_command *cmd __attribute__ ((unused)),
int argc, char *argv[]) int argc, char *argv[])
{ {
int byte = 0, bit = 0; int byte = 0, bit = 0;
grub_err_t err; VasEBoot_err_t err;
grub_uint8_t value; VasEBoot_uint8_t value;
err = parse_args (argc, argv, &byte, &bit); err = parse_args (argc, argv, &byte, &bit);
if (err) if (err)
return err; return err;
err = grub_cmos_read (byte, &value); err = VasEBoot_cmos_read (byte, &value);
if (err) if (err)
return err; return err;
if (value & (1 << bit)) if (value & (1 << bit))
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
return grub_error (GRUB_ERR_TEST_FAILURE, N_("false")); return VasEBoot_error (VasEBoot_ERR_TEST_FAILURE, N_("false"));
} }
static grub_err_t static VasEBoot_err_t
grub_cmd_cmosclean (struct grub_command *cmd __attribute__ ((unused)), VasEBoot_cmd_cmosclean (struct VasEBoot_command *cmd __attribute__ ((unused)),
int argc, char *argv[]) int argc, char *argv[])
{ {
int byte = 0, bit = 0; int byte = 0, bit = 0;
grub_err_t err; VasEBoot_err_t err;
grub_uint8_t value; VasEBoot_uint8_t value;
err = parse_args (argc, argv, &byte, &bit); err = parse_args (argc, argv, &byte, &bit);
if (err) if (err)
return err; return err;
err = grub_cmos_read (byte, &value); err = VasEBoot_cmos_read (byte, &value);
if (err) if (err)
return err; return err;
return grub_cmos_write (byte, value & (~(1 << bit))); return VasEBoot_cmos_write (byte, value & (~(1 << bit)));
} }
static grub_err_t static VasEBoot_err_t
grub_cmd_cmosset (struct grub_command *cmd __attribute__ ((unused)), VasEBoot_cmd_cmosset (struct VasEBoot_command *cmd __attribute__ ((unused)),
int argc, char *argv[]) int argc, char *argv[])
{ {
int byte = 0, bit = 0; int byte = 0, bit = 0;
grub_err_t err; VasEBoot_err_t err;
grub_uint8_t value; VasEBoot_uint8_t value;
err = parse_args (argc, argv, &byte, &bit); err = parse_args (argc, argv, &byte, &bit);
if (err) if (err)
return err; return err;
err = grub_cmos_read (byte, &value); err = VasEBoot_cmos_read (byte, &value);
if (err) if (err)
return err; return err;
return grub_cmos_write (byte, value | (1 << bit)); return VasEBoot_cmos_write (byte, value | (1 << bit));
} }
static grub_command_t cmd, cmd_clean, cmd_set; static VasEBoot_command_t cmd, cmd_clean, cmd_set;
GRUB_MOD_INIT(cmostest) VasEBoot_MOD_INIT(cmostest)
{ {
cmd = grub_register_command ("cmostest", grub_cmd_cmostest, cmd = VasEBoot_register_command ("cmostest", VasEBoot_cmd_cmostest,
N_("BYTE:BIT"), N_("BYTE:BIT"),
N_("Test bit at BYTE:BIT in CMOS.")); N_("Test bit at BYTE:BIT in CMOS."));
cmd_clean = grub_register_command ("cmosclean", grub_cmd_cmosclean, cmd_clean = VasEBoot_register_command ("cmosclean", VasEBoot_cmd_cmosclean,
N_("BYTE:BIT"), N_("BYTE:BIT"),
N_("Clear bit at BYTE:BIT in CMOS.")); N_("Clear bit at BYTE:BIT in CMOS."));
cmd_set = grub_register_command ("cmosset", grub_cmd_cmosset, cmd_set = VasEBoot_register_command ("cmosset", VasEBoot_cmd_cmosset,
N_("BYTE:BIT"), N_("BYTE:BIT"),
/* TRANSLATORS: A bit may be either set (1) or clear (0). */ /* TRANSLATORS: A bit may be either set (1) or clear (0). */
N_("Set bit at BYTE:BIT in CMOS.")); N_("Set bit at BYTE:BIT in CMOS."));
} }
GRUB_MOD_FINI(cmostest) VasEBoot_MOD_FINI(cmostest)
{ {
grub_unregister_command (cmd); VasEBoot_unregister_command (cmd);
grub_unregister_command (cmd_clean); VasEBoot_unregister_command (cmd_clean);
grub_unregister_command (cmd_set); VasEBoot_unregister_command (cmd_set);
} }

View File

@ -1,37 +1,37 @@
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2013 Free Software Foundation, Inc. * Copyright (C) 2013 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/command.h> #include <VasEBoot/command.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
#include <grub/i386/coreboot/lbio.h> #include <VasEBoot/i386/coreboot/lbio.h>
#include <grub/i386/tsc.h> #include <VasEBoot/i386/tsc.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static grub_uint32_t static VasEBoot_uint32_t
tsc2ms (grub_uint64_t tsc) tsc2ms (VasEBoot_uint64_t tsc)
{ {
grub_uint64_t ah = tsc >> 32; VasEBoot_uint64_t ah = tsc >> 32;
grub_uint64_t al = tsc & 0xffffffff; VasEBoot_uint64_t al = tsc & 0xffffffff;
return ((al * grub_tsc_rate) >> 32) + ah * grub_tsc_rate; return ((al * VasEBoot_tsc_rate) >> 32) + ah * VasEBoot_tsc_rate;
} }
static const char *descs[] = { static const char *descs[] = {
@ -63,28 +63,28 @@ static const char *descs[] = {
}; };
static int static int
iterate_linuxbios_table (grub_linuxbios_table_item_t table_item, iterate_linuxbios_table (VasEBoot_linuxbios_table_item_t table_item,
void *data) void *data)
{ {
int *available = data; int *available = data;
grub_uint64_t last_tsc = 0; VasEBoot_uint64_t last_tsc = 0;
struct grub_linuxbios_timestamp_table *ts_table; struct VasEBoot_linuxbios_timestamp_table *ts_table;
unsigned i; unsigned i;
if (table_item->tag != GRUB_LINUXBIOS_MEMBER_TIMESTAMPS) if (table_item->tag != VasEBoot_LINUXBIOS_MEMBER_TIMESTAMPS)
return 0; return 0;
*available = 1; *available = 1;
ts_table = (struct grub_linuxbios_timestamp_table *) (grub_addr_t) ts_table = (struct VasEBoot_linuxbios_timestamp_table *) (VasEBoot_addr_t)
*(grub_uint64_t *) (table_item + 1); *(VasEBoot_uint64_t *) (table_item + 1);
for (i = 0; i < ts_table->used; i++) for (i = 0; i < ts_table->used; i++)
{ {
grub_uint32_t tmabs = tsc2ms (ts_table->entries[i].tsc); VasEBoot_uint32_t tmabs = tsc2ms (ts_table->entries[i].tsc);
grub_uint32_t tmrel = tsc2ms (ts_table->entries[i].tsc - last_tsc); VasEBoot_uint32_t tmrel = tsc2ms (ts_table->entries[i].tsc - last_tsc);
last_tsc = ts_table->entries[i].tsc; last_tsc = ts_table->entries[i].tsc;
grub_printf ("%3d.%03ds %2d.%03ds %02d %s\n", VasEBoot_printf ("%3d.%03ds %2d.%03ds %02d %s\n",
tmabs / 1000, tmabs % 1000, tmrel / 1000, tmrel % 1000, tmabs / 1000, tmabs % 1000, tmrel / 1000, tmrel % 1000,
ts_table->entries[i].id, ts_table->entries[i].id,
(ts_table->entries[i].id < ARRAY_SIZE (descs) (ts_table->entries[i].id < ARRAY_SIZE (descs)
@ -95,32 +95,32 @@ iterate_linuxbios_table (grub_linuxbios_table_item_t table_item,
} }
static grub_err_t static VasEBoot_err_t
grub_cmd_coreboot_boottime (struct grub_command *cmd __attribute__ ((unused)), VasEBoot_cmd_coreboot_boottime (struct VasEBoot_command *cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)), int argc __attribute__ ((unused)),
char *argv[] __attribute__ ((unused))) char *argv[] __attribute__ ((unused)))
{ {
int available = 0; int available = 0;
grub_linuxbios_table_iterate (iterate_linuxbios_table, &available); VasEBoot_linuxbios_table_iterate (iterate_linuxbios_table, &available);
if (!available) if (!available)
{ {
grub_puts_ (N_("No boot time statistics is available\n")); VasEBoot_puts_ (N_("No boot time statistics is available\n"));
return 0; return 0;
} }
return 0; return 0;
} }
static grub_command_t cmd_boottime; static VasEBoot_command_t cmd_boottime;
GRUB_MOD_INIT(cbtime) VasEBoot_MOD_INIT(cbtime)
{ {
cmd_boottime = cmd_boottime =
grub_register_command ("coreboot_boottime", grub_cmd_coreboot_boottime, VasEBoot_register_command ("coreboot_boottime", VasEBoot_cmd_coreboot_boottime,
0, N_("Show coreboot boot time statistics.")); 0, N_("Show coreboot boot time statistics."));
} }
GRUB_MOD_FINI(cbtime) VasEBoot_MOD_FINI(cbtime)
{ {
grub_unregister_command (cmd_boottime); VasEBoot_unregister_command (cmd_boottime);
} }

View File

@ -1,29 +1,29 @@
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2013 Free Software Foundation, Inc. * Copyright (C) 2013 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/command.h> #include <VasEBoot/command.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
#include <grub/i386/coreboot/lbio.h> #include <VasEBoot/i386/coreboot/lbio.h>
#include <grub/i386/tsc.h> #include <VasEBoot/i386/tsc.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static const char *console_descs[] = { static const char *console_descs[] = {
"8250 UART", "8250 UART",
@ -36,8 +36,8 @@ static const char *console_descs[] = {
}; };
static const char *descs[] = { static const char *descs[] = {
[GRUB_LINUXBIOS_MEMBER_MEMORY] = "memory map (`lsmmap' to list)", [VasEBoot_LINUXBIOS_MEMBER_MEMORY] = "memory map (`lsmmap' to list)",
[GRUB_LINUXBIOS_MEMBER_MAINBOARD] = "mainboard", [VasEBoot_LINUXBIOS_MEMBER_MAINBOARD] = "mainboard",
[4] = "version", [4] = "version",
[5] = "extra version", [5] = "extra version",
[6] = "build", [6] = "build",
@ -49,12 +49,12 @@ static const char *descs[] = {
[0xc] = "linker", [0xc] = "linker",
[0xd] = "assembler", [0xd] = "assembler",
[0xf] = "serial", [0xf] = "serial",
[GRUB_LINUXBIOS_MEMBER_CONSOLE] = "console", [VasEBoot_LINUXBIOS_MEMBER_CONSOLE] = "console",
[GRUB_LINUXBIOS_MEMBER_FRAMEBUFFER] = "framebuffer", [VasEBoot_LINUXBIOS_MEMBER_FRAMEBUFFER] = "framebuffer",
[0x13] = "GPIO", [0x13] = "GPIO",
[0x15] = "VDAT", [0x15] = "VDAT",
[GRUB_LINUXBIOS_MEMBER_TIMESTAMPS] = "timestamps (`coreboot_boottime' to list)", [VasEBoot_LINUXBIOS_MEMBER_TIMESTAMPS] = "timestamps (`coreboot_boottime' to list)",
[GRUB_LINUXBIOS_MEMBER_CBMEMC] = "CBMEM console (`cbmemc' to list)", [VasEBoot_LINUXBIOS_MEMBER_CBMEMC] = "CBMEM console (`cbmemc' to list)",
[0x18] = "MRC cache", [0x18] = "MRC cache",
[0x19] = "VBNV", [0x19] = "VBNV",
[0xc8] = "CMOS option table", [0xc8] = "CMOS option table",
@ -65,24 +65,24 @@ static const char *descs[] = {
}; };
static int static int
iterate_linuxbios_table (grub_linuxbios_table_item_t table_item, iterate_linuxbios_table (VasEBoot_linuxbios_table_item_t table_item,
void *data __attribute__ ((unused))) void *data __attribute__ ((unused)))
{ {
if (table_item->tag < ARRAY_SIZE (descs) && descs[table_item->tag]) if (table_item->tag < ARRAY_SIZE (descs) && descs[table_item->tag])
grub_printf ("tag=%02x size=%02x %s", VasEBoot_printf ("tag=%02x size=%02x %s",
table_item->tag, table_item->size, descs[table_item->tag]); table_item->tag, table_item->size, descs[table_item->tag]);
else else
grub_printf ("tag=%02x size=%02x", VasEBoot_printf ("tag=%02x size=%02x",
table_item->tag, table_item->size); table_item->tag, table_item->size);
switch (table_item->tag) switch (table_item->tag)
{ {
case GRUB_LINUXBIOS_MEMBER_FRAMEBUFFER: case VasEBoot_LINUXBIOS_MEMBER_FRAMEBUFFER:
{ {
struct grub_linuxbios_table_framebuffer *fb; struct VasEBoot_linuxbios_table_framebuffer *fb;
fb = (struct grub_linuxbios_table_framebuffer *) (table_item + 1); fb = (struct VasEBoot_linuxbios_table_framebuffer *) (table_item + 1);
grub_printf (": %dx%dx%d pitch=%d lfb=0x%llx %d/%d/%d/%d %d/%d/%d/%d", VasEBoot_printf (": %dx%dx%d pitch=%d lfb=0x%llx %d/%d/%d/%d %d/%d/%d/%d",
fb->width, fb->height, fb->width, fb->height,
fb->bpp, fb->pitch, fb->bpp, fb->pitch,
(unsigned long long) fb->lfb, (unsigned long long) fb->lfb,
@ -92,52 +92,52 @@ iterate_linuxbios_table (grub_linuxbios_table_item_t table_item,
fb->blue_field_pos, fb->reserved_field_pos); fb->blue_field_pos, fb->reserved_field_pos);
break; break;
} }
case GRUB_LINUXBIOS_MEMBER_MAINBOARD: case VasEBoot_LINUXBIOS_MEMBER_MAINBOARD:
{ {
struct grub_linuxbios_mainboard *mb; struct VasEBoot_linuxbios_mainboard *mb;
mb = (struct grub_linuxbios_mainboard *) (table_item + 1); mb = (struct VasEBoot_linuxbios_mainboard *) (table_item + 1);
grub_printf (": vendor=`%s' part_number=`%s'", VasEBoot_printf (": vendor=`%s' part_number=`%s'",
mb->strings + mb->vendor, mb->strings + mb->vendor,
mb->strings + mb->part_number); mb->strings + mb->part_number);
break; break;
} }
case 0x04 ... 0x0d: case 0x04 ... 0x0d:
grub_printf (": `%s'", (char *) (table_item + 1)); VasEBoot_printf (": `%s'", (char *) (table_item + 1));
break; break;
case GRUB_LINUXBIOS_MEMBER_CONSOLE: case VasEBoot_LINUXBIOS_MEMBER_CONSOLE:
{ {
grub_uint16_t *val = (grub_uint16_t *) (table_item + 1); VasEBoot_uint16_t *val = (VasEBoot_uint16_t *) (table_item + 1);
grub_printf (": id=%d", *val); VasEBoot_printf (": id=%d", *val);
if (*val < ARRAY_SIZE (console_descs) if (*val < ARRAY_SIZE (console_descs)
&& console_descs[*val]) && console_descs[*val])
grub_printf (" %s", console_descs[*val]); VasEBoot_printf (" %s", console_descs[*val]);
} }
} }
grub_printf ("\n"); VasEBoot_printf ("\n");
return 0; return 0;
} }
static grub_err_t static VasEBoot_err_t
grub_cmd_lscoreboot (struct grub_command *cmd __attribute__ ((unused)), VasEBoot_cmd_lscoreboot (struct VasEBoot_command *cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)), int argc __attribute__ ((unused)),
char *argv[] __attribute__ ((unused))) char *argv[] __attribute__ ((unused)))
{ {
grub_linuxbios_table_iterate (iterate_linuxbios_table, 0); VasEBoot_linuxbios_table_iterate (iterate_linuxbios_table, 0);
return 0; return 0;
} }
static grub_command_t cmd; static VasEBoot_command_t cmd;
GRUB_MOD_INIT(cbls) VasEBoot_MOD_INIT(cbls)
{ {
cmd = cmd =
grub_register_command ("lscoreboot", grub_cmd_lscoreboot, VasEBoot_register_command ("lscoreboot", VasEBoot_cmd_lscoreboot,
0, N_("List coreboot tables.")); 0, N_("List coreboot tables."));
} }
GRUB_MOD_FINI(cbls) VasEBoot_MOD_FINI(cbls)
{ {
grub_unregister_command (cmd); VasEBoot_unregister_command (cmd);
} }

View File

@ -1,35 +1,35 @@
/* cpuid.c - test for CPU features */ /* cpuid.c - test for CPU features */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc. * Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
* Based on gcc/gcc/config/i386/driver-i386.c * Based on gcc/gcc/config/i386/driver-i386.c
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/mm.h> #include <VasEBoot/mm.h>
#include <grub/env.h> #include <VasEBoot/env.h>
#include <grub/command.h> #include <VasEBoot/command.h>
#include <grub/extcmd.h> #include <VasEBoot/extcmd.h>
#include <grub/i386/cpuid.h> #include <VasEBoot/i386/cpuid.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static const struct grub_arg_option options[] = static const struct VasEBoot_arg_option options[] =
{ {
/* TRANSLATORS: "(default)" at the end means that this option is used if /* TRANSLATORS: "(default)" at the end means that this option is used if
no argument is specified. */ no argument is specified. */
@ -53,32 +53,32 @@ enum
bit_LM = (1 << 29) bit_LM = (1 << 29)
}; };
unsigned char grub_cpuid_has_longmode = 0, grub_cpuid_has_pae = 0; unsigned char VasEBoot_cpuid_has_longmode = 0, VasEBoot_cpuid_has_pae = 0;
static grub_err_t static VasEBoot_err_t
grub_cmd_cpuid (grub_extcmd_context_t ctxt, VasEBoot_cmd_cpuid (VasEBoot_extcmd_context_t ctxt,
int argc __attribute__ ((unused)), int argc __attribute__ ((unused)),
char **args __attribute__ ((unused))) char **args __attribute__ ((unused)))
{ {
int val = 0; int val = 0;
if (ctxt->state[MODE_PAE].set) if (ctxt->state[MODE_PAE].set)
val = grub_cpuid_has_pae; val = VasEBoot_cpuid_has_pae;
else else
val = grub_cpuid_has_longmode; val = VasEBoot_cpuid_has_longmode;
return val ? GRUB_ERR_NONE return val ? VasEBoot_ERR_NONE
/* TRANSLATORS: it's a standalone boolean value, /* TRANSLATORS: it's a standalone boolean value,
opposite of "true". */ opposite of "true". */
: grub_error (GRUB_ERR_TEST_FAILURE, N_("false")); : VasEBoot_error (VasEBoot_ERR_TEST_FAILURE, N_("false"));
} }
static grub_extcmd_t cmd; static VasEBoot_extcmd_t cmd;
GRUB_MOD_INIT(cpuid) VasEBoot_MOD_INIT(cpuid)
{ {
#ifdef __x86_64__ #ifdef __x86_64__
/* grub-emu */ /* VasEBoot-emu */
grub_cpuid_has_longmode = 1; VasEBoot_cpuid_has_longmode = 1;
grub_cpuid_has_pae = 1; VasEBoot_cpuid_has_pae = 1;
#else #else
unsigned int eax, ebx, ecx, edx; unsigned int eax, ebx, ecx, edx;
unsigned int max_level; unsigned int max_level;
@ -93,7 +93,7 @@ GRUB_MOD_INIT(cpuid)
goto done; goto done;
/* Check the highest input value for eax. */ /* Check the highest input value for eax. */
grub_cpuid (0, eax, ebx, ecx, edx); VasEBoot_cpuid (0, eax, ebx, ecx, edx);
/* We only look at the first four characters. */ /* We only look at the first four characters. */
max_level = eax; max_level = eax;
if (max_level == 0) if (max_level == 0)
@ -101,25 +101,25 @@ GRUB_MOD_INIT(cpuid)
if (max_level >= 1) if (max_level >= 1)
{ {
grub_cpuid (1, eax, ebx, ecx, edx); VasEBoot_cpuid (1, eax, ebx, ecx, edx);
grub_cpuid_has_pae = !!(edx & bit_PAE); VasEBoot_cpuid_has_pae = !!(edx & bit_PAE);
} }
grub_cpuid (0x80000000, eax, ebx, ecx, edx); VasEBoot_cpuid (0x80000000, eax, ebx, ecx, edx);
ext_level = eax; ext_level = eax;
if (ext_level < 0x80000000) if (ext_level < 0x80000000)
goto done; goto done;
grub_cpuid (0x80000001, eax, ebx, ecx, edx); VasEBoot_cpuid (0x80000001, eax, ebx, ecx, edx);
grub_cpuid_has_longmode = !!(edx & bit_LM); VasEBoot_cpuid_has_longmode = !!(edx & bit_LM);
done: done:
#endif #endif
cmd = grub_register_extcmd ("cpuid", grub_cmd_cpuid, 0, cmd = VasEBoot_register_extcmd ("cpuid", VasEBoot_cmd_cpuid, 0,
"[-l]", N_("Check for CPU features."), options); "[-l]", N_("Check for CPU features."), options);
} }
GRUB_MOD_FINI(cpuid) VasEBoot_MOD_FINI(cpuid)
{ {
grub_unregister_extcmd (cmd); VasEBoot_unregister_extcmd (cmd);
} }

View File

@ -1,42 +1,42 @@
/* drivemap.c - command to manage the BIOS drive mappings. */ /* drivemap.c - command to manage the BIOS drive mappings. */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2008, 2009 Free Software Foundation, Inc. * Copyright (C) 2008, 2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/extcmd.h> #include <VasEBoot/extcmd.h>
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/mm.h> #include <VasEBoot/mm.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/disk.h> #include <VasEBoot/disk.h>
#include <grub/loader.h> #include <VasEBoot/loader.h>
#include <grub/env.h> #include <VasEBoot/env.h>
#include <grub/machine/biosnum.h> #include <VasEBoot/machine/biosnum.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
#include <grub/memory.h> #include <VasEBoot/memory.h>
#include <grub/machine/memory.h> #include <VasEBoot/machine/memory.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
/* Real mode IVT slot (seg:off far pointer) for interrupt 0x13. */ /* Real mode IVT slot (seg:off far pointer) for interrupt 0x13. */
static grub_uint32_t *const int13slot = (grub_uint32_t *) (4 * 0x13); static VasEBoot_uint32_t *const int13slot = (VasEBoot_uint32_t *) (4 * 0x13);
/* Remember to update enum opt_idxs accordingly. */ /* Remember to update enum opt_idxs accordingly. */
static const struct grub_arg_option options[] = { static const struct VasEBoot_arg_option options[] = {
/* TRANSLATORS: In this file "mapping" refers to a change GRUB makes so if /* TRANSLATORS: In this file "mapping" refers to a change VasEBoot makes so if
your language doesn't have an equivalent of "mapping" you can your language doesn't have an equivalent of "mapping" you can
use the word like "rerouting". use the word like "rerouting".
*/ */
@ -55,33 +55,33 @@ enum opt_idxs
}; };
/* Realmode far ptr (2 * 16b) to the previous INT13h handler. */ /* Realmode far ptr (2 * 16b) to the previous INT13h handler. */
extern grub_uint32_t grub_drivemap_oldhandler; extern VasEBoot_uint32_t VasEBoot_drivemap_oldhandler;
/* The type "void" is used for imported assembly labels, takes no storage and /* The type "void" is used for imported assembly labels, takes no storage and
serves just to take the address with &label. */ serves just to take the address with &label. */
/* The assembly function to replace the old INT13h handler. It does not follow /* The assembly function to replace the old INT13h handler. It does not follow
any C callspecs and returns with IRET. */ any C callspecs and returns with IRET. */
extern const void grub_drivemap_handler; extern const void VasEBoot_drivemap_handler;
/* Start of the drive mappings area (space reserved at runtime). */ /* Start of the drive mappings area (space reserved at runtime). */
extern const void grub_drivemap_mapstart; extern const void VasEBoot_drivemap_mapstart;
typedef struct drivemap_node typedef struct drivemap_node
{ {
struct drivemap_node *next; struct drivemap_node *next;
grub_uint8_t newdrive; VasEBoot_uint8_t newdrive;
grub_uint8_t redirto; VasEBoot_uint8_t redirto;
} drivemap_node_t; } drivemap_node_t;
typedef struct GRUB_PACKED int13map_node typedef struct VasEBoot_PACKED int13map_node
{ {
grub_uint8_t disknum; VasEBoot_uint8_t disknum;
grub_uint8_t mapto; VasEBoot_uint8_t mapto;
} int13map_node_t; } int13map_node_t;
#define INT13H_OFFSET(x) \ #define INT13H_OFFSET(x) \
(((grub_uint8_t *)(x)) - ((grub_uint8_t *)&grub_drivemap_handler)) (((VasEBoot_uint8_t *)(x)) - ((VasEBoot_uint8_t *)&VasEBoot_drivemap_handler))
static drivemap_node_t *map_head; static drivemap_node_t *map_head;
static void *drivemap_hook; static void *drivemap_hook;
@ -89,8 +89,8 @@ static int drivemap_mmap;
/* Puts the specified mapping into the table, replacing an existing mapping /* Puts the specified mapping into the table, replacing an existing mapping
for newdrive or adding a new one if required. */ for newdrive or adding a new one if required. */
static grub_err_t static VasEBoot_err_t
drivemap_set (grub_uint8_t newdrive, grub_uint8_t redirto) drivemap_set (VasEBoot_uint8_t newdrive, VasEBoot_uint8_t redirto)
{ {
drivemap_node_t *mapping = 0; drivemap_node_t *mapping = 0;
drivemap_node_t *search = map_head; drivemap_node_t *search = map_head;
@ -109,21 +109,21 @@ drivemap_set (grub_uint8_t newdrive, grub_uint8_t redirto)
mapping->redirto = redirto; mapping->redirto = redirto;
else else
{ {
mapping = grub_malloc (sizeof (drivemap_node_t)); mapping = VasEBoot_malloc (sizeof (drivemap_node_t));
if (! mapping) if (! mapping)
return grub_errno; return VasEBoot_errno;
mapping->newdrive = newdrive; mapping->newdrive = newdrive;
mapping->redirto = redirto; mapping->redirto = redirto;
mapping->next = map_head; mapping->next = map_head;
map_head = mapping; map_head = mapping;
} }
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
} }
/* Removes the mapping for newdrive from the table. If there is no mapping, /* Removes the mapping for newdrive from the table. If there is no mapping,
then this function behaves like a no-op on the map. */ then this function behaves like a no-op on the map. */
static void static void
drivemap_remove (grub_uint8_t newdrive) drivemap_remove (VasEBoot_uint8_t newdrive)
{ {
drivemap_node_t *mapping = 0; drivemap_node_t *mapping = 0;
drivemap_node_t *search = map_head; drivemap_node_t *search = map_head;
@ -146,53 +146,53 @@ drivemap_remove (grub_uint8_t newdrive)
previous->next = mapping->next; previous->next = mapping->next;
else else
map_head = mapping->next; map_head = mapping->next;
grub_free (mapping); VasEBoot_free (mapping);
} }
} }
/* Given a GRUB-like device name and a convenient location, stores the /* Given a VasEBoot-like device name and a convenient location, stores the
related BIOS disk number. Accepts devices like \((f|h)dN\), with related BIOS disk number. Accepts devices like \((f|h)dN\), with
0 <= N < 128. */ 0 <= N < 128. */
static grub_err_t static VasEBoot_err_t
tryparse_diskstring (const char *str, grub_uint8_t *output) tryparse_diskstring (const char *str, VasEBoot_uint8_t *output)
{ {
/* Skip opening paren in order to allow both (hd0) and hd0. */ /* Skip opening paren in order to allow both (hd0) and hd0. */
if (*str == '(') if (*str == '(')
str++; str++;
if ((str[0] == 'f' || str[0] == 'h') && str[1] == 'd') if ((str[0] == 'f' || str[0] == 'h') && str[1] == 'd')
{ {
grub_uint8_t bios_num = (str[0] == 'h') ? 0x80 : 0x00; VasEBoot_uint8_t bios_num = (str[0] == 'h') ? 0x80 : 0x00;
unsigned long drivenum = grub_strtoul (str + 2, 0, 0); unsigned long drivenum = VasEBoot_strtoul (str + 2, 0, 0);
if (grub_errno == GRUB_ERR_NONE && drivenum < 128) if (VasEBoot_errno == VasEBoot_ERR_NONE && drivenum < 128)
{ {
bios_num |= drivenum; bios_num |= drivenum;
if (output) if (output)
*output = bios_num; *output = bios_num;
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
} }
} }
return grub_error (GRUB_ERR_BAD_ARGUMENT, "device format \"%s\" " return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, "device format \"%s\" "
"invalid: must be (f|h)dN, with 0 <= N < 128", str); "invalid: must be (f|h)dN, with 0 <= N < 128", str);
} }
static grub_err_t static VasEBoot_err_t
list_mappings (void) list_mappings (void)
{ {
/* Show: list mappings. */ /* Show: list mappings. */
if (! map_head) if (! map_head)
{ {
grub_puts_ (N_("No drives have been remapped")); VasEBoot_puts_ (N_("No drives have been remapped"));
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
} }
/* TRANSLATORS: This is the header of mapping list. /* TRANSLATORS: This is the header of mapping list.
On the left is how OS will see the disks and On the left is how OS will see the disks and
on the right current GRUB vision. */ on the right current VasEBoot vision. */
grub_puts_ (N_("OS disk #num ------> GRUB/BIOS device")); VasEBoot_puts_ (N_("OS disk #num ------> VasEBoot/BIOS device"));
drivemap_node_t *curnode = map_head; drivemap_node_t *curnode = map_head;
while (curnode) while (curnode)
{ {
grub_printf ("%cD #%-3u (0x%02x) %cd%d\n", VasEBoot_printf ("%cD #%-3u (0x%02x) %cd%d\n",
(curnode->newdrive & 0x80) ? 'H' : 'F', (curnode->newdrive & 0x80) ? 'H' : 'F',
curnode->newdrive & 0x7F, curnode->newdrive, curnode->newdrive & 0x7F, curnode->newdrive,
(curnode->redirto & 0x80) ? 'h' : 'f', (curnode->redirto & 0x80) ? 'h' : 'f',
@ -200,11 +200,11 @@ list_mappings (void)
); );
curnode = curnode->next; curnode = curnode->next;
} }
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
} }
static grub_err_t static VasEBoot_err_t
grub_cmd_drivemap (struct grub_extcmd_context *ctxt, int argc, char **args) VasEBoot_cmd_drivemap (struct VasEBoot_extcmd_context *ctxt, int argc, char **args)
{ {
if (ctxt->state[OPTIDX_LIST].set) if (ctxt->state[OPTIDX_LIST].set)
{ {
@ -219,10 +219,10 @@ grub_cmd_drivemap (struct grub_extcmd_context *ctxt, int argc, char **args)
{ {
prevnode = curnode; prevnode = curnode;
curnode = curnode->next; curnode = curnode->next;
grub_free (prevnode); VasEBoot_free (prevnode);
} }
map_head = 0; map_head = 0;
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
} }
else if (!ctxt->state[OPTIDX_SWAP].set && argc == 0) else if (!ctxt->state[OPTIDX_SWAP].set && argc == 0)
{ {
@ -231,53 +231,53 @@ grub_cmd_drivemap (struct grub_extcmd_context *ctxt, int argc, char **args)
} }
/* Neither flag: put mapping. */ /* Neither flag: put mapping. */
grub_uint8_t mapfrom = 0; VasEBoot_uint8_t mapfrom = 0;
grub_uint8_t mapto = 0xFF; VasEBoot_uint8_t mapto = 0xFF;
grub_err_t err; VasEBoot_err_t err;
if (argc != 2) if (argc != 2)
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("two arguments expected")); return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, N_("two arguments expected"));
err = tryparse_diskstring (args[0], &mapfrom); err = tryparse_diskstring (args[0], &mapfrom);
if (err != GRUB_ERR_NONE) if (err != VasEBoot_ERR_NONE)
return err; return err;
err = tryparse_diskstring (args[1], &mapto); err = tryparse_diskstring (args[1], &mapto);
if (err != GRUB_ERR_NONE) if (err != VasEBoot_ERR_NONE)
return err; return err;
if (mapto == mapfrom) if (mapto == mapfrom)
{ {
/* Reset to default. */ /* Reset to default. */
grub_dprintf ("drivemap", "Removing mapping for %s (%02x)\n", VasEBoot_dprintf ("drivemap", "Removing mapping for %s (%02x)\n",
args[0], mapfrom); args[0], mapfrom);
drivemap_remove (mapfrom); drivemap_remove (mapfrom);
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
} }
/* Set the mapping for the disk (overwrites any existing mapping). */ /* Set the mapping for the disk (overwrites any existing mapping). */
grub_dprintf ("drivemap", "%s %s (%02x) = %s (%02x)\n", VasEBoot_dprintf ("drivemap", "%s %s (%02x) = %s (%02x)\n",
ctxt->state[OPTIDX_SWAP].set ? "Swapping" : "Mapping", ctxt->state[OPTIDX_SWAP].set ? "Swapping" : "Mapping",
args[1], mapto, args[0], mapfrom); args[1], mapto, args[0], mapfrom);
err = drivemap_set (mapto, mapfrom); err = drivemap_set (mapto, mapfrom);
/* If -s, perform the reverse mapping too (only if the first was OK). */ /* If -s, perform the reverse mapping too (only if the first was OK). */
if (ctxt->state[OPTIDX_SWAP].set && err == GRUB_ERR_NONE) if (ctxt->state[OPTIDX_SWAP].set && err == VasEBoot_ERR_NONE)
err = drivemap_set (mapfrom, mapto); err = drivemap_set (mapfrom, mapto);
return err; return err;
} }
/* Int13h handler installer - reserves conventional memory for the handler, /* Int13h handler installer - reserves conventional memory for the handler,
copies it over and sets the IVT entry for int13h. copies it over and sets the IVT entry for int13h.
This code rests on the assumption that GRUB does not activate any kind This code rests on the assumption that VasEBoot does not activate any kind
of memory mapping apart from identity paging, since it accesses of memory mapping apart from identity paging, since it accesses
realmode structures by their absolute addresses, like the IVT at 0; realmode structures by their absolute addresses, like the IVT at 0;
and transforms a pmode pointer into a rmode seg:off far ptr. */ and transforms a pmode pointer into a rmode seg:off far ptr. */
static grub_err_t static VasEBoot_err_t
install_int13_handler (int noret __attribute__ ((unused))) install_int13_handler (int noret __attribute__ ((unused)))
{ {
/* Size of the full int13 handler "bundle", including code and map. */ /* Size of the full int13 handler "bundle", including code and map. */
grub_uint32_t total_size; VasEBoot_uint32_t total_size;
/* Base address of the space reserved for the handler bundle. */ /* Base address of the space reserved for the handler bundle. */
grub_uint8_t *handler_base = 0; VasEBoot_uint8_t *handler_base = 0;
/* Address of the map within the deployed bundle. */ /* Address of the map within the deployed bundle. */
int13map_node_t *handler_map; int13map_node_t *handler_map;
@ -294,93 +294,93 @@ install_int13_handler (int noret __attribute__ ((unused)))
if (entries == 0) if (entries == 0)
{ {
/* No need to install the int13h handler. */ /* No need to install the int13h handler. */
grub_dprintf ("drivemap", "No drives marked as remapped, not installing " VasEBoot_dprintf ("drivemap", "No drives marked as remapped, not installing "
"our int13h handler.\n"); "our int13h handler.\n");
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
} }
grub_dprintf ("drivemap", "Installing our int13h handler\n"); VasEBoot_dprintf ("drivemap", "Installing our int13h handler\n");
/* Save the pointer to the old handler. */ /* Save the pointer to the old handler. */
grub_drivemap_oldhandler = *int13slot; VasEBoot_drivemap_oldhandler = *int13slot;
grub_dprintf ("drivemap", "Original int13 handler: %04x:%04x\n", VasEBoot_dprintf ("drivemap", "Original int13 handler: %04x:%04x\n",
(grub_drivemap_oldhandler >> 16) & 0x0ffff, (VasEBoot_drivemap_oldhandler >> 16) & 0x0ffff,
grub_drivemap_oldhandler & 0x0ffff); VasEBoot_drivemap_oldhandler & 0x0ffff);
/* Find a rmode-segment-aligned zone in conventional memory big /* Find a rmode-segment-aligned zone in conventional memory big
enough to hold the handler and its data. */ enough to hold the handler and its data. */
total_size = INT13H_OFFSET (&grub_drivemap_mapstart) total_size = INT13H_OFFSET (&VasEBoot_drivemap_mapstart)
+ (entries + 1) * sizeof (int13map_node_t); + (entries + 1) * sizeof (int13map_node_t);
grub_dprintf ("drivemap", "Payload is %u bytes long\n", total_size); VasEBoot_dprintf ("drivemap", "Payload is %u bytes long\n", total_size);
handler_base = grub_mmap_malign_and_register (16, ALIGN_UP (total_size, 16), handler_base = VasEBoot_mmap_malign_and_register (16, ALIGN_UP (total_size, 16),
&drivemap_mmap, &drivemap_mmap,
GRUB_MEMORY_RESERVED, VasEBoot_MEMORY_RESERVED,
GRUB_MMAP_MALLOC_LOW); VasEBoot_MMAP_MALLOC_LOW);
if (! handler_base) if (! handler_base)
return grub_error (GRUB_ERR_OUT_OF_MEMORY, "couldn't reserve " return VasEBoot_error (VasEBoot_ERR_OUT_OF_MEMORY, "couldn't reserve "
"memory for the int13h handler"); "memory for the int13h handler");
/* Copy int13h handler bundle to reserved area. */ /* Copy int13h handler bundle to reserved area. */
grub_dprintf ("drivemap", "Reserved memory at %p, copying handler\n", VasEBoot_dprintf ("drivemap", "Reserved memory at %p, copying handler\n",
handler_base); handler_base);
grub_memcpy (handler_base, &grub_drivemap_handler, VasEBoot_memcpy (handler_base, &VasEBoot_drivemap_handler,
INT13H_OFFSET (&grub_drivemap_mapstart)); INT13H_OFFSET (&VasEBoot_drivemap_mapstart));
/* Copy the mappings to the reserved area. */ /* Copy the mappings to the reserved area. */
curentry = map_head; curentry = map_head;
handler_map = (int13map_node_t *) (handler_base + handler_map = (int13map_node_t *) (handler_base +
INT13H_OFFSET (&grub_drivemap_mapstart)); INT13H_OFFSET (&VasEBoot_drivemap_mapstart));
grub_dprintf ("drivemap", "Target map at %p, copying mappings\n", handler_map); VasEBoot_dprintf ("drivemap", "Target map at %p, copying mappings\n", handler_map);
for (i = 0; i < entries; ++i, curentry = curentry->next) for (i = 0; i < entries; ++i, curentry = curentry->next)
{ {
handler_map[i].disknum = curentry->newdrive; handler_map[i].disknum = curentry->newdrive;
handler_map[i].mapto = curentry->redirto; handler_map[i].mapto = curentry->redirto;
grub_dprintf ("drivemap", "\t#%d: 0x%02x <- 0x%02x\n", i, VasEBoot_dprintf ("drivemap", "\t#%d: 0x%02x <- 0x%02x\n", i,
handler_map[i].disknum, handler_map[i].mapto); handler_map[i].disknum, handler_map[i].mapto);
} }
/* Signal end-of-map. */ /* Signal end-of-map. */
handler_map[i].disknum = 0; handler_map[i].disknum = 0;
handler_map[i].mapto = 0; handler_map[i].mapto = 0;
grub_dprintf ("drivemap", "\t#%d: 0x00 <- 0x00 (end)\n", i); VasEBoot_dprintf ("drivemap", "\t#%d: 0x00 <- 0x00 (end)\n", i);
/* Install our function as the int13h handler in the IVT. */ /* Install our function as the int13h handler in the IVT. */
*int13slot = ((grub_uint32_t) handler_base) << 12; /* Segment address. */ *int13slot = ((VasEBoot_uint32_t) handler_base) << 12; /* Segment address. */
grub_dprintf ("drivemap", "New int13 handler: %04x:%04x\n", VasEBoot_dprintf ("drivemap", "New int13 handler: %04x:%04x\n",
(*int13slot >> 16) & 0x0ffff, *int13slot & 0x0ffff); (*int13slot >> 16) & 0x0ffff, *int13slot & 0x0ffff);
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
} }
static grub_err_t static VasEBoot_err_t
uninstall_int13_handler (void) uninstall_int13_handler (void)
{ {
if (! grub_drivemap_oldhandler) if (! VasEBoot_drivemap_oldhandler)
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
*int13slot = grub_drivemap_oldhandler; *int13slot = VasEBoot_drivemap_oldhandler;
grub_mmap_free_and_unregister (drivemap_mmap); VasEBoot_mmap_free_and_unregister (drivemap_mmap);
grub_drivemap_oldhandler = 0; VasEBoot_drivemap_oldhandler = 0;
grub_dprintf ("drivemap", "Restored int13 handler: %04x:%04x\n", VasEBoot_dprintf ("drivemap", "Restored int13 handler: %04x:%04x\n",
(*int13slot >> 16) & 0x0ffff, *int13slot & 0x0ffff); (*int13slot >> 16) & 0x0ffff, *int13slot & 0x0ffff);
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
} }
static int static int
grub_get_root_biosnumber_drivemap (void) VasEBoot_get_root_biosnumber_drivemap (void)
{ {
const char *biosnum; const char *biosnum;
int ret = -1; int ret = -1;
grub_device_t dev; VasEBoot_device_t dev;
biosnum = grub_env_get ("biosnum"); biosnum = VasEBoot_env_get ("biosnum");
if (biosnum) if (biosnum)
return grub_strtoul (biosnum, 0, 0); return VasEBoot_strtoul (biosnum, 0, 0);
dev = grub_device_open (0); dev = VasEBoot_device_open (0);
if (dev && dev->disk && dev->disk->dev if (dev && dev->disk && dev->disk->dev
&& dev->disk->dev->id == GRUB_DISK_DEVICE_BIOSDISK_ID) && dev->disk->dev->id == VasEBoot_DISK_DEVICE_BIOSDISK_ID)
{ {
drivemap_node_t *curnode = map_head; drivemap_node_t *curnode = map_head;
ret = (int) dev->disk->id; ret = (int) dev->disk->id;
@ -397,32 +397,32 @@ grub_get_root_biosnumber_drivemap (void)
} }
if (dev) if (dev)
grub_device_close (dev); VasEBoot_device_close (dev);
return ret; return ret;
} }
static grub_extcmd_t cmd; static VasEBoot_extcmd_t cmd;
static int (*grub_get_root_biosnumber_saved) (void); static int (*VasEBoot_get_root_biosnumber_saved) (void);
GRUB_MOD_INIT (drivemap) VasEBoot_MOD_INIT (drivemap)
{ {
grub_get_root_biosnumber_saved = grub_get_root_biosnumber; VasEBoot_get_root_biosnumber_saved = VasEBoot_get_root_biosnumber;
grub_get_root_biosnumber = grub_get_root_biosnumber_drivemap; VasEBoot_get_root_biosnumber = VasEBoot_get_root_biosnumber_drivemap;
cmd = grub_register_extcmd ("drivemap", grub_cmd_drivemap, 0, cmd = VasEBoot_register_extcmd ("drivemap", VasEBoot_cmd_drivemap, 0,
N_("-l | -r | [-s] grubdev osdisk."), N_("-l | -r | [-s] VasEBootdev osdisk."),
N_("Manage the BIOS drive mappings."), N_("Manage the BIOS drive mappings."),
options); options);
drivemap_hook = drivemap_hook =
grub_loader_register_preboot_hook (&install_int13_handler, VasEBoot_loader_register_preboot_hook (&install_int13_handler,
&uninstall_int13_handler, &uninstall_int13_handler,
GRUB_LOADER_PREBOOT_HOOK_PRIO_NORMAL); VasEBoot_LOADER_PREBOOT_HOOK_PRIO_NORMAL);
} }
GRUB_MOD_FINI (drivemap) VasEBoot_MOD_FINI (drivemap)
{ {
grub_get_root_biosnumber = grub_get_root_biosnumber_saved; VasEBoot_get_root_biosnumber = VasEBoot_get_root_biosnumber_saved;
grub_loader_unregister_preboot_hook (drivemap_hook); VasEBoot_loader_unregister_preboot_hook (drivemap_hook);
drivemap_hook = 0; drivemap_hook = 0;
grub_unregister_extcmd (cmd); VasEBoot_unregister_extcmd (cmd);
} }

View File

@ -1,23 +1,23 @@
/* drivemap_int13h.S - interrupt handler for the BIOS drive remapper */ /* drivemap_int13h.S - interrupt handler for the BIOS drive remapper */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2008, 2009 Free Software Foundation, Inc. * Copyright (C) 2008, 2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/symbol.h> #include <VasEBoot/symbol.h>
#define INT13H_OFFSET(x) ((x) - LOCAL (base)) #define INT13H_OFFSET(x) ((x) - LOCAL (base))
@ -26,7 +26,7 @@
/* Copy starts here. When deployed, this code must be segment-aligned. */ /* Copy starts here. When deployed, this code must be segment-aligned. */
/* The replacement int13 handler. Preserve all registers. */ /* The replacement int13 handler. Preserve all registers. */
FUNCTION(grub_drivemap_handler) FUNCTION(VasEBoot_drivemap_handler)
LOCAL (base): LOCAL (base):
/* Save %dx for future restore. */ /* Save %dx for future restore. */
push %dx push %dx
@ -111,7 +111,7 @@ norestore:
/* Far pointer to the old handler. Stored as a CS:IP in the style of real-mode /* Far pointer to the old handler. Stored as a CS:IP in the style of real-mode
IVT entries (thus PI:SC in mem). */ IVT entries (thus PI:SC in mem). */
VARIABLE(grub_drivemap_oldhandler) VARIABLE(VasEBoot_drivemap_oldhandler)
LOCAL (oldhandler): LOCAL (oldhandler):
.word 0x0, 0x0 .word 0x0, 0x0
@ -119,6 +119,6 @@ LOCAL (oldhandler):
reserves additional space for mappings at runtime and copies them over it. */ reserves additional space for mappings at runtime and copies them over it. */
.align 2 .align 2
VARIABLE(grub_drivemap_mapstart) VARIABLE(VasEBoot_drivemap_mapstart)
LOCAL (mapstart): LOCAL (mapstart):
.byte 0 .byte 0

View File

@ -1,32 +1,32 @@
/* halt.c - command to halt the computer. */ /* halt.c - command to halt the computer. */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2005,2007,2009 Free Software Foundation, Inc. * Copyright (C) 2005,2007,2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/extcmd.h> #include <VasEBoot/extcmd.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
#include <grub/machine/int.h> #include <VasEBoot/machine/int.h>
#include <grub/acpi.h> #include <VasEBoot/acpi.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static const struct grub_arg_option options[] = static const struct VasEBoot_arg_option options[] =
{ {
{"no-apm", 'n', 0, N_("Do not use APM to halt the computer."), 0, 0}, {"no-apm", 'n', 0, N_("Do not use APM to halt the computer."), 0, 0},
{0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0}
@ -45,11 +45,11 @@ stop (void)
* APM even if it is available. * APM even if it is available.
*/ */
void __attribute__ ((noreturn)) void __attribute__ ((noreturn))
grub_halt (int no_apm) VasEBoot_halt (int no_apm)
{ {
struct grub_bios_int_registers regs; struct VasEBoot_bios_int_registers regs;
grub_acpi_halt (); VasEBoot_acpi_halt ();
if (no_apm) if (no_apm)
stop (); stop ();
@ -57,70 +57,70 @@ grub_halt (int no_apm)
/* detect APM */ /* detect APM */
regs.eax = 0x5300; regs.eax = 0x5300;
regs.ebx = 0; regs.ebx = 0;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT; regs.flags = VasEBoot_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x15, &regs); VasEBoot_bios_interrupt (0x15, &regs);
if (regs.flags & GRUB_CPU_INT_FLAGS_CARRY) if (regs.flags & VasEBoot_CPU_INT_FLAGS_CARRY)
stop (); stop ();
/* disconnect APM first */ /* disconnect APM first */
regs.eax = 0x5304; regs.eax = 0x5304;
regs.ebx = 0; regs.ebx = 0;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT; regs.flags = VasEBoot_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x15, &regs); VasEBoot_bios_interrupt (0x15, &regs);
/* connect APM */ /* connect APM */
regs.eax = 0x5301; regs.eax = 0x5301;
regs.ebx = 0; regs.ebx = 0;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT; regs.flags = VasEBoot_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x15, &regs); VasEBoot_bios_interrupt (0x15, &regs);
if (regs.flags & GRUB_CPU_INT_FLAGS_CARRY) if (regs.flags & VasEBoot_CPU_INT_FLAGS_CARRY)
stop (); stop ();
/* set APM protocol level - 1.1 or bust. (this covers APM 1.2 also) */ /* set APM protocol level - 1.1 or bust. (this covers APM 1.2 also) */
regs.eax = 0x530E; regs.eax = 0x530E;
regs.ebx = 0; regs.ebx = 0;
regs.ecx = 0x0101; regs.ecx = 0x0101;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT; regs.flags = VasEBoot_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x15, &regs); VasEBoot_bios_interrupt (0x15, &regs);
if (regs.flags & GRUB_CPU_INT_FLAGS_CARRY) if (regs.flags & VasEBoot_CPU_INT_FLAGS_CARRY)
stop (); stop ();
/* set the power state to off */ /* set the power state to off */
regs.eax = 0x5307; regs.eax = 0x5307;
regs.ebx = 1; regs.ebx = 1;
regs.ecx = 3; regs.ecx = 3;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT; regs.flags = VasEBoot_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x15, &regs); VasEBoot_bios_interrupt (0x15, &regs);
/* shouldn't reach here */ /* shouldn't reach here */
stop (); stop ();
} }
static grub_err_t __attribute__ ((noreturn)) static VasEBoot_err_t __attribute__ ((noreturn))
grub_cmd_halt (grub_extcmd_context_t ctxt, VasEBoot_cmd_halt (VasEBoot_extcmd_context_t ctxt,
int argc __attribute__ ((unused)), int argc __attribute__ ((unused)),
char **args __attribute__ ((unused))) char **args __attribute__ ((unused)))
{ {
struct grub_arg_list *state = ctxt->state; struct VasEBoot_arg_list *state = ctxt->state;
int no_apm = 0; int no_apm = 0;
if (state[0].set) if (state[0].set)
no_apm = 1; no_apm = 1;
grub_halt (no_apm); VasEBoot_halt (no_apm);
} }
static grub_extcmd_t cmd; static VasEBoot_extcmd_t cmd;
GRUB_MOD_INIT(halt) VasEBoot_MOD_INIT(halt)
{ {
cmd = grub_register_extcmd ("halt", grub_cmd_halt, 0, "[-n]", cmd = VasEBoot_register_extcmd ("halt", VasEBoot_cmd_halt, 0, "[-n]",
N_("Halt the system, if possible using APM."), N_("Halt the system, if possible using APM."),
options); options);
} }
GRUB_MOD_FINI(halt) VasEBoot_MOD_FINI(halt)
{ {
grub_unregister_extcmd (cmd); VasEBoot_unregister_extcmd (cmd);
} }

View File

@ -1,41 +1,41 @@
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2010 Free Software Foundation, Inc. * Copyright (C) 2010 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/machine/int.h> #include <VasEBoot/machine/int.h>
#include <grub/machine/apm.h> #include <VasEBoot/machine/apm.h>
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/command.h> #include <VasEBoot/command.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
int int
grub_apm_get_info (struct grub_apm_info *info) VasEBoot_apm_get_info (struct VasEBoot_apm_info *info)
{ {
struct grub_bios_int_registers regs; struct VasEBoot_bios_int_registers regs;
/* detect APM */ /* detect APM */
regs.eax = 0x5300; regs.eax = 0x5300;
regs.ebx = 0; regs.ebx = 0;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT; regs.flags = VasEBoot_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x15, &regs); VasEBoot_bios_interrupt (0x15, &regs);
if (regs.flags & GRUB_CPU_INT_FLAGS_CARRY) if (regs.flags & VasEBoot_CPU_INT_FLAGS_CARRY)
return 0; return 0;
info->version = regs.eax & 0xffff; info->version = regs.eax & 0xffff;
info->flags = regs.ecx & 0xffff; info->flags = regs.ecx & 0xffff;
@ -43,16 +43,16 @@ grub_apm_get_info (struct grub_apm_info *info)
/* disconnect APM first */ /* disconnect APM first */
regs.eax = 0x5304; regs.eax = 0x5304;
regs.ebx = 0; regs.ebx = 0;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT; regs.flags = VasEBoot_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x15, &regs); VasEBoot_bios_interrupt (0x15, &regs);
/* connect APM */ /* connect APM */
regs.eax = 0x5303; regs.eax = 0x5303;
regs.ebx = 0; regs.ebx = 0;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT; regs.flags = VasEBoot_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x15, &regs); VasEBoot_bios_interrupt (0x15, &regs);
if (regs.flags & GRUB_CPU_INT_FLAGS_CARRY) if (regs.flags & VasEBoot_CPU_INT_FLAGS_CARRY)
return 0; return 0;
info->cseg = regs.eax & 0xffff; info->cseg = regs.eax & 0xffff;
@ -66,15 +66,15 @@ grub_apm_get_info (struct grub_apm_info *info)
return 1; return 1;
} }
static grub_err_t static VasEBoot_err_t
grub_cmd_lsapm (grub_command_t cmd __attribute__ ((unused)), VasEBoot_cmd_lsapm (VasEBoot_command_t cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)), char **args __attribute__ ((unused))) int argc __attribute__ ((unused)), char **args __attribute__ ((unused)))
{ {
struct grub_apm_info info; struct VasEBoot_apm_info info;
if (!grub_apm_get_info (&info)) if (!VasEBoot_apm_get_info (&info))
return grub_error (GRUB_ERR_IO, N_("no APM found")); return VasEBoot_error (VasEBoot_ERR_IO, N_("no APM found"));
grub_printf_ (N_("Version %u.%u\n" VasEBoot_printf_ (N_("Version %u.%u\n"
"32-bit CS = 0x%x, len = 0x%x, offset = 0x%x\n" "32-bit CS = 0x%x, len = 0x%x, offset = 0x%x\n"
"16-bit CS = 0x%x, len = 0x%x\n" "16-bit CS = 0x%x, len = 0x%x\n"
"DS = 0x%x, len = 0x%x\n"), "DS = 0x%x, len = 0x%x\n"),
@ -82,34 +82,34 @@ grub_cmd_lsapm (grub_command_t cmd __attribute__ ((unused)),
info.cseg, info.cseg_len, info.offset, info.cseg, info.cseg_len, info.offset,
info.cseg_16, info.cseg_16_len, info.cseg_16, info.cseg_16_len,
info.dseg, info.dseg_len); info.dseg, info.dseg_len);
grub_xputs (info.flags & GRUB_APM_FLAGS_16BITPROTECTED_SUPPORTED VasEBoot_xputs (info.flags & VasEBoot_APM_FLAGS_16BITPROTECTED_SUPPORTED
? _("16-bit protected interface supported\n") ? _("16-bit protected interface supported\n")
: _("16-bit protected interface unsupported\n")); : _("16-bit protected interface unsupported\n"));
grub_xputs (info.flags & GRUB_APM_FLAGS_32BITPROTECTED_SUPPORTED VasEBoot_xputs (info.flags & VasEBoot_APM_FLAGS_32BITPROTECTED_SUPPORTED
? _("32-bit protected interface supported\n") ? _("32-bit protected interface supported\n")
: _("32-bit protected interface unsupported\n")); : _("32-bit protected interface unsupported\n"));
grub_xputs (info.flags & GRUB_APM_FLAGS_CPUIDLE_SLOWS_DOWN VasEBoot_xputs (info.flags & VasEBoot_APM_FLAGS_CPUIDLE_SLOWS_DOWN
? _("CPU Idle slows down processor\n") ? _("CPU Idle slows down processor\n")
: _("CPU Idle doesn't slow down processor\n")); : _("CPU Idle doesn't slow down processor\n"));
grub_xputs (info.flags & GRUB_APM_FLAGS_DISABLED VasEBoot_xputs (info.flags & VasEBoot_APM_FLAGS_DISABLED
? _("APM disabled\n") : _("APM enabled\n")); ? _("APM disabled\n") : _("APM enabled\n"));
grub_xputs (info.flags & GRUB_APM_FLAGS_DISENGAGED VasEBoot_xputs (info.flags & VasEBoot_APM_FLAGS_DISENGAGED
? _("APM disengaged\n") : _("APM engaged\n")); ? _("APM disengaged\n") : _("APM engaged\n"));
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
} }
static grub_command_t cmd; static VasEBoot_command_t cmd;
GRUB_MOD_INIT(lsapm) VasEBoot_MOD_INIT(lsapm)
{ {
cmd = grub_register_command ("lsapm", grub_cmd_lsapm, 0, cmd = VasEBoot_register_command ("lsapm", VasEBoot_cmd_lsapm, 0,
N_("Show APM information.")); N_("Show APM information."));
} }
GRUB_MOD_FINI(lsapm) VasEBoot_MOD_FINI(lsapm)
{ {
grub_unregister_command (cmd); VasEBoot_unregister_command (cmd);
} }

View File

@ -1,86 +1,86 @@
/* play.c - command to play a tune */ /* play.c - command to play a tune */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2005,2007,2009 Free Software Foundation, Inc. * Copyright (C) 2005,2007,2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
/* Lots of this file is borrowed from GNU/Hurd generic-speaker driver. */ /* Lots of this file is borrowed from GNU/Hurd generic-speaker driver. */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/file.h> #include <VasEBoot/file.h>
#include <grub/disk.h> #include <VasEBoot/disk.h>
#include <grub/term.h> #include <VasEBoot/term.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/cpu/io.h> #include <VasEBoot/cpu/io.h>
#include <grub/command.h> #include <VasEBoot/command.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
#include <grub/time.h> #include <VasEBoot/time.h>
#include <grub/speaker.h> #include <VasEBoot/speaker.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
#define BASE_TEMPO (60 * 1000) #define BASE_TEMPO (60 * 1000)
#define T_REST ((grub_uint16_t) 0) #define T_REST ((VasEBoot_uint16_t) 0)
#define T_FINE ((grub_uint16_t) -1) #define T_FINE ((VasEBoot_uint16_t) -1)
struct note struct note
{ {
grub_uint16_t pitch; VasEBoot_uint16_t pitch;
grub_uint16_t duration; VasEBoot_uint16_t duration;
}; };
/* Returns whether playing should continue. */ /* Returns whether playing should continue. */
static int static int
play (unsigned tempo, struct note *note) play (unsigned tempo, struct note *note)
{ {
grub_uint64_t to; VasEBoot_uint64_t to;
if (note->pitch == T_FINE || grub_getkey_noblock () != GRUB_TERM_NO_KEY) if (note->pitch == T_FINE || VasEBoot_getkey_noblock () != VasEBoot_TERM_NO_KEY)
return 1; return 1;
grub_dprintf ("play", "pitch = %d, duration = %d\n", note->pitch, VasEBoot_dprintf ("play", "pitch = %d, duration = %d\n", note->pitch,
note->duration); note->duration);
switch (note->pitch) switch (note->pitch)
{ {
case T_REST: case T_REST:
grub_speaker_beep_off (); VasEBoot_speaker_beep_off ();
break; break;
default: default:
grub_speaker_beep_on (note->pitch); VasEBoot_speaker_beep_on (note->pitch);
break; break;
} }
to = grub_get_time_ms () + BASE_TEMPO * note->duration / tempo; to = VasEBoot_get_time_ms () + BASE_TEMPO * note->duration / tempo;
while ((grub_get_time_ms () <= to) while ((VasEBoot_get_time_ms () <= to)
&& (grub_getkey_noblock () == GRUB_TERM_NO_KEY)); && (VasEBoot_getkey_noblock () == VasEBoot_TERM_NO_KEY));
return 0; return 0;
} }
static grub_err_t static VasEBoot_err_t
grub_cmd_play (grub_command_t cmd __attribute__ ((unused)), VasEBoot_cmd_play (VasEBoot_command_t cmd __attribute__ ((unused)),
int argc, char **args) int argc, char **args)
{ {
if (argc < 1) if (argc < 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT,
/* TRANSLATORS: It's musical notes, not the notes /* TRANSLATORS: It's musical notes, not the notes
you take. Play command expects arguments which can you take. Play command expects arguments which can
be either a filename or tempo+notes. be either a filename or tempo+notes.
@ -90,45 +90,45 @@ grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
if (argc == 1) if (argc == 1)
{ {
struct note buf; struct note buf;
grub_uint32_t tempo; VasEBoot_uint32_t tempo;
grub_file_t file; VasEBoot_file_t file;
file = grub_file_open (args[0]); file = VasEBoot_file_open (args[0]);
if (! file) if (! file)
return grub_errno; return VasEBoot_errno;
if (grub_file_read (file, &tempo, sizeof (tempo)) != sizeof (tempo)) if (VasEBoot_file_read (file, &tempo, sizeof (tempo)) != sizeof (tempo))
{ {
grub_file_close (file); VasEBoot_file_close (file);
if (!grub_errno) if (!VasEBoot_errno)
grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"), VasEBoot_error (VasEBoot_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
args[0]); args[0]);
return grub_errno; return VasEBoot_errno;
} }
if (!tempo) if (!tempo)
{ {
grub_file_close (file); VasEBoot_file_close (file);
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Invalid tempo in %s"), VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, N_("Invalid tempo in %s"),
args[0]); args[0]);
return grub_errno; return VasEBoot_errno;
} }
tempo = grub_le_to_cpu32 (tempo); tempo = VasEBoot_le_to_cpu32 (tempo);
grub_dprintf ("play","tempo = %d\n", tempo); VasEBoot_dprintf ("play","tempo = %d\n", tempo);
while (grub_file_read (file, &buf, while (VasEBoot_file_read (file, &buf,
sizeof (struct note)) == sizeof (struct note)) sizeof (struct note)) == sizeof (struct note))
{ {
buf.pitch = grub_le_to_cpu16 (buf.pitch); buf.pitch = VasEBoot_le_to_cpu16 (buf.pitch);
buf.duration = grub_le_to_cpu16 (buf.duration); buf.duration = VasEBoot_le_to_cpu16 (buf.duration);
if (play (tempo, &buf)) if (play (tempo, &buf))
break; break;
} }
grub_file_close (file); VasEBoot_file_close (file);
} }
else else
{ {
@ -137,38 +137,38 @@ grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
struct note note; struct note note;
int i; int i;
tempo = grub_strtoul (args[0], &end, 0); tempo = VasEBoot_strtoul (args[0], &end, 0);
if (!tempo) if (!tempo)
{ {
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Invalid tempo in %s"), VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, N_("Invalid tempo in %s"),
args[0]); args[0]);
return grub_errno; return VasEBoot_errno;
} }
if (*end) if (*end)
/* Was not a number either, assume it was supposed to be a file name. */ /* Was not a number either, assume it was supposed to be a file name. */
return grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), args[0]); return VasEBoot_error (VasEBoot_ERR_FILE_NOT_FOUND, N_("file `%s' not found"), args[0]);
grub_dprintf ("play","tempo = %d\n", tempo); VasEBoot_dprintf ("play","tempo = %d\n", tempo);
for (i = 1; i + 1 < argc; i += 2) for (i = 1; i + 1 < argc; i += 2)
{ {
note.pitch = grub_strtoul (args[i], &end, 0); note.pitch = VasEBoot_strtoul (args[i], &end, 0);
if (grub_errno) if (VasEBoot_errno)
break; break;
if (*end) if (*end)
{ {
grub_error (GRUB_ERR_BAD_NUMBER, N_("unrecognized number")); VasEBoot_error (VasEBoot_ERR_BAD_NUMBER, N_("unrecognized number"));
break; break;
} }
note.duration = grub_strtoul (args[i + 1], &end, 0); note.duration = VasEBoot_strtoul (args[i + 1], &end, 0);
if (grub_errno) if (VasEBoot_errno)
break; break;
if (*end) if (*end)
{ {
grub_error (GRUB_ERR_BAD_NUMBER, N_("unrecognized number")); VasEBoot_error (VasEBoot_ERR_BAD_NUMBER, N_("unrecognized number"));
break; break;
} }
@ -177,21 +177,21 @@ grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
} }
} }
grub_speaker_beep_off (); VasEBoot_speaker_beep_off ();
return 0; return 0;
} }
static grub_command_t cmd; static VasEBoot_command_t cmd;
GRUB_MOD_INIT(play) VasEBoot_MOD_INIT(play)
{ {
cmd = grub_register_command ("play", grub_cmd_play, cmd = VasEBoot_register_command ("play", VasEBoot_cmd_play,
N_("FILE | TEMPO [PITCH1 DURATION1] [PITCH2 DURATION2] ... "), N_("FILE | TEMPO [PITCH1 DURATION1] [PITCH2 DURATION2] ... "),
N_("Play a tune.")); N_("Play a tune."));
} }
GRUB_MOD_FINI(play) VasEBoot_MOD_FINI(play)
{ {
grub_unregister_command (cmd); VasEBoot_unregister_command (cmd);
} }

View File

@ -1,6 +1,6 @@
/* sendkey.c - fake keystroke. */ /* sendkey.c - fake keystroke. */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc. * Copyright (C) 2009 Free Software Foundation, Inc.
* *
* This program is free software; you can redistribute it and/or modify * This program is free software; you can redistribute it and/or modify
@ -18,23 +18,23 @@
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/ */
#include <grub/types.h> #include <VasEBoot/types.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/mm.h> #include <VasEBoot/mm.h>
#include <grub/err.h> #include <VasEBoot/err.h>
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/extcmd.h> #include <VasEBoot/extcmd.h>
#include <grub/cpu/io.h> #include <VasEBoot/cpu/io.h>
#include <grub/loader.h> #include <VasEBoot/loader.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
GRUB_MOD_LICENSE ("GPLv2+"); VasEBoot_MOD_LICENSE ("GPLv2+");
static char sendkey[0x20]; static char sendkey[0x20];
/* Length of sendkey. */ /* Length of sendkey. */
static int keylen = 0; static int keylen = 0;
static int noled = 0; static int noled = 0;
static const struct grub_arg_option options[] = static const struct VasEBoot_arg_option options[] =
{ {
{"num", 'n', 0, N_("set numlock mode"), "[on|off]", ARG_TYPE_STRING}, {"num", 'n', 0, N_("set numlock mode"), "[on|off]", ARG_TYPE_STRING},
{"caps", 'c', 0, N_("set capslock mode"), "[on|off]", ARG_TYPE_STRING}, {"caps", 'c', 0, N_("set capslock mode"), "[on|off]", ARG_TYPE_STRING},
@ -58,7 +58,7 @@ static const struct grub_arg_option options[] =
static int simple_flag_offsets[] static int simple_flag_offsets[]
= {5, 6, 4, 7, 11, 1, 0, 10, 13, 14, 12, 15, 9, 3, 8, 2}; = {5, 6, 4, 7, 11, 1, 0, 10, 13, 14, 12, 15, 9, 3, 8, 2};
static grub_uint32_t andmask = 0xffffffff, ormask = 0; static VasEBoot_uint32_t andmask = 0xffffffff, ormask = 0;
struct struct
keysym keysym
@ -71,7 +71,7 @@ keysym
}; };
/* The table for key symbols. If the "shifted" member of an entry is /* The table for key symbols. If the "shifted" member of an entry is
NULL, the entry does not have shifted state. Copied from GRUB Legacy setkey fuction */ NULL, the entry does not have shifted state. Copied from VasEBoot Legacy setkey fuction */
static struct keysym keysym_table[] = static struct keysym keysym_table[] =
{ {
{"escape", 0, 0x1b, 0, 0x01}, {"escape", 0, 0x1b, 0, 0x01},
@ -176,7 +176,7 @@ static struct keysym keysym_table[] =
OP - action id OP - action id
*/ */
static void static void
grub_sendkey_set_simple_flag (int outoffset, int op) VasEBoot_sendkey_set_simple_flag (int outoffset, int op)
{ {
if (op == 2) if (op == 2)
{ {
@ -194,51 +194,51 @@ grub_sendkey_set_simple_flag (int outoffset, int op)
} }
static int static int
grub_sendkey_parse_op (struct grub_arg_list state) VasEBoot_sendkey_parse_op (struct VasEBoot_arg_list state)
{ {
if (! state.set) if (! state.set)
return 2; return 2;
if (grub_strcmp (state.arg, "off") == 0 || grub_strcmp (state.arg, "0") == 0 if (VasEBoot_strcmp (state.arg, "off") == 0 || VasEBoot_strcmp (state.arg, "0") == 0
|| grub_strcmp (state.arg, "unpress") == 0) || VasEBoot_strcmp (state.arg, "unpress") == 0)
return 0; return 0;
if (grub_strcmp (state.arg, "on") == 0 || grub_strcmp (state.arg, "1") == 0 if (VasEBoot_strcmp (state.arg, "on") == 0 || VasEBoot_strcmp (state.arg, "1") == 0
|| grub_strcmp (state.arg, "press") == 0) || VasEBoot_strcmp (state.arg, "press") == 0)
return 1; return 1;
return 2; return 2;
} }
static grub_uint32_t oldflags; static VasEBoot_uint32_t oldflags;
static grub_err_t static VasEBoot_err_t
grub_sendkey_postboot (void) VasEBoot_sendkey_postboot (void)
{ {
/* For convention: pointer to flags. */ /* For convention: pointer to flags. */
grub_uint32_t *flags = (grub_uint32_t *) 0x417; VasEBoot_uint32_t *flags = (VasEBoot_uint32_t *) 0x417;
*flags = oldflags; *flags = oldflags;
*((char *) 0x41a) = 0x1e; *((char *) 0x41a) = 0x1e;
*((char *) 0x41c) = 0x1e; *((char *) 0x41c) = 0x1e;
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
} }
/* Set keyboard buffer to our sendkey */ /* Set keyboard buffer to our sendkey */
static grub_err_t static VasEBoot_err_t
grub_sendkey_preboot (int noret __attribute__ ((unused))) VasEBoot_sendkey_preboot (int noret __attribute__ ((unused)))
{ {
/* For convention: pointer to flags. */ /* For convention: pointer to flags. */
grub_uint32_t *flags = (grub_uint32_t *) 0x417; VasEBoot_uint32_t *flags = (VasEBoot_uint32_t *) 0x417;
oldflags = *flags; oldflags = *flags;
/* Set the sendkey. */ /* Set the sendkey. */
*((char *) 0x41a) = 0x1e; *((char *) 0x41a) = 0x1e;
*((char *) 0x41c) = keylen + 0x1e; *((char *) 0x41c) = keylen + 0x1e;
grub_memcpy ((char *) 0x41e, sendkey, 0x20); VasEBoot_memcpy ((char *) 0x41e, sendkey, 0x20);
/* Transform "any ctrl" to "right ctrl" flag. */ /* Transform "any ctrl" to "right ctrl" flag. */
if (*flags & (1 << 8)) if (*flags & (1 << 8))
@ -268,25 +268,25 @@ grub_sendkey_preboot (int noret __attribute__ ((unused)))
{ {
value = 0; value = 0;
/* Send command change LEDs */ /* Send command change LEDs */
grub_outb (0xed, 0x60); VasEBoot_outb (0xed, 0x60);
/* Wait */ /* Wait */
do do
value = grub_inb (0x60); value = VasEBoot_inb (0x60);
while ((value != 0xfa) && (value != 0xfe)); while ((value != 0xfa) && (value != 0xfe));
if (value == 0xfa) if (value == 0xfa)
{ {
/* Set new LEDs*/ /* Set new LEDs*/
grub_outb ((*flags >> 4) & 7, 0x60); VasEBoot_outb ((*flags >> 4) & 7, 0x60);
break; break;
} }
} }
} }
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
} }
/* Helper for grub_cmd_sendkey. */ /* Helper for VasEBoot_cmd_sendkey. */
static int static int
find_key_code (char *key) find_key_code (char *key)
{ {
@ -295,17 +295,17 @@ find_key_code (char *key)
for (i = 0; i < ARRAY_SIZE(keysym_table); i++) for (i = 0; i < ARRAY_SIZE(keysym_table); i++)
{ {
if (keysym_table[i].unshifted_name if (keysym_table[i].unshifted_name
&& grub_strcmp (key, keysym_table[i].unshifted_name) == 0) && VasEBoot_strcmp (key, keysym_table[i].unshifted_name) == 0)
return keysym_table[i].keycode; return keysym_table[i].keycode;
else if (keysym_table[i].shifted_name else if (keysym_table[i].shifted_name
&& grub_strcmp (key, keysym_table[i].shifted_name) == 0) && VasEBoot_strcmp (key, keysym_table[i].shifted_name) == 0)
return keysym_table[i].keycode; return keysym_table[i].keycode;
} }
return 0; return 0;
} }
/* Helper for grub_cmd_sendkey. */ /* Helper for VasEBoot_cmd_sendkey. */
static int static int
find_ascii_code (char *key) find_ascii_code (char *key)
{ {
@ -314,20 +314,20 @@ find_ascii_code (char *key)
for (i = 0; i < ARRAY_SIZE(keysym_table); i++) for (i = 0; i < ARRAY_SIZE(keysym_table); i++)
{ {
if (keysym_table[i].unshifted_name if (keysym_table[i].unshifted_name
&& grub_strcmp (key, keysym_table[i].unshifted_name) == 0) && VasEBoot_strcmp (key, keysym_table[i].unshifted_name) == 0)
return keysym_table[i].unshifted_ascii; return keysym_table[i].unshifted_ascii;
else if (keysym_table[i].shifted_name else if (keysym_table[i].shifted_name
&& grub_strcmp (key, keysym_table[i].shifted_name) == 0) && VasEBoot_strcmp (key, keysym_table[i].shifted_name) == 0)
return keysym_table[i].shifted_ascii; return keysym_table[i].shifted_ascii;
} }
return 0; return 0;
} }
static grub_err_t static VasEBoot_err_t
grub_cmd_sendkey (grub_extcmd_context_t ctxt, int argc, char **args) VasEBoot_cmd_sendkey (VasEBoot_extcmd_context_t ctxt, int argc, char **args)
{ {
struct grub_arg_list *state = ctxt->state; struct VasEBoot_arg_list *state = ctxt->state;
andmask = 0xffffffff; andmask = 0xffffffff;
ormask = 0; ormask = 0;
@ -353,35 +353,35 @@ grub_cmd_sendkey (grub_extcmd_context_t ctxt, int argc, char **args)
{ {
unsigned i; unsigned i;
for (i = 0; i < ARRAY_SIZE(simple_flag_offsets); i++) for (i = 0; i < ARRAY_SIZE(simple_flag_offsets); i++)
grub_sendkey_set_simple_flag (simple_flag_offsets[i], VasEBoot_sendkey_set_simple_flag (simple_flag_offsets[i],
grub_sendkey_parse_op(state[i])); VasEBoot_sendkey_parse_op(state[i]));
} }
/* Set noled. */ /* Set noled. */
noled = (state[ARRAY_SIZE(simple_flag_offsets)].set); noled = (state[ARRAY_SIZE(simple_flag_offsets)].set);
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
} }
static grub_extcmd_t cmd; static VasEBoot_extcmd_t cmd;
static struct grub_preboot *preboot_hook; static struct VasEBoot_preboot *preboot_hook;
GRUB_MOD_INIT (sendkey) VasEBoot_MOD_INIT (sendkey)
{ {
cmd = grub_register_extcmd ("sendkey", grub_cmd_sendkey, 0, cmd = VasEBoot_register_extcmd ("sendkey", VasEBoot_cmd_sendkey, 0,
N_("[KEYSTROKE1] [KEYSTROKE2] ..."), N_("[KEYSTROKE1] [KEYSTROKE2] ..."),
/* TRANSLATORS: It can emulate multiple /* TRANSLATORS: It can emulate multiple
keypresses. */ keypresses. */
N_("Emulate a keystroke sequence"), options); N_("Emulate a keystroke sequence"), options);
preboot_hook preboot_hook
= grub_loader_register_preboot_hook (grub_sendkey_preboot, = VasEBoot_loader_register_preboot_hook (VasEBoot_sendkey_preboot,
grub_sendkey_postboot, VasEBoot_sendkey_postboot,
GRUB_LOADER_PREBOOT_HOOK_PRIO_CONSOLE); VasEBoot_LOADER_PREBOOT_HOOK_PRIO_CONSOLE);
} }
GRUB_MOD_FINI (sendkey) VasEBoot_MOD_FINI (sendkey)
{ {
grub_unregister_extcmd (cmd); VasEBoot_unregister_extcmd (cmd);
grub_loader_unregister_preboot_hook (preboot_hook); VasEBoot_loader_unregister_preboot_hook (preboot_hook);
} }

View File

@ -1,50 +1,50 @@
/* smbios.c - get smbios tables. */ /* smbios.c - get smbios tables. */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2015 Free Software Foundation, Inc. * Copyright (C) 2015 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/acpi.h> #include <VasEBoot/acpi.h>
#include <grub/smbios.h> #include <VasEBoot/smbios.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
struct grub_smbios_eps * struct VasEBoot_smbios_eps *
grub_machine_smbios_get_eps (void) VasEBoot_machine_smbios_get_eps (void)
{ {
grub_uint8_t *ptr; VasEBoot_uint8_t *ptr;
grub_dprintf ("smbios", "Looking for SMBIOS EPS. Scanning BIOS\n"); VasEBoot_dprintf ("smbios", "Looking for SMBIOS EPS. Scanning BIOS\n");
for (ptr = (grub_uint8_t *) 0xf0000; ptr < (grub_uint8_t *) 0x100000; for (ptr = (VasEBoot_uint8_t *) 0xf0000; ptr < (VasEBoot_uint8_t *) 0x100000;
ptr += 16) ptr += 16)
if (grub_memcmp (ptr, "_SM_", 4) == 0 if (VasEBoot_memcmp (ptr, "_SM_", 4) == 0
&& grub_byte_checksum (ptr, sizeof (struct grub_smbios_eps)) == 0) && VasEBoot_byte_checksum (ptr, sizeof (struct VasEBoot_smbios_eps)) == 0)
return (struct grub_smbios_eps *) ptr; return (struct VasEBoot_smbios_eps *) ptr;
return 0; return 0;
} }
struct grub_smbios_eps3 * struct VasEBoot_smbios_eps3 *
grub_machine_smbios_get_eps3 (void) VasEBoot_machine_smbios_get_eps3 (void)
{ {
grub_uint8_t *ptr; VasEBoot_uint8_t *ptr;
grub_dprintf ("smbios", "Looking for SMBIOS3 EPS. Scanning BIOS\n"); VasEBoot_dprintf ("smbios", "Looking for SMBIOS3 EPS. Scanning BIOS\n");
for (ptr = (grub_uint8_t *) 0xf0000; ptr < (grub_uint8_t *) 0x100000; for (ptr = (VasEBoot_uint8_t *) 0xf0000; ptr < (VasEBoot_uint8_t *) 0x100000;
ptr += 16) ptr += 16)
if (grub_memcmp (ptr, "_SM3_", 5) == 0 if (VasEBoot_memcmp (ptr, "_SM3_", 5) == 0
&& grub_byte_checksum (ptr, sizeof (struct grub_smbios_eps3)) == 0) && VasEBoot_byte_checksum (ptr, sizeof (struct VasEBoot_smbios_eps3)) == 0)
return (struct grub_smbios_eps3 *) ptr; return (struct VasEBoot_smbios_eps3 *) ptr;
return 0; return 0;
} }

View File

@ -1,51 +1,51 @@
/* suspend.c - command to suspend GRUB and return to Open Firmware */ /* suspend.c - command to suspend VasEBoot and return to Open Firmware */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2005,2007 Free Software Foundation, Inc. * Copyright (C) 2005,2007 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/term.h> #include <VasEBoot/term.h>
#include <grub/ieee1275/ieee1275.h> #include <VasEBoot/ieee1275/ieee1275.h>
#include <grub/command.h> #include <VasEBoot/command.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static grub_err_t static VasEBoot_err_t
grub_cmd_suspend (grub_command_t cmd __attribute__ ((unused)), VasEBoot_cmd_suspend (VasEBoot_command_t cmd __attribute__ ((unused)),
int argc __attribute__ ((unused)), int argc __attribute__ ((unused)),
char **args __attribute__ ((unused))) char **args __attribute__ ((unused)))
{ {
grub_puts_ (N_("Run `go' to resume GRUB.")); VasEBoot_puts_ (N_("Run `go' to resume VasEBoot."));
grub_ieee1275_enter (); VasEBoot_ieee1275_enter ();
grub_cls (); VasEBoot_cls ();
return 0; return 0;
} }
static grub_command_t cmd; static VasEBoot_command_t cmd;
GRUB_MOD_INIT(ieee1275_suspend) VasEBoot_MOD_INIT(ieee1275_suspend)
{ {
cmd = grub_register_command ("suspend", grub_cmd_suspend, cmd = VasEBoot_register_command ("suspend", VasEBoot_cmd_suspend,
0, N_("Return to IEEE1275 prompt.")); 0, N_("Return to IEEE1275 prompt."));
} }
GRUB_MOD_FINI(ieee1275_suspend) VasEBoot_MOD_FINI(ieee1275_suspend)
{ {
grub_unregister_command (cmd); VasEBoot_unregister_command (cmd);
} }

View File

@ -1,35 +1,35 @@
/* memrw.c - command to read / write physical memory */ /* memrw.c - command to read / write physical memory */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc. * Copyright (C) 2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/extcmd.h> #include <VasEBoot/extcmd.h>
#include <grub/env.h> #include <VasEBoot/env.h>
#include <grub/cpu/io.h> #include <VasEBoot/cpu/io.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static grub_extcmd_t cmd_read_byte, cmd_read_word, cmd_read_dword; static VasEBoot_extcmd_t cmd_read_byte, cmd_read_word, cmd_read_dword;
static grub_command_t cmd_write_byte, cmd_write_word, cmd_write_dword; static VasEBoot_command_t cmd_write_byte, cmd_write_word, cmd_write_dword;
static const struct grub_arg_option options[] = static const struct VasEBoot_arg_option options[] =
{ {
{0, 'v', 0, N_("Save read value into variable VARNAME."), {0, 'v', 0, N_("Save read value into variable VARNAME."),
N_("VARNAME"), ARG_TYPE_STRING}, N_("VARNAME"), ARG_TYPE_STRING},
@ -37,119 +37,119 @@ static const struct grub_arg_option options[] =
}; };
static grub_err_t static VasEBoot_err_t
grub_cmd_read (grub_extcmd_context_t ctxt, int argc, char **argv) VasEBoot_cmd_read (VasEBoot_extcmd_context_t ctxt, int argc, char **argv)
{ {
grub_port_t addr; VasEBoot_port_t addr;
grub_uint32_t value = 0; VasEBoot_uint32_t value = 0;
if (argc != 1) if (argc != 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("one argument expected")); return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, N_("one argument expected"));
addr = grub_strtoul (argv[0], 0, 0); addr = VasEBoot_strtoul (argv[0], 0, 0);
switch (ctxt->extcmd->cmd->name[sizeof ("in") - 1]) switch (ctxt->extcmd->cmd->name[sizeof ("in") - 1])
{ {
case 'l': case 'l':
value = grub_inl (addr); value = VasEBoot_inl (addr);
break; break;
case 'w': case 'w':
value = grub_inw (addr); value = VasEBoot_inw (addr);
break; break;
case 'b': case 'b':
value = grub_inb (addr); value = VasEBoot_inb (addr);
break; break;
} }
if (ctxt->state[0].set) if (ctxt->state[0].set)
{ {
char buf[sizeof ("XXXXXXXX")]; char buf[sizeof ("XXXXXXXX")];
grub_snprintf (buf, sizeof (buf), "%x", value); VasEBoot_snprintf (buf, sizeof (buf), "%x", value);
grub_env_set (ctxt->state[0].arg, buf); VasEBoot_env_set (ctxt->state[0].arg, buf);
} }
else else
grub_printf ("0x%x\n", value); VasEBoot_printf ("0x%x\n", value);
return 0; return 0;
} }
static grub_err_t static VasEBoot_err_t
grub_cmd_write (grub_command_t cmd, int argc, char **argv) VasEBoot_cmd_write (VasEBoot_command_t cmd, int argc, char **argv)
{ {
grub_port_t addr; VasEBoot_port_t addr;
grub_uint32_t value; VasEBoot_uint32_t value;
grub_uint32_t mask = 0xffffffff; VasEBoot_uint32_t mask = 0xffffffff;
if (argc != 2 && argc != 3) if (argc != 2 && argc != 3)
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("two arguments expected")); return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, N_("two arguments expected"));
addr = grub_strtoul (argv[0], 0, 0); addr = VasEBoot_strtoul (argv[0], 0, 0);
value = grub_strtoul (argv[1], 0, 0); value = VasEBoot_strtoul (argv[1], 0, 0);
if (argc == 3) if (argc == 3)
mask = grub_strtoul (argv[2], 0, 0); mask = VasEBoot_strtoul (argv[2], 0, 0);
value &= mask; value &= mask;
switch (cmd->name[sizeof ("out") - 1]) switch (cmd->name[sizeof ("out") - 1])
{ {
case 'l': case 'l':
if (mask != 0xffffffff) if (mask != 0xffffffff)
grub_outl ((grub_inl (addr) & ~mask) | value, addr); VasEBoot_outl ((VasEBoot_inl (addr) & ~mask) | value, addr);
else else
grub_outl (value, addr); VasEBoot_outl (value, addr);
break; break;
case 'w': case 'w':
if ((mask & 0xffff) != 0xffff) if ((mask & 0xffff) != 0xffff)
grub_outw ((grub_inw (addr) & ~mask) | value, addr); VasEBoot_outw ((VasEBoot_inw (addr) & ~mask) | value, addr);
else else
grub_outw (value, addr); VasEBoot_outw (value, addr);
break; break;
case 'b': case 'b':
if ((mask & 0xff) != 0xff) if ((mask & 0xff) != 0xff)
grub_outb ((grub_inb (addr) & ~mask) | value, addr); VasEBoot_outb ((VasEBoot_inb (addr) & ~mask) | value, addr);
else else
grub_outb (value, addr); VasEBoot_outb (value, addr);
break; break;
} }
return 0; return 0;
} }
GRUB_MOD_INIT(memrw) VasEBoot_MOD_INIT(memrw)
{ {
cmd_read_byte = cmd_read_byte =
grub_register_extcmd ("inb", grub_cmd_read, 0, VasEBoot_register_extcmd ("inb", VasEBoot_cmd_read, 0,
N_("PORT"), N_("Read 8-bit value from PORT."), N_("PORT"), N_("Read 8-bit value from PORT."),
options); options);
cmd_read_word = cmd_read_word =
grub_register_extcmd ("inw", grub_cmd_read, 0, VasEBoot_register_extcmd ("inw", VasEBoot_cmd_read, 0,
N_("PORT"), N_("Read 16-bit value from PORT."), N_("PORT"), N_("Read 16-bit value from PORT."),
options); options);
cmd_read_dword = cmd_read_dword =
grub_register_extcmd ("inl", grub_cmd_read, 0, VasEBoot_register_extcmd ("inl", VasEBoot_cmd_read, 0,
N_("PORT"), N_("Read 32-bit value from PORT."), N_("PORT"), N_("Read 32-bit value from PORT."),
options); options);
cmd_write_byte = cmd_write_byte =
grub_register_command ("outb", grub_cmd_write, VasEBoot_register_command ("outb", VasEBoot_cmd_write,
N_("PORT VALUE [MASK]"), N_("PORT VALUE [MASK]"),
N_("Write 8-bit VALUE to PORT.")); N_("Write 8-bit VALUE to PORT."));
cmd_write_word = cmd_write_word =
grub_register_command ("outw", grub_cmd_write, VasEBoot_register_command ("outw", VasEBoot_cmd_write,
N_("PORT VALUE [MASK]"), N_("PORT VALUE [MASK]"),
N_("Write 16-bit VALUE to PORT.")); N_("Write 16-bit VALUE to PORT."));
cmd_write_dword = cmd_write_dword =
grub_register_command ("outl", grub_cmd_write, VasEBoot_register_command ("outl", VasEBoot_cmd_write,
N_("ADDR VALUE [MASK]"), N_("ADDR VALUE [MASK]"),
N_("Write 32-bit VALUE to PORT.")); N_("Write 32-bit VALUE to PORT."));
} }
GRUB_MOD_FINI(memrw) VasEBoot_MOD_FINI(memrw)
{ {
grub_unregister_extcmd (cmd_read_byte); VasEBoot_unregister_extcmd (cmd_read_byte);
grub_unregister_extcmd (cmd_read_word); VasEBoot_unregister_extcmd (cmd_read_word);
grub_unregister_extcmd (cmd_read_dword); VasEBoot_unregister_extcmd (cmd_read_dword);
grub_unregister_command (cmd_write_byte); VasEBoot_unregister_command (cmd_write_byte);
grub_unregister_command (cmd_write_word); VasEBoot_unregister_command (cmd_write_word);
grub_unregister_command (cmd_write_dword); VasEBoot_unregister_command (cmd_write_dword);
} }

View File

@ -1,36 +1,36 @@
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2002,2003,2005,2007,2008,2009 Free Software Foundation, Inc. * Copyright (C) 2002,2003,2005,2007,2008,2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/term.h> #include <VasEBoot/term.h>
#include <grub/err.h> #include <VasEBoot/err.h>
#include <grub/mm.h> #include <VasEBoot/mm.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/env.h> #include <VasEBoot/env.h>
#include <grub/time.h> #include <VasEBoot/time.h>
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/keyboard_layouts.h> #include <VasEBoot/keyboard_layouts.h>
#include <grub/command.h> #include <VasEBoot/command.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
#include <grub/file.h> #include <VasEBoot/file.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static struct grub_keyboard_layout layout_us = { static struct VasEBoot_keyboard_layout layout_us = {
.keyboard_map = { .keyboard_map = {
/* Keyboard errors. Handled by driver. */ /* Keyboard errors. Handled by driver. */
/* 0x00 */ 0, 0, 0, 0, /* 0x00 */ 0, 0, 0, 0,
@ -47,30 +47,30 @@ static struct grub_keyboard_layout layout_us = {
*/ */
/* 0x30 */ ']', 0, '\\', ';', '\'', '`', ',', '.', /* 0x30 */ ']', 0, '\\', ';', '\'', '`', ',', '.',
/* 0x39 is CapsLock. Handled by driver. */ /* 0x39 is CapsLock. Handled by driver. */
/* 0x38 */ '/', 0, GRUB_TERM_KEY_F1, GRUB_TERM_KEY_F2, /* 0x38 */ '/', 0, VasEBoot_TERM_KEY_F1, VasEBoot_TERM_KEY_F2,
/* 0x3c */ GRUB_TERM_KEY_F3, GRUB_TERM_KEY_F4, /* 0x3c */ VasEBoot_TERM_KEY_F3, VasEBoot_TERM_KEY_F4,
/* 0x3e */ GRUB_TERM_KEY_F5, GRUB_TERM_KEY_F6, /* 0x3e */ VasEBoot_TERM_KEY_F5, VasEBoot_TERM_KEY_F6,
/* 0x40 */ GRUB_TERM_KEY_F7, GRUB_TERM_KEY_F8, /* 0x40 */ VasEBoot_TERM_KEY_F7, VasEBoot_TERM_KEY_F8,
/* 0x42 */ GRUB_TERM_KEY_F9, GRUB_TERM_KEY_F10, /* 0x42 */ VasEBoot_TERM_KEY_F9, VasEBoot_TERM_KEY_F10,
/* 0x44 */ GRUB_TERM_KEY_F11, GRUB_TERM_KEY_F12, /* 0x44 */ VasEBoot_TERM_KEY_F11, VasEBoot_TERM_KEY_F12,
/* PrtScr and ScrollLock. Not handled yet. */ /* PrtScr and ScrollLock. Not handled yet. */
/* 0x46 */ 0, 0, /* 0x46 */ 0, 0,
/* 0x48 is Pause. Not handled yet. */ /* 0x48 is Pause. Not handled yet. */
/* 0x48 */ 0, GRUB_TERM_KEY_INSERT, /* 0x48 */ 0, VasEBoot_TERM_KEY_INSERT,
/* 0x4a */ GRUB_TERM_KEY_HOME, GRUB_TERM_KEY_PPAGE, /* 0x4a */ VasEBoot_TERM_KEY_HOME, VasEBoot_TERM_KEY_PPAGE,
/* 0x4c */ GRUB_TERM_KEY_DC, GRUB_TERM_KEY_END, /* 0x4c */ VasEBoot_TERM_KEY_DC, VasEBoot_TERM_KEY_END,
/* 0x4e */ GRUB_TERM_KEY_NPAGE, GRUB_TERM_KEY_RIGHT, /* 0x4e */ VasEBoot_TERM_KEY_NPAGE, VasEBoot_TERM_KEY_RIGHT,
/* 0x50 */ GRUB_TERM_KEY_LEFT, GRUB_TERM_KEY_DOWN, /* 0x50 */ VasEBoot_TERM_KEY_LEFT, VasEBoot_TERM_KEY_DOWN,
/* 0x53 is NumLock. Handled by driver. */ /* 0x53 is NumLock. Handled by driver. */
/* 0x52 */ GRUB_TERM_KEY_UP, 0, /* 0x52 */ VasEBoot_TERM_KEY_UP, 0,
/* 0x54 */ '/', '*', /* 0x54 */ '/', '*',
/* 0x56 */ '-', '+', /* 0x56 */ '-', '+',
/* 0x58 */ '\n', GRUB_TERM_KEY_END, /* 0x58 */ '\n', VasEBoot_TERM_KEY_END,
/* 0x5a */ GRUB_TERM_KEY_DOWN, GRUB_TERM_KEY_NPAGE, /* 0x5a */ VasEBoot_TERM_KEY_DOWN, VasEBoot_TERM_KEY_NPAGE,
/* 0x5c */ GRUB_TERM_KEY_LEFT, GRUB_TERM_KEY_CENTER, /* 0x5c */ VasEBoot_TERM_KEY_LEFT, VasEBoot_TERM_KEY_CENTER,
/* 0x5e */ GRUB_TERM_KEY_RIGHT, GRUB_TERM_KEY_HOME, /* 0x5e */ VasEBoot_TERM_KEY_RIGHT, VasEBoot_TERM_KEY_HOME,
/* 0x60 */ GRUB_TERM_KEY_UP, GRUB_TERM_KEY_PPAGE, /* 0x60 */ VasEBoot_TERM_KEY_UP, VasEBoot_TERM_KEY_PPAGE,
/* 0x62 */ GRUB_TERM_KEY_INSERT, GRUB_TERM_KEY_DC, /* 0x62 */ VasEBoot_TERM_KEY_INSERT, VasEBoot_TERM_KEY_DC,
/* 0x64 */ '\\' /* 0x64 */ '\\'
}, },
.keyboard_map_shift = { .keyboard_map_shift = {
@ -82,9 +82,9 @@ static struct grub_keyboard_layout layout_us = {
/* 0x10 */ 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', /* 0x10 */ 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
/* 0x18 */ 'U', 'V', 'W', 'X', 'Y', 'Z', '!', '@', /* 0x18 */ 'U', 'V', 'W', 'X', 'Y', 'Z', '!', '@',
/* 0x20 */ '#', '$', '%', '^', '&', '*', '(', ')', /* 0x20 */ '#', '$', '%', '^', '&', '*', '(', ')',
/* 0x28 */ '\n' | GRUB_TERM_SHIFT, '\e' | GRUB_TERM_SHIFT, /* 0x28 */ '\n' | VasEBoot_TERM_SHIFT, '\e' | VasEBoot_TERM_SHIFT,
/* 0x2a */ '\b' | GRUB_TERM_SHIFT, '\t' | GRUB_TERM_SHIFT, /* 0x2a */ '\b' | VasEBoot_TERM_SHIFT, '\t' | VasEBoot_TERM_SHIFT,
/* 0x2c */ ' ' | GRUB_TERM_SHIFT, '_', '+', '{', /* 0x2c */ ' ' | VasEBoot_TERM_SHIFT, '_', '+', '{',
/* According to usage table 0x31 should be mapped to '/' /* According to usage table 0x31 should be mapped to '/'
but testing with real keyboard shows that 0x32 is remapped to '/'. but testing with real keyboard shows that 0x32 is remapped to '/'.
Map 0x31 to 0. Map 0x31 to 0.
@ -92,93 +92,93 @@ static struct grub_keyboard_layout layout_us = {
/* 0x30 */ '}', 0, '|', ':', '"', '~', '<', '>', /* 0x30 */ '}', 0, '|', ':', '"', '~', '<', '>',
/* 0x39 is CapsLock. Handled by driver. */ /* 0x39 is CapsLock. Handled by driver. */
/* 0x38 */ '?', 0, /* 0x38 */ '?', 0,
/* 0x3a */ GRUB_TERM_KEY_F1 | GRUB_TERM_SHIFT, /* 0x3a */ VasEBoot_TERM_KEY_F1 | VasEBoot_TERM_SHIFT,
/* 0x3b */ GRUB_TERM_KEY_F2 | GRUB_TERM_SHIFT, /* 0x3b */ VasEBoot_TERM_KEY_F2 | VasEBoot_TERM_SHIFT,
/* 0x3c */ GRUB_TERM_KEY_F3 | GRUB_TERM_SHIFT, /* 0x3c */ VasEBoot_TERM_KEY_F3 | VasEBoot_TERM_SHIFT,
/* 0x3d */ GRUB_TERM_KEY_F4 | GRUB_TERM_SHIFT, /* 0x3d */ VasEBoot_TERM_KEY_F4 | VasEBoot_TERM_SHIFT,
/* 0x3e */ GRUB_TERM_KEY_F5 | GRUB_TERM_SHIFT, /* 0x3e */ VasEBoot_TERM_KEY_F5 | VasEBoot_TERM_SHIFT,
/* 0x3f */ GRUB_TERM_KEY_F6 | GRUB_TERM_SHIFT, /* 0x3f */ VasEBoot_TERM_KEY_F6 | VasEBoot_TERM_SHIFT,
/* 0x40 */ GRUB_TERM_KEY_F7 | GRUB_TERM_SHIFT, /* 0x40 */ VasEBoot_TERM_KEY_F7 | VasEBoot_TERM_SHIFT,
/* 0x41 */ GRUB_TERM_KEY_F8 | GRUB_TERM_SHIFT, /* 0x41 */ VasEBoot_TERM_KEY_F8 | VasEBoot_TERM_SHIFT,
/* 0x42 */ GRUB_TERM_KEY_F9 | GRUB_TERM_SHIFT, /* 0x42 */ VasEBoot_TERM_KEY_F9 | VasEBoot_TERM_SHIFT,
/* 0x43 */ GRUB_TERM_KEY_F10 | GRUB_TERM_SHIFT, /* 0x43 */ VasEBoot_TERM_KEY_F10 | VasEBoot_TERM_SHIFT,
/* 0x44 */ GRUB_TERM_KEY_F11 | GRUB_TERM_SHIFT, /* 0x44 */ VasEBoot_TERM_KEY_F11 | VasEBoot_TERM_SHIFT,
/* 0x45 */ GRUB_TERM_KEY_F12 | GRUB_TERM_SHIFT, /* 0x45 */ VasEBoot_TERM_KEY_F12 | VasEBoot_TERM_SHIFT,
/* PrtScr and ScrollLock. Not handled yet. */ /* PrtScr and ScrollLock. Not handled yet. */
/* 0x46 */ 0, 0, /* 0x46 */ 0, 0,
/* 0x48 is Pause. Not handled yet. */ /* 0x48 is Pause. Not handled yet. */
/* 0x48 */ 0, GRUB_TERM_KEY_INSERT | GRUB_TERM_SHIFT, /* 0x48 */ 0, VasEBoot_TERM_KEY_INSERT | VasEBoot_TERM_SHIFT,
/* 0x4a */ GRUB_TERM_KEY_HOME | GRUB_TERM_SHIFT, /* 0x4a */ VasEBoot_TERM_KEY_HOME | VasEBoot_TERM_SHIFT,
/* 0x4b */ GRUB_TERM_KEY_PPAGE | GRUB_TERM_SHIFT, /* 0x4b */ VasEBoot_TERM_KEY_PPAGE | VasEBoot_TERM_SHIFT,
/* 0x4c */ GRUB_TERM_KEY_DC | GRUB_TERM_SHIFT, /* 0x4c */ VasEBoot_TERM_KEY_DC | VasEBoot_TERM_SHIFT,
/* 0x4d */ GRUB_TERM_KEY_END | GRUB_TERM_SHIFT, /* 0x4d */ VasEBoot_TERM_KEY_END | VasEBoot_TERM_SHIFT,
/* 0x4e */ GRUB_TERM_KEY_NPAGE | GRUB_TERM_SHIFT, /* 0x4e */ VasEBoot_TERM_KEY_NPAGE | VasEBoot_TERM_SHIFT,
/* 0x4f */ GRUB_TERM_KEY_RIGHT | GRUB_TERM_SHIFT, /* 0x4f */ VasEBoot_TERM_KEY_RIGHT | VasEBoot_TERM_SHIFT,
/* 0x50 */ GRUB_TERM_KEY_LEFT | GRUB_TERM_SHIFT, /* 0x50 */ VasEBoot_TERM_KEY_LEFT | VasEBoot_TERM_SHIFT,
/* 0x51 */ GRUB_TERM_KEY_DOWN | GRUB_TERM_SHIFT, /* 0x51 */ VasEBoot_TERM_KEY_DOWN | VasEBoot_TERM_SHIFT,
/* 0x53 is NumLock. Handled by driver. */ /* 0x53 is NumLock. Handled by driver. */
/* 0x52 */ GRUB_TERM_KEY_UP | GRUB_TERM_SHIFT, 0, /* 0x52 */ VasEBoot_TERM_KEY_UP | VasEBoot_TERM_SHIFT, 0,
/* 0x54 */ '/', '*', /* 0x54 */ '/', '*',
/* 0x56 */ '-', '+', /* 0x56 */ '-', '+',
/* 0x58 */ '\n' | GRUB_TERM_SHIFT, '1', '2', '3', '4', '5','6', '7', /* 0x58 */ '\n' | VasEBoot_TERM_SHIFT, '1', '2', '3', '4', '5','6', '7',
/* 0x60 */ '8', '9', '0', '.', '|' /* 0x60 */ '8', '9', '0', '.', '|'
} }
}; };
static struct grub_keyboard_layout *grub_current_layout = &layout_us; static struct VasEBoot_keyboard_layout *VasEBoot_current_layout = &layout_us;
static int static int
map_key_core (int code, int status, int *alt_gr_consumed) map_key_core (int code, int status, int *alt_gr_consumed)
{ {
*alt_gr_consumed = 0; *alt_gr_consumed = 0;
if (code >= GRUB_KEYBOARD_LAYOUTS_ARRAY_SIZE) if (code >= VasEBoot_KEYBOARD_LAYOUTS_ARRAY_SIZE)
return 0; return 0;
if (status & GRUB_TERM_STATUS_RALT) if (status & VasEBoot_TERM_STATUS_RALT)
{ {
if (status & (GRUB_TERM_STATUS_LSHIFT | GRUB_TERM_STATUS_RSHIFT)) if (status & (VasEBoot_TERM_STATUS_LSHIFT | VasEBoot_TERM_STATUS_RSHIFT))
{ {
if (grub_current_layout->keyboard_map_shift_l3[code]) if (VasEBoot_current_layout->keyboard_map_shift_l3[code])
{ {
*alt_gr_consumed = 1; *alt_gr_consumed = 1;
return grub_current_layout->keyboard_map_shift_l3[code]; return VasEBoot_current_layout->keyboard_map_shift_l3[code];
} }
} }
else if (grub_current_layout->keyboard_map_l3[code]) else if (VasEBoot_current_layout->keyboard_map_l3[code])
{ {
*alt_gr_consumed = 1; *alt_gr_consumed = 1;
return grub_current_layout->keyboard_map_l3[code]; return VasEBoot_current_layout->keyboard_map_l3[code];
} }
} }
if (status & (GRUB_TERM_STATUS_LSHIFT | GRUB_TERM_STATUS_RSHIFT)) if (status & (VasEBoot_TERM_STATUS_LSHIFT | VasEBoot_TERM_STATUS_RSHIFT))
return grub_current_layout->keyboard_map_shift[code]; return VasEBoot_current_layout->keyboard_map_shift[code];
else else
return grub_current_layout->keyboard_map[code]; return VasEBoot_current_layout->keyboard_map[code];
} }
unsigned unsigned
grub_term_map_key (grub_keyboard_key_t code, int status) VasEBoot_term_map_key (VasEBoot_keyboard_key_t code, int status)
{ {
int alt_gr_consumed = 0; int alt_gr_consumed = 0;
int key; int key;
if (code >= 0x59 && code <= 0x63 && (status & GRUB_TERM_STATUS_NUM)) if (code >= 0x59 && code <= 0x63 && (status & VasEBoot_TERM_STATUS_NUM))
{ {
if (status & (GRUB_TERM_STATUS_RSHIFT | GRUB_TERM_STATUS_LSHIFT)) if (status & (VasEBoot_TERM_STATUS_RSHIFT | VasEBoot_TERM_STATUS_LSHIFT))
status &= ~(GRUB_TERM_STATUS_RSHIFT | GRUB_TERM_STATUS_LSHIFT); status &= ~(VasEBoot_TERM_STATUS_RSHIFT | VasEBoot_TERM_STATUS_LSHIFT);
else else
status |= GRUB_TERM_STATUS_RSHIFT; status |= VasEBoot_TERM_STATUS_RSHIFT;
} }
key = map_key_core (code, status, &alt_gr_consumed); key = map_key_core (code, status, &alt_gr_consumed);
if (key == 0 || key == GRUB_TERM_SHIFT) { if (key == 0 || key == VasEBoot_TERM_SHIFT) {
grub_printf ("Unknown key 0x%x detected\n", code); VasEBoot_printf ("Unknown key 0x%x detected\n", code);
return GRUB_TERM_NO_KEY; return VasEBoot_TERM_NO_KEY;
} }
if (status & GRUB_TERM_STATUS_CAPS) if (status & VasEBoot_TERM_STATUS_CAPS)
{ {
if ((key >= 'a') && (key <= 'z')) if ((key >= 'a') && (key <= 'z'))
key += 'A' - 'a'; key += 'A' - 'a';
@ -186,122 +186,122 @@ grub_term_map_key (grub_keyboard_key_t code, int status)
key += 'a' - 'A'; key += 'a' - 'A';
} }
if ((status & GRUB_TERM_STATUS_LALT) || if ((status & VasEBoot_TERM_STATUS_LALT) ||
((status & GRUB_TERM_STATUS_RALT) && !alt_gr_consumed)) ((status & VasEBoot_TERM_STATUS_RALT) && !alt_gr_consumed))
key |= GRUB_TERM_ALT; key |= VasEBoot_TERM_ALT;
if (status & (GRUB_TERM_STATUS_LCTRL | GRUB_TERM_STATUS_RCTRL)) if (status & (VasEBoot_TERM_STATUS_LCTRL | VasEBoot_TERM_STATUS_RCTRL))
key |= GRUB_TERM_CTRL; key |= VasEBoot_TERM_CTRL;
return key; return key;
} }
static grub_err_t static VasEBoot_err_t
grub_cmd_keymap (struct grub_command *cmd __attribute__ ((unused)), VasEBoot_cmd_keymap (struct VasEBoot_command *cmd __attribute__ ((unused)),
int argc, char *argv[]) int argc, char *argv[])
{ {
char *filename; char *filename;
grub_file_t file; VasEBoot_file_t file;
grub_uint32_t version; VasEBoot_uint32_t version;
grub_uint8_t magic[GRUB_KEYBOARD_LAYOUTS_FILEMAGIC_SIZE]; VasEBoot_uint8_t magic[VasEBoot_KEYBOARD_LAYOUTS_FILEMAGIC_SIZE];
struct grub_keyboard_layout *newmap = NULL; struct VasEBoot_keyboard_layout *newmap = NULL;
unsigned i; unsigned i;
if (argc < 1) if (argc < 1)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file or layout name required"); return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, "file or layout name required");
if (argv[0][0] != '(' && argv[0][0] != '/' && argv[0][0] != '+') if (argv[0][0] != '(' && argv[0][0] != '/' && argv[0][0] != '+')
{ {
const char *prefix = grub_env_get ("prefix"); const char *prefix = VasEBoot_env_get ("prefix");
if (!prefix) if (!prefix)
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("variable `%s' isn't set"), "prefix"); return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, N_("variable `%s' isn't set"), "prefix");
filename = grub_xasprintf ("%s/layouts/%s.gkb", prefix, argv[0]); filename = VasEBoot_xasprintf ("%s/layouts/%s.gkb", prefix, argv[0]);
if (!filename) if (!filename)
return grub_errno; return VasEBoot_errno;
} }
else else
filename = argv[0]; filename = argv[0];
file = grub_file_open (filename); file = VasEBoot_file_open (filename);
if (! file) if (! file)
goto fail; goto fail;
if (grub_file_read (file, magic, sizeof (magic)) != sizeof (magic)) if (VasEBoot_file_read (file, magic, sizeof (magic)) != sizeof (magic))
{ {
if (!grub_errno) if (!VasEBoot_errno)
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("premature end of file %s"), VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, N_("premature end of file %s"),
filename); filename);
goto fail; goto fail;
} }
if (grub_memcmp (magic, GRUB_KEYBOARD_LAYOUTS_FILEMAGIC, if (VasEBoot_memcmp (magic, VasEBoot_KEYBOARD_LAYOUTS_FILEMAGIC,
GRUB_KEYBOARD_LAYOUTS_FILEMAGIC_SIZE) != 0) VasEBoot_KEYBOARD_LAYOUTS_FILEMAGIC_SIZE) != 0)
{ {
grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid magic"); VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, "invalid magic");
goto fail; goto fail;
} }
if (grub_file_read (file, &version, sizeof (version)) != sizeof (version)) if (VasEBoot_file_read (file, &version, sizeof (version)) != sizeof (version))
{ {
if (!grub_errno) if (!VasEBoot_errno)
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("premature end of file %s"), VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, N_("premature end of file %s"),
filename); filename);
goto fail; goto fail;
} }
if (version != grub_cpu_to_le32_compile_time (GRUB_KEYBOARD_LAYOUTS_VERSION)) if (version != VasEBoot_cpu_to_le32_compile_time (VasEBoot_KEYBOARD_LAYOUTS_VERSION))
{ {
grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid version"); VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, "invalid version");
goto fail; goto fail;
} }
newmap = grub_malloc (sizeof (*newmap)); newmap = VasEBoot_malloc (sizeof (*newmap));
if (!newmap) if (!newmap)
goto fail; goto fail;
if (grub_file_read (file, newmap, sizeof (*newmap)) != sizeof (*newmap)) if (VasEBoot_file_read (file, newmap, sizeof (*newmap)) != sizeof (*newmap))
{ {
if (!grub_errno) if (!VasEBoot_errno)
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("premature end of file %s"), VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, N_("premature end of file %s"),
filename); filename);
goto fail; goto fail;
} }
for (i = 0; i < ARRAY_SIZE (newmap->keyboard_map); i++) for (i = 0; i < ARRAY_SIZE (newmap->keyboard_map); i++)
newmap->keyboard_map[i] = grub_le_to_cpu32(newmap->keyboard_map[i]); newmap->keyboard_map[i] = VasEBoot_le_to_cpu32(newmap->keyboard_map[i]);
for (i = 0; i < ARRAY_SIZE (newmap->keyboard_map_shift); i++) for (i = 0; i < ARRAY_SIZE (newmap->keyboard_map_shift); i++)
newmap->keyboard_map_shift[i] newmap->keyboard_map_shift[i]
= grub_le_to_cpu32(newmap->keyboard_map_shift[i]); = VasEBoot_le_to_cpu32(newmap->keyboard_map_shift[i]);
for (i = 0; i < ARRAY_SIZE (newmap->keyboard_map_l3); i++) for (i = 0; i < ARRAY_SIZE (newmap->keyboard_map_l3); i++)
newmap->keyboard_map_l3[i] newmap->keyboard_map_l3[i]
= grub_le_to_cpu32(newmap->keyboard_map_l3[i]); = VasEBoot_le_to_cpu32(newmap->keyboard_map_l3[i]);
for (i = 0; i < ARRAY_SIZE (newmap->keyboard_map_shift_l3); i++) for (i = 0; i < ARRAY_SIZE (newmap->keyboard_map_shift_l3); i++)
newmap->keyboard_map_shift_l3[i] newmap->keyboard_map_shift_l3[i]
= grub_le_to_cpu32(newmap->keyboard_map_shift_l3[i]); = VasEBoot_le_to_cpu32(newmap->keyboard_map_shift_l3[i]);
grub_current_layout = newmap; VasEBoot_current_layout = newmap;
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
fail: fail:
if (filename != argv[0]) if (filename != argv[0])
grub_free (filename); VasEBoot_free (filename);
grub_free (newmap); VasEBoot_free (newmap);
if (file) if (file)
grub_file_close (file); VasEBoot_file_close (file);
return grub_errno; return VasEBoot_errno;
} }
static grub_command_t cmd; static VasEBoot_command_t cmd;
GRUB_MOD_INIT(keylayouts) VasEBoot_MOD_INIT(keylayouts)
{ {
cmd = grub_register_command ("keymap", grub_cmd_keymap, cmd = VasEBoot_register_command ("keymap", VasEBoot_cmd_keymap,
0, N_("Load a keyboard layout.")); 0, N_("Load a keyboard layout."));
} }
GRUB_MOD_FINI(keylayouts) VasEBoot_MOD_FINI(keylayouts)
{ {
grub_unregister_command (cmd); VasEBoot_unregister_command (cmd);
} }

View File

@ -1,31 +1,31 @@
/* keystatus.c - Command to check key modifier status. */ /* keystatus.c - Command to check key modifier status. */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc. * Copyright (C) 2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/extcmd.h> #include <VasEBoot/extcmd.h>
#include <grub/term.h> #include <VasEBoot/term.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static const struct grub_arg_option options[] = static const struct VasEBoot_arg_option options[] =
{ {
/* TRANSLATORS: "Check" in a sense that if this key is pressed then /* TRANSLATORS: "Check" in a sense that if this key is pressed then
"true" is returned, otherwise "false". */ "true" is returned, otherwise "false". */
@ -36,13 +36,13 @@ static const struct grub_arg_option options[] =
}; };
static int static int
grub_getkeystatus (void) VasEBoot_getkeystatus (void)
{ {
int status = 0; int status = 0;
grub_term_input_t term; VasEBoot_term_input_t term;
if (grub_term_poll_usb) if (VasEBoot_term_poll_usb)
grub_term_poll_usb (0); VasEBoot_term_poll_usb (0);
FOR_ACTIVE_TERM_INPUTS(term) FOR_ACTIVE_TERM_INPUTS(term)
{ {
@ -53,61 +53,61 @@ grub_getkeystatus (void)
return status; return status;
} }
static grub_err_t static VasEBoot_err_t
grub_cmd_keystatus (grub_extcmd_context_t ctxt, VasEBoot_cmd_keystatus (VasEBoot_extcmd_context_t ctxt,
int argc __attribute__ ((unused)), int argc __attribute__ ((unused)),
char **args __attribute__ ((unused))) char **args __attribute__ ((unused)))
{ {
struct grub_arg_list *state = ctxt->state; struct VasEBoot_arg_list *state = ctxt->state;
int expect_mods = 0; int expect_mods = 0;
int mods; int mods;
if (state[0].set) if (state[0].set)
expect_mods |= (GRUB_TERM_STATUS_LSHIFT | GRUB_TERM_STATUS_RSHIFT); expect_mods |= (VasEBoot_TERM_STATUS_LSHIFT | VasEBoot_TERM_STATUS_RSHIFT);
if (state[1].set) if (state[1].set)
expect_mods |= (GRUB_TERM_STATUS_LCTRL | GRUB_TERM_STATUS_RCTRL); expect_mods |= (VasEBoot_TERM_STATUS_LCTRL | VasEBoot_TERM_STATUS_RCTRL);
if (state[2].set) if (state[2].set)
expect_mods |= (GRUB_TERM_STATUS_LALT | GRUB_TERM_STATUS_RALT); expect_mods |= (VasEBoot_TERM_STATUS_LALT | VasEBoot_TERM_STATUS_RALT);
grub_dprintf ("keystatus", "expect_mods: %d\n", expect_mods); VasEBoot_dprintf ("keystatus", "expect_mods: %d\n", expect_mods);
/* Without arguments, just check whether getkeystatus is supported at /* Without arguments, just check whether getkeystatus is supported at
all. */ all. */
if (expect_mods == 0) if (expect_mods == 0)
{ {
grub_term_input_t term; VasEBoot_term_input_t term;
int nterms = 0; int nterms = 0;
FOR_ACTIVE_TERM_INPUTS (term) FOR_ACTIVE_TERM_INPUTS (term)
if (!term->getkeystatus) if (!term->getkeystatus)
return grub_error (GRUB_ERR_TEST_FAILURE, N_("false")); return VasEBoot_error (VasEBoot_ERR_TEST_FAILURE, N_("false"));
else else
nterms++; nterms++;
if (!nterms) if (!nterms)
return grub_error (GRUB_ERR_TEST_FAILURE, N_("false")); return VasEBoot_error (VasEBoot_ERR_TEST_FAILURE, N_("false"));
return 0; return 0;
} }
mods = grub_getkeystatus (); mods = VasEBoot_getkeystatus ();
grub_dprintf ("keystatus", "mods: %d\n", mods); VasEBoot_dprintf ("keystatus", "mods: %d\n", mods);
if (mods >= 0 && (mods & expect_mods) != 0) if (mods >= 0 && (mods & expect_mods) != 0)
return 0; return 0;
else else
return grub_error (GRUB_ERR_TEST_FAILURE, N_("false")); return VasEBoot_error (VasEBoot_ERR_TEST_FAILURE, N_("false"));
} }
static grub_extcmd_t cmd; static VasEBoot_extcmd_t cmd;
GRUB_MOD_INIT(keystatus) VasEBoot_MOD_INIT(keystatus)
{ {
cmd = grub_register_extcmd ("keystatus", grub_cmd_keystatus, 0, cmd = VasEBoot_register_extcmd ("keystatus", VasEBoot_cmd_keystatus, 0,
"[--shift] [--ctrl] [--alt]", "[--shift] [--ctrl] [--alt]",
/* TRANSLATORS: there are 3 modifiers. */ /* TRANSLATORS: there are 3 modifiers. */
N_("Check key modifier status."), N_("Check key modifier status."),
options); options);
} }
GRUB_MOD_FINI(keystatus) VasEBoot_MOD_FINI(keystatus)
{ {
grub_unregister_extcmd (cmd); VasEBoot_unregister_extcmd (cmd);
} }

File diff suppressed because it is too large Load Diff

View File

@ -1,36 +1,36 @@
/* loadenv.c - command to load/save environment variable. */ /* loadenv.c - command to load/save environment variable. */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2008,2009,2010 Free Software Foundation, Inc. * Copyright (C) 2008,2009,2010 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/mm.h> #include <VasEBoot/mm.h>
#include <grub/file.h> #include <VasEBoot/file.h>
#include <grub/disk.h> #include <VasEBoot/disk.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/env.h> #include <VasEBoot/env.h>
#include <grub/partition.h> #include <VasEBoot/partition.h>
#include <grub/lib/envblk.h> #include <VasEBoot/lib/envblk.h>
#include <grub/extcmd.h> #include <VasEBoot/extcmd.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static const struct grub_arg_option options[] = static const struct VasEBoot_arg_option options[] =
{ {
/* TRANSLATORS: This option is used to override default filename /* TRANSLATORS: This option is used to override default filename
for loading and storing environment. */ for loading and storing environment. */
@ -43,10 +43,10 @@ static const struct grub_arg_option options[] =
/* Opens 'filename' with compression filters disabled. Optionally disables the /* Opens 'filename' with compression filters disabled. Optionally disables the
PUBKEY filter (that insists upon properly signed files) as well. PUBKEY PUBKEY filter (that insists upon properly signed files) as well. PUBKEY
filter is restored before the function returns. */ filter is restored before the function returns. */
static grub_file_t static VasEBoot_file_t
open_envblk_file (char *filename, int untrusted) open_envblk_file (char *filename, int untrusted)
{ {
grub_file_t file; VasEBoot_file_t file;
char *buf = 0; char *buf = 0;
if (! filename) if (! filename)
@ -54,56 +54,56 @@ open_envblk_file (char *filename, int untrusted)
const char *prefix; const char *prefix;
int len; int len;
prefix = grub_env_get ("prefix"); prefix = VasEBoot_env_get ("prefix");
if (! prefix) if (! prefix)
{ {
grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"), "prefix"); VasEBoot_error (VasEBoot_ERR_FILE_NOT_FOUND, N_("variable `%s' isn't set"), "prefix");
return 0; return 0;
} }
len = grub_strlen (prefix); len = VasEBoot_strlen (prefix);
buf = grub_malloc (len + 1 + sizeof (GRUB_ENVBLK_DEFCFG)); buf = VasEBoot_malloc (len + 1 + sizeof (VasEBoot_ENVBLK_DEFCFG));
if (! buf) if (! buf)
return 0; return 0;
filename = buf; filename = buf;
grub_strcpy (filename, prefix); VasEBoot_strcpy (filename, prefix);
filename[len] = '/'; filename[len] = '/';
grub_strcpy (filename + len + 1, GRUB_ENVBLK_DEFCFG); VasEBoot_strcpy (filename + len + 1, VasEBoot_ENVBLK_DEFCFG);
} }
/* The filters that are disabled will be re-enabled by the call to /* The filters that are disabled will be re-enabled by the call to
grub_file_open() after this particular file is opened. */ VasEBoot_file_open() after this particular file is opened. */
grub_file_filter_disable_compression (); VasEBoot_file_filter_disable_compression ();
if (untrusted) if (untrusted)
grub_file_filter_disable_pubkey (); VasEBoot_file_filter_disable_pubkey ();
file = grub_file_open (filename); file = VasEBoot_file_open (filename);
grub_free (buf); VasEBoot_free (buf);
return file; return file;
} }
static grub_envblk_t static VasEBoot_envblk_t
read_envblk_file (grub_file_t file) read_envblk_file (VasEBoot_file_t file)
{ {
grub_off_t offset = 0; VasEBoot_off_t offset = 0;
char *buf; char *buf;
grub_size_t size = grub_file_size (file); VasEBoot_size_t size = VasEBoot_file_size (file);
grub_envblk_t envblk; VasEBoot_envblk_t envblk;
buf = grub_malloc (size); buf = VasEBoot_malloc (size);
if (! buf) if (! buf)
return 0; return 0;
while (size > 0) while (size > 0)
{ {
grub_ssize_t ret; VasEBoot_ssize_t ret;
ret = grub_file_read (file, buf + offset, size); ret = VasEBoot_file_read (file, buf + offset, size);
if (ret <= 0) if (ret <= 0)
{ {
grub_free (buf); VasEBoot_free (buf);
return 0; return 0;
} }
@ -111,61 +111,61 @@ read_envblk_file (grub_file_t file)
offset += ret; offset += ret;
} }
envblk = grub_envblk_open (buf, offset); envblk = VasEBoot_envblk_open (buf, offset);
if (! envblk) if (! envblk)
{ {
grub_free (buf); VasEBoot_free (buf);
grub_error (GRUB_ERR_BAD_FILE_TYPE, "invalid environment block"); VasEBoot_error (VasEBoot_ERR_BAD_FILE_TYPE, "invalid environment block");
return 0; return 0;
} }
return envblk; return envblk;
} }
struct grub_env_whitelist struct VasEBoot_env_whitelist
{ {
grub_size_t len; VasEBoot_size_t len;
char **list; char **list;
}; };
typedef struct grub_env_whitelist grub_env_whitelist_t; typedef struct VasEBoot_env_whitelist VasEBoot_env_whitelist_t;
static int static int
test_whitelist_membership (const char* name, test_whitelist_membership (const char* name,
const grub_env_whitelist_t* whitelist) const VasEBoot_env_whitelist_t* whitelist)
{ {
grub_size_t i; VasEBoot_size_t i;
for (i = 0; i < whitelist->len; i++) for (i = 0; i < whitelist->len; i++)
if (grub_strcmp (name, whitelist->list[i]) == 0) if (VasEBoot_strcmp (name, whitelist->list[i]) == 0)
return 1; /* found it */ return 1; /* found it */
return 0; /* not found */ return 0; /* not found */
} }
/* Helper for grub_cmd_load_env. */ /* Helper for VasEBoot_cmd_load_env. */
static int static int
set_var (const char *name, const char *value, void *whitelist) set_var (const char *name, const char *value, void *whitelist)
{ {
if (! whitelist) if (! whitelist)
{ {
grub_env_set (name, value); VasEBoot_env_set (name, value);
return 0; return 0;
} }
if (test_whitelist_membership (name, if (test_whitelist_membership (name,
(const grub_env_whitelist_t *) whitelist)) (const VasEBoot_env_whitelist_t *) whitelist))
grub_env_set (name, value); VasEBoot_env_set (name, value);
return 0; return 0;
} }
static grub_err_t static VasEBoot_err_t
grub_cmd_load_env (grub_extcmd_context_t ctxt, int argc, char **args) VasEBoot_cmd_load_env (VasEBoot_extcmd_context_t ctxt, int argc, char **args)
{ {
struct grub_arg_list *state = ctxt->state; struct VasEBoot_arg_list *state = ctxt->state;
grub_file_t file; VasEBoot_file_t file;
grub_envblk_t envblk; VasEBoot_envblk_t envblk;
grub_env_whitelist_t whitelist; VasEBoot_env_whitelist_t whitelist;
whitelist.len = argc; whitelist.len = argc;
whitelist.list = args; whitelist.list = args;
@ -173,19 +173,19 @@ grub_cmd_load_env (grub_extcmd_context_t ctxt, int argc, char **args)
/* state[0] is the -f flag; state[1] is the --skip-sig flag */ /* state[0] is the -f flag; state[1] is the --skip-sig flag */
file = open_envblk_file ((state[0].set) ? state[0].arg : 0, state[1].set); file = open_envblk_file ((state[0].set) ? state[0].arg : 0, state[1].set);
if (! file) if (! file)
return grub_errno; return VasEBoot_errno;
envblk = read_envblk_file (file); envblk = read_envblk_file (file);
if (! envblk) if (! envblk)
goto fail; goto fail;
/* argc > 0 indicates caller provided a whitelist of variables to read. */ /* argc > 0 indicates caller provided a whitelist of variables to read. */
grub_envblk_iterate (envblk, argc > 0 ? &whitelist : 0, set_var); VasEBoot_envblk_iterate (envblk, argc > 0 ? &whitelist : 0, set_var);
grub_envblk_close (envblk); VasEBoot_envblk_close (envblk);
fail: fail:
grub_file_close (file); VasEBoot_file_close (file);
return grub_errno; return VasEBoot_errno;
} }
/* Print all variables in current context. */ /* Print all variables in current context. */
@ -193,39 +193,39 @@ static int
print_var (const char *name, const char *value, print_var (const char *name, const char *value,
void *hook_data __attribute__ ((unused))) void *hook_data __attribute__ ((unused)))
{ {
grub_printf ("%s=%s\n", name, value); VasEBoot_printf ("%s=%s\n", name, value);
return 0; return 0;
} }
static grub_err_t static VasEBoot_err_t
grub_cmd_list_env (grub_extcmd_context_t ctxt, VasEBoot_cmd_list_env (VasEBoot_extcmd_context_t ctxt,
int argc __attribute__ ((unused)), int argc __attribute__ ((unused)),
char **args __attribute__ ((unused))) char **args __attribute__ ((unused)))
{ {
struct grub_arg_list *state = ctxt->state; struct VasEBoot_arg_list *state = ctxt->state;
grub_file_t file; VasEBoot_file_t file;
grub_envblk_t envblk; VasEBoot_envblk_t envblk;
file = open_envblk_file ((state[0].set) ? state[0].arg : 0, 0); file = open_envblk_file ((state[0].set) ? state[0].arg : 0, 0);
if (! file) if (! file)
return grub_errno; return VasEBoot_errno;
envblk = read_envblk_file (file); envblk = read_envblk_file (file);
if (! envblk) if (! envblk)
goto fail; goto fail;
grub_envblk_iterate (envblk, NULL, print_var); VasEBoot_envblk_iterate (envblk, NULL, print_var);
grub_envblk_close (envblk); VasEBoot_envblk_close (envblk);
fail: fail:
grub_file_close (file); VasEBoot_file_close (file);
return grub_errno; return VasEBoot_errno;
} }
/* Used to maintain a variable length of blocklists internally. */ /* Used to maintain a variable length of blocklists internally. */
struct blocklist struct blocklist
{ {
grub_disk_addr_t sector; VasEBoot_disk_addr_t sector;
unsigned offset; unsigned offset;
unsigned length; unsigned length;
struct blocklist *next; struct blocklist *next;
@ -239,18 +239,18 @@ free_blocklists (struct blocklist *p)
for (; p; p = q) for (; p; p = q)
{ {
q = p->next; q = p->next;
grub_free (p); VasEBoot_free (p);
} }
} }
static grub_err_t static VasEBoot_err_t
check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists, check_blocklists (VasEBoot_envblk_t envblk, struct blocklist *blocklists,
grub_file_t file) VasEBoot_file_t file)
{ {
grub_size_t total_length; VasEBoot_size_t total_length;
grub_size_t index; VasEBoot_size_t index;
grub_disk_t disk; VasEBoot_disk_t disk;
grub_disk_addr_t part_start; VasEBoot_disk_addr_t part_start;
struct blocklist *p; struct blocklist *p;
char *buf; char *buf;
@ -262,81 +262,81 @@ check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
/* Check if any pair of blocks overlap. */ /* Check if any pair of blocks overlap. */
for (q = p->next; q; q = q->next) for (q = p->next; q; q = q->next)
{ {
grub_disk_addr_t s1, s2; VasEBoot_disk_addr_t s1, s2;
grub_disk_addr_t e1, e2; VasEBoot_disk_addr_t e1, e2;
s1 = p->sector; s1 = p->sector;
e1 = s1 + ((p->length + GRUB_DISK_SECTOR_SIZE - 1) >> GRUB_DISK_SECTOR_BITS); e1 = s1 + ((p->length + VasEBoot_DISK_SECTOR_SIZE - 1) >> VasEBoot_DISK_SECTOR_BITS);
s2 = q->sector; s2 = q->sector;
e2 = s2 + ((q->length + GRUB_DISK_SECTOR_SIZE - 1) >> GRUB_DISK_SECTOR_BITS); e2 = s2 + ((q->length + VasEBoot_DISK_SECTOR_SIZE - 1) >> VasEBoot_DISK_SECTOR_BITS);
if (s1 < e2 && s2 < e1) if (s1 < e2 && s2 < e1)
{ {
/* This might be actually valid, but it is unbelievable that /* This might be actually valid, but it is unbelievable that
any filesystem makes such a silly allocation. */ any filesystem makes such a silly allocation. */
return grub_error (GRUB_ERR_BAD_FS, "malformed file"); return VasEBoot_error (VasEBoot_ERR_BAD_FS, "malformed file");
} }
} }
total_length += p->length; total_length += p->length;
} }
if (total_length != grub_file_size (file)) if (total_length != VasEBoot_file_size (file))
{ {
/* Maybe sparse, unallocated sectors. No way in GRUB. */ /* Maybe sparse, unallocated sectors. No way in VasEBoot. */
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "sparse file not allowed"); return VasEBoot_error (VasEBoot_ERR_BAD_FILE_TYPE, "sparse file not allowed");
} }
/* One more sanity check. Re-read all sectors by blocklists, and compare /* One more sanity check. Re-read all sectors by blocklists, and compare
those with the data read via a file. */ those with the data read via a file. */
disk = file->device->disk; disk = file->device->disk;
part_start = grub_partition_get_start (disk->partition); part_start = VasEBoot_partition_get_start (disk->partition);
buf = grub_envblk_buffer (envblk); buf = VasEBoot_envblk_buffer (envblk);
char *blockbuf = NULL; char *blockbuf = NULL;
grub_size_t blockbuf_len = 0; VasEBoot_size_t blockbuf_len = 0;
for (p = blocklists, index = 0; p; index += p->length, p = p->next) for (p = blocklists, index = 0; p; index += p->length, p = p->next)
{ {
if (p->length > blockbuf_len) if (p->length > blockbuf_len)
{ {
grub_free (blockbuf); VasEBoot_free (blockbuf);
blockbuf_len = 2 * p->length; blockbuf_len = 2 * p->length;
blockbuf = grub_malloc (blockbuf_len); blockbuf = VasEBoot_malloc (blockbuf_len);
if (!blockbuf) if (!blockbuf)
return grub_errno; return VasEBoot_errno;
} }
if (grub_disk_read (disk, p->sector - part_start, if (VasEBoot_disk_read (disk, p->sector - part_start,
p->offset, p->length, blockbuf)) p->offset, p->length, blockbuf))
return grub_errno; return VasEBoot_errno;
if (grub_memcmp (buf + index, blockbuf, p->length) != 0) if (VasEBoot_memcmp (buf + index, blockbuf, p->length) != 0)
return grub_error (GRUB_ERR_FILE_READ_ERROR, "invalid blocklist"); return VasEBoot_error (VasEBoot_ERR_FILE_READ_ERROR, "invalid blocklist");
} }
return GRUB_ERR_NONE; return VasEBoot_ERR_NONE;
} }
static int static int
write_blocklists (grub_envblk_t envblk, struct blocklist *blocklists, write_blocklists (VasEBoot_envblk_t envblk, struct blocklist *blocklists,
grub_file_t file) VasEBoot_file_t file)
{ {
char *buf; char *buf;
grub_disk_t disk; VasEBoot_disk_t disk;
grub_disk_addr_t part_start; VasEBoot_disk_addr_t part_start;
struct blocklist *p; struct blocklist *p;
grub_size_t index; VasEBoot_size_t index;
buf = grub_envblk_buffer (envblk); buf = VasEBoot_envblk_buffer (envblk);
disk = file->device->disk; disk = file->device->disk;
part_start = grub_partition_get_start (disk->partition); part_start = VasEBoot_partition_get_start (disk->partition);
index = 0; index = 0;
for (p = blocklists; p; index += p->length, p = p->next) for (p = blocklists; p; index += p->length, p = p->next)
{ {
if (grub_disk_write (disk, p->sector - part_start, if (VasEBoot_disk_write (disk, p->sector - part_start,
p->offset, p->length, buf + index)) p->offset, p->length, buf + index))
return 0; return 0;
} }
@ -344,21 +344,21 @@ write_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
return 1; return 1;
} }
/* Context for grub_cmd_save_env. */ /* Context for VasEBoot_cmd_save_env. */
struct grub_cmd_save_env_ctx struct VasEBoot_cmd_save_env_ctx
{ {
struct blocklist *head, *tail; struct blocklist *head, *tail;
}; };
/* Store blocklists in a linked list. */ /* Store blocklists in a linked list. */
static void static void
save_env_read_hook (grub_disk_addr_t sector, unsigned offset, unsigned length, save_env_read_hook (VasEBoot_disk_addr_t sector, unsigned offset, unsigned length,
void *data) void *data)
{ {
struct grub_cmd_save_env_ctx *ctx = data; struct VasEBoot_cmd_save_env_ctx *ctx = data;
struct blocklist *block; struct blocklist *block;
block = grub_malloc (sizeof (*block)); block = VasEBoot_malloc (sizeof (*block));
if (! block) if (! block)
return; return;
@ -375,29 +375,29 @@ save_env_read_hook (grub_disk_addr_t sector, unsigned offset, unsigned length,
ctx->head = block; ctx->head = block;
} }
static grub_err_t static VasEBoot_err_t
grub_cmd_save_env (grub_extcmd_context_t ctxt, int argc, char **args) VasEBoot_cmd_save_env (VasEBoot_extcmd_context_t ctxt, int argc, char **args)
{ {
struct grub_arg_list *state = ctxt->state; struct VasEBoot_arg_list *state = ctxt->state;
grub_file_t file; VasEBoot_file_t file;
grub_envblk_t envblk; VasEBoot_envblk_t envblk;
struct grub_cmd_save_env_ctx ctx = { struct VasEBoot_cmd_save_env_ctx ctx = {
.head = 0, .head = 0,
.tail = 0 .tail = 0
}; };
if (! argc) if (! argc)
return grub_error (GRUB_ERR_BAD_ARGUMENT, "no variable is specified"); return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, "no variable is specified");
file = open_envblk_file ((state[0].set) ? state[0].arg : 0, file = open_envblk_file ((state[0].set) ? state[0].arg : 0,
1 /* allow untrusted */); 1 /* allow untrusted */);
if (! file) if (! file)
return grub_errno; return VasEBoot_errno;
if (! file->device->disk) if (! file->device->disk)
{ {
grub_file_close (file); VasEBoot_file_close (file);
return grub_error (GRUB_ERR_BAD_DEVICE, "disk device required"); return VasEBoot_error (VasEBoot_ERR_BAD_DEVICE, "disk device required");
} }
file->read_hook = save_env_read_hook; file->read_hook = save_env_read_hook;
@ -414,17 +414,17 @@ grub_cmd_save_env (grub_extcmd_context_t ctxt, int argc, char **args)
{ {
const char *value; const char *value;
value = grub_env_get (args[0]); value = VasEBoot_env_get (args[0]);
if (value) if (value)
{ {
if (! grub_envblk_set (envblk, args[0], value)) if (! VasEBoot_envblk_set (envblk, args[0], value))
{ {
grub_error (GRUB_ERR_BAD_ARGUMENT, "environment block too small"); VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, "environment block too small");
goto fail; goto fail;
} }
} }
else else
grub_envblk_delete (envblk, args[0]); VasEBoot_envblk_delete (envblk, args[0]);
argc--; argc--;
args++; args++;
@ -434,35 +434,35 @@ grub_cmd_save_env (grub_extcmd_context_t ctxt, int argc, char **args)
fail: fail:
if (envblk) if (envblk)
grub_envblk_close (envblk); VasEBoot_envblk_close (envblk);
free_blocklists (ctx.head); free_blocklists (ctx.head);
grub_file_close (file); VasEBoot_file_close (file);
return grub_errno; return VasEBoot_errno;
} }
static grub_extcmd_t cmd_load, cmd_list, cmd_save; static VasEBoot_extcmd_t cmd_load, cmd_list, cmd_save;
GRUB_MOD_INIT(loadenv) VasEBoot_MOD_INIT(loadenv)
{ {
cmd_load = cmd_load =
grub_register_extcmd ("load_env", grub_cmd_load_env, 0, VasEBoot_register_extcmd ("load_env", VasEBoot_cmd_load_env, 0,
N_("[-f FILE] [-s|--skip-sig] [variable_name_to_whitelist] [...]"), N_("[-f FILE] [-s|--skip-sig] [variable_name_to_whitelist] [...]"),
N_("Load variables from environment block file."), N_("Load variables from environment block file."),
options); options);
cmd_list = cmd_list =
grub_register_extcmd ("list_env", grub_cmd_list_env, 0, N_("[-f FILE]"), VasEBoot_register_extcmd ("list_env", VasEBoot_cmd_list_env, 0, N_("[-f FILE]"),
N_("List variables from environment block file."), N_("List variables from environment block file."),
options); options);
cmd_save = cmd_save =
grub_register_extcmd ("save_env", grub_cmd_save_env, 0, VasEBoot_register_extcmd ("save_env", VasEBoot_cmd_save_env, 0,
N_("[-f FILE] variable_name [...]"), N_("[-f FILE] variable_name [...]"),
N_("Save variables to environment block file."), N_("Save variables to environment block file."),
options); options);
} }
GRUB_MOD_FINI(loadenv) VasEBoot_MOD_FINI(loadenv)
{ {
grub_unregister_extcmd (cmd_load); VasEBoot_unregister_extcmd (cmd_load);
grub_unregister_extcmd (cmd_list); VasEBoot_unregister_extcmd (cmd_list);
grub_unregister_extcmd (cmd_save); VasEBoot_unregister_extcmd (cmd_save);
} }

View File

@ -1,41 +1,41 @@
/* ls.c - command to list files and devices */ /* ls.c - command to list files and devices */
/* /*
* GRUB -- GRand Unified Bootloader * VasEBoot -- GRand Unified Bootloader
* Copyright (C) 2003,2005,2007,2008,2009 Free Software Foundation, Inc. * Copyright (C) 2003,2005,2007,2008,2009 Free Software Foundation, Inc.
* *
* GRUB is free software: you can redistribute it and/or modify * VasEBoot is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by * it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
* *
* GRUB is distributed in the hope that it will be useful, * VasEBoot is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of * but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details. * GNU General Public License for more details.
* *
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>. * along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
*/ */
#include <grub/types.h> #include <VasEBoot/types.h>
#include <grub/misc.h> #include <VasEBoot/misc.h>
#include <grub/mm.h> #include <VasEBoot/mm.h>
#include <grub/err.h> #include <VasEBoot/err.h>
#include <grub/dl.h> #include <VasEBoot/dl.h>
#include <grub/disk.h> #include <VasEBoot/disk.h>
#include <grub/device.h> #include <VasEBoot/device.h>
#include <grub/term.h> #include <VasEBoot/term.h>
#include <grub/partition.h> #include <VasEBoot/partition.h>
#include <grub/file.h> #include <VasEBoot/file.h>
#include <grub/normal.h> #include <VasEBoot/normal.h>
#include <grub/extcmd.h> #include <VasEBoot/extcmd.h>
#include <grub/datetime.h> #include <VasEBoot/datetime.h>
#include <grub/i18n.h> #include <VasEBoot/i18n.h>
#include <grub/net.h> #include <VasEBoot/net.h>
GRUB_MOD_LICENSE ("GPLv3+"); VasEBoot_MOD_LICENSE ("GPLv3+");
static const struct grub_arg_option options[] = static const struct VasEBoot_arg_option options[] =
{ {
{"long", 'l', 0, N_("Show a long list with more detailed information."), 0, 0}, {"long", 'l', 0, N_("Show a long list with more detailed information."), 0, 0},
{"human-readable", 'h', 0, N_("Print sizes in a human readable format."), 0, 0}, {"human-readable", 'h', 0, N_("Print sizes in a human readable format."), 0, 0},
@ -43,148 +43,148 @@ static const struct grub_arg_option options[] =
{0, 0, 0, 0, 0, 0} {0, 0, 0, 0, 0, 0}
}; };
/* Helper for grub_ls_list_devices. */ /* Helper for VasEBoot_ls_list_devices. */
static int static int
grub_ls_print_devices (const char *name, void *data) VasEBoot_ls_print_devices (const char *name, void *data)
{ {
int *longlist = data; int *longlist = data;
if (*longlist) if (*longlist)
grub_normal_print_device_info (name); VasEBoot_normal_print_device_info (name);
else else
grub_printf ("(%s) ", name); VasEBoot_printf ("(%s) ", name);
return 0; return 0;
} }
static grub_err_t static VasEBoot_err_t
grub_ls_list_devices (int longlist) VasEBoot_ls_list_devices (int longlist)
{ {
grub_device_iterate (grub_ls_print_devices, &longlist); VasEBoot_device_iterate (VasEBoot_ls_print_devices, &longlist);
grub_xputs ("\n"); VasEBoot_xputs ("\n");
#if 0 #if 0
{ {
grub_net_app_level_t proto; VasEBoot_net_app_level_t proto;
int first = 1; int first = 1;
FOR_NET_APP_LEVEL (proto) FOR_NET_APP_LEVEL (proto)
{ {
if (first) if (first)
grub_puts_ (N_ ("Network protocols:")); VasEBoot_puts_ (N_ ("Network protocols:"));
first = 0; first = 0;
grub_printf ("%s ", proto->name); VasEBoot_printf ("%s ", proto->name);
} }
grub_xputs ("\n"); VasEBoot_xputs ("\n");
} }
#endif #endif
grub_refresh (); VasEBoot_refresh ();
return 0; return 0;
} }
/* Context for grub_ls_list_files. */ /* Context for VasEBoot_ls_list_files. */
struct grub_ls_list_files_ctx struct VasEBoot_ls_list_files_ctx
{ {
char *dirname; char *dirname;
int all; int all;
int human; int human;
}; };
/* Helper for grub_ls_list_files. */ /* Helper for VasEBoot_ls_list_files. */
static int static int
print_files (const char *filename, const struct grub_dirhook_info *info, print_files (const char *filename, const struct VasEBoot_dirhook_info *info,
void *data) void *data)
{ {
struct grub_ls_list_files_ctx *ctx = data; struct VasEBoot_ls_list_files_ctx *ctx = data;
if (ctx->all || filename[0] != '.') if (ctx->all || filename[0] != '.')
grub_printf ("%s%s ", filename, info->dir ? "/" : ""); VasEBoot_printf ("%s%s ", filename, info->dir ? "/" : "");
return 0; return 0;
} }
/* Helper for grub_ls_list_files. */ /* Helper for VasEBoot_ls_list_files. */
static int static int
print_files_long (const char *filename, const struct grub_dirhook_info *info, print_files_long (const char *filename, const struct VasEBoot_dirhook_info *info,
void *data) void *data)
{ {
struct grub_ls_list_files_ctx *ctx = data; struct VasEBoot_ls_list_files_ctx *ctx = data;
if ((! ctx->all) && (filename[0] == '.')) if ((! ctx->all) && (filename[0] == '.'))
return 0; return 0;
if (! info->dir) if (! info->dir)
{ {
grub_file_t file; VasEBoot_file_t file;
char *pathname; char *pathname;
if (ctx->dirname[grub_strlen (ctx->dirname) - 1] == '/') if (ctx->dirname[VasEBoot_strlen (ctx->dirname) - 1] == '/')
pathname = grub_xasprintf ("%s%s", ctx->dirname, filename); pathname = VasEBoot_xasprintf ("%s%s", ctx->dirname, filename);
else else
pathname = grub_xasprintf ("%s/%s", ctx->dirname, filename); pathname = VasEBoot_xasprintf ("%s/%s", ctx->dirname, filename);
if (!pathname) if (!pathname)
return 1; return 1;
/* XXX: For ext2fs symlinks are detected as files while they /* XXX: For ext2fs symlinks are detected as files while they
should be reported as directories. */ should be reported as directories. */
grub_file_filter_disable_compression (); VasEBoot_file_filter_disable_compression ();
file = grub_file_open (pathname); file = VasEBoot_file_open (pathname);
if (! file) if (! file)
{ {
grub_errno = 0; VasEBoot_errno = 0;
grub_free (pathname); VasEBoot_free (pathname);
return 0; return 0;
} }
if (! ctx->human) if (! ctx->human)
grub_printf ("%-12llu", (unsigned long long) file->size); VasEBoot_printf ("%-12llu", (unsigned long long) file->size);
else else
grub_printf ("%-12s", grub_get_human_size (file->size, VasEBoot_printf ("%-12s", VasEBoot_get_human_size (file->size,
GRUB_HUMAN_SIZE_SHORT)); VasEBoot_HUMAN_SIZE_SHORT));
grub_file_close (file); VasEBoot_file_close (file);
grub_free (pathname); VasEBoot_free (pathname);
} }
else else
grub_printf ("%-12s", _("DIR")); VasEBoot_printf ("%-12s", _("DIR"));
if (info->mtimeset) if (info->mtimeset)
{ {
struct grub_datetime datetime; struct VasEBoot_datetime datetime;
grub_unixtime2datetime (info->mtime, &datetime); VasEBoot_unixtime2datetime (info->mtime, &datetime);
if (ctx->human) if (ctx->human)
grub_printf (" %d-%02d-%02d %02d:%02d:%02d %-11s ", VasEBoot_printf (" %d-%02d-%02d %02d:%02d:%02d %-11s ",
datetime.year, datetime.month, datetime.day, datetime.year, datetime.month, datetime.day,
datetime.hour, datetime.minute, datetime.hour, datetime.minute,
datetime.second, datetime.second,
grub_get_weekday_name (&datetime)); VasEBoot_get_weekday_name (&datetime));
else else
grub_printf (" %04d%02d%02d%02d%02d%02d ", VasEBoot_printf (" %04d%02d%02d%02d%02d%02d ",
datetime.year, datetime.month, datetime.year, datetime.month,
datetime.day, datetime.hour, datetime.day, datetime.hour,
datetime.minute, datetime.second); datetime.minute, datetime.second);
} }
grub_printf ("%s%s\n", filename, info->dir ? "/" : ""); VasEBoot_printf ("%s%s\n", filename, info->dir ? "/" : "");
return 0; return 0;
} }
static grub_err_t static VasEBoot_err_t
grub_ls_list_files (char *dirname, int longlist, int all, int human) VasEBoot_ls_list_files (char *dirname, int longlist, int all, int human)
{ {
char *device_name; char *device_name;
grub_fs_t fs; VasEBoot_fs_t fs;
const char *path; const char *path;
grub_device_t dev; VasEBoot_device_t dev;
device_name = grub_file_get_device_name (dirname); device_name = VasEBoot_file_get_device_name (dirname);
dev = grub_device_open (device_name); dev = VasEBoot_device_open (device_name);
if (! dev) if (! dev)
goto fail; goto fail;
fs = grub_fs_probe (dev); fs = VasEBoot_fs_probe (dev);
path = grub_strchr (dirname, ')'); path = VasEBoot_strchr (dirname, ')');
if (! path) if (! path)
path = dirname; path = dirname;
else else
@ -192,20 +192,20 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human)
if (! path && ! device_name) if (! path && ! device_name)
{ {
grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid argument"); VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, "invalid argument");
goto fail; goto fail;
} }
if (! *path) if (! *path)
{ {
if (grub_errno == GRUB_ERR_UNKNOWN_FS) if (VasEBoot_errno == VasEBoot_ERR_UNKNOWN_FS)
grub_errno = GRUB_ERR_NONE; VasEBoot_errno = VasEBoot_ERR_NONE;
grub_normal_print_device_info (device_name); VasEBoot_normal_print_device_info (device_name);
} }
else if (fs) else if (fs)
{ {
struct grub_ls_list_files_ctx ctx = { struct VasEBoot_ls_list_files_ctx ctx = {
.dirname = dirname, .dirname = dirname,
.all = all, .all = all,
.human = human .human = human
@ -216,78 +216,78 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human)
else else
(fs->dir) (dev, path, print_files, &ctx); (fs->dir) (dev, path, print_files, &ctx);
if (grub_errno == GRUB_ERR_BAD_FILE_TYPE if (VasEBoot_errno == VasEBoot_ERR_BAD_FILE_TYPE
&& path[grub_strlen (path) - 1] != '/') && path[VasEBoot_strlen (path) - 1] != '/')
{ {
/* PATH might be a regular file. */ /* PATH might be a regular file. */
char *p; char *p;
grub_file_t file; VasEBoot_file_t file;
struct grub_dirhook_info info; struct VasEBoot_dirhook_info info;
grub_errno = 0; VasEBoot_errno = 0;
grub_file_filter_disable_compression (); VasEBoot_file_filter_disable_compression ();
file = grub_file_open (dirname); file = VasEBoot_file_open (dirname);
if (! file) if (! file)
goto fail; goto fail;
grub_file_close (file); VasEBoot_file_close (file);
p = grub_strrchr (dirname, '/') + 1; p = VasEBoot_strrchr (dirname, '/') + 1;
dirname = grub_strndup (dirname, p - dirname); dirname = VasEBoot_strndup (dirname, p - dirname);
if (! dirname) if (! dirname)
goto fail; goto fail;
all = 1; all = 1;
grub_memset (&info, 0, sizeof (info)); VasEBoot_memset (&info, 0, sizeof (info));
if (longlist) if (longlist)
print_files_long (p, &info, &ctx); print_files_long (p, &info, &ctx);
else else
print_files (p, &info, &ctx); print_files (p, &info, &ctx);
grub_free (dirname); VasEBoot_free (dirname);
} }
if (grub_errno == GRUB_ERR_NONE) if (VasEBoot_errno == VasEBoot_ERR_NONE)
grub_xputs ("\n"); VasEBoot_xputs ("\n");
grub_refresh (); VasEBoot_refresh ();
} }
fail: fail:
if (dev) if (dev)
grub_device_close (dev); VasEBoot_device_close (dev);
grub_free (device_name); VasEBoot_free (device_name);
return 0; return 0;
} }
static grub_err_t static VasEBoot_err_t
grub_cmd_ls (grub_extcmd_context_t ctxt, int argc, char **args) VasEBoot_cmd_ls (VasEBoot_extcmd_context_t ctxt, int argc, char **args)
{ {
struct grub_arg_list *state = ctxt->state; struct VasEBoot_arg_list *state = ctxt->state;
int i; int i;
if (argc == 0) if (argc == 0)
grub_ls_list_devices (state[0].set); VasEBoot_ls_list_devices (state[0].set);
else else
for (i = 0; i < argc; i++) for (i = 0; i < argc; i++)
grub_ls_list_files (args[i], state[0].set, state[2].set, VasEBoot_ls_list_files (args[i], state[0].set, state[2].set,
state[1].set); state[1].set);
return 0; return 0;
} }
static grub_extcmd_t cmd; static VasEBoot_extcmd_t cmd;
GRUB_MOD_INIT(ls) VasEBoot_MOD_INIT(ls)
{ {
cmd = grub_register_extcmd ("ls", grub_cmd_ls, 0, cmd = VasEBoot_register_extcmd ("ls", VasEBoot_cmd_ls, 0,
N_("[-l|-h|-a] [FILE ...]"), N_("[-l|-h|-a] [FILE ...]"),
N_("List devices and files."), options); N_("List devices and files."), options);
} }
GRUB_MOD_FINI(ls) VasEBoot_MOD_FINI(ls)
{ {
grub_unregister_extcmd (cmd); VasEBoot_unregister_extcmd (cmd);
} }

Some files were not shown because too many files have changed in this diff Show More