now renamed
This commit is contained in:
parent
cf69f6e32b
commit
c53b43ee0f
|
|
@ -11,9 +11,9 @@ ahci_test
|
|||
ascii.bitmaps
|
||||
ascii.h
|
||||
autom4te.cache
|
||||
build-grub-gen-asciih
|
||||
build-grub-gen-widthspec
|
||||
build-grub-mkfont
|
||||
build-VasEBoot-gen-asciih
|
||||
build-VasEBoot-gen-widthspec
|
||||
build-VasEBoot-mkfont
|
||||
cdboot_test
|
||||
cmp_test
|
||||
config.cache
|
||||
|
|
@ -31,7 +31,7 @@ docs/*.info
|
|||
docs/stamp-vti
|
||||
docs/version.texi
|
||||
ehci_test
|
||||
example_grub_script_test
|
||||
example_VasEBoot_script_test
|
||||
example_scripted_test
|
||||
example_unit_test
|
||||
*.exec
|
||||
|
|
@ -43,101 +43,101 @@ gentrigtables
|
|||
gentrigtables.exe
|
||||
gettext_strings_test
|
||||
gpt_unit_test
|
||||
grub-bin2h
|
||||
/grub-bios-setup
|
||||
/grub-bios-setup.exe
|
||||
grub_cmd_date
|
||||
grub_cmd_echo
|
||||
grub_cmd_regexp
|
||||
grub_cmd_set_date
|
||||
grub_cmd_sleep
|
||||
/grub-editenv
|
||||
/grub-editenv.exe
|
||||
grub-emu
|
||||
grub-emu-lite
|
||||
grub-emu.exe
|
||||
grub-emu-lite.exe
|
||||
grub_emu_init.c
|
||||
grub_emu_init.h
|
||||
/grub-file
|
||||
/grub-file.exe
|
||||
grub-fstest
|
||||
grub-fstest.exe
|
||||
grub_fstest_init.c
|
||||
grub_fstest_init.h
|
||||
grub_func_test
|
||||
grub-install
|
||||
grub-install.exe
|
||||
grub-kbdcomp
|
||||
/grub-macbless
|
||||
/grub-macbless.exe
|
||||
grub-macho2img
|
||||
/grub-menulst2cfg
|
||||
/grub-menulst2cfg.exe
|
||||
/grub-mk*
|
||||
grub-mount
|
||||
/grub-ofpathname
|
||||
/grub-ofpathname.exe
|
||||
grub-core/build-grub-pe2elf.exe
|
||||
/grub-probe
|
||||
/grub-probe.exe
|
||||
grub_probe_init.c
|
||||
grub_probe_init.h
|
||||
/grub-reboot
|
||||
grub_script_blanklines
|
||||
grub_script_blockarg
|
||||
grub_script_break
|
||||
grub-script-check
|
||||
grub-script-check.exe
|
||||
grub_script_check_init.c
|
||||
grub_script_check_init.h
|
||||
grub_script_comments
|
||||
grub_script_continue
|
||||
grub_script_dollar
|
||||
grub_script_echo1
|
||||
grub_script_echo_keywords
|
||||
grub_script_escape_comma
|
||||
grub_script_eval
|
||||
grub_script_expansion
|
||||
grub_script_final_semicolon
|
||||
grub_script_for1
|
||||
grub_script_functions
|
||||
grub_script_gettext
|
||||
grub_script_if
|
||||
grub_script_leading_whitespace
|
||||
grub_script_no_commands
|
||||
grub_script_not
|
||||
grub_script_return
|
||||
grub_script_setparams
|
||||
grub_script_shift
|
||||
grub_script_strcmp
|
||||
grub_script_test
|
||||
grub_script_vars1
|
||||
grub_script_while1
|
||||
grub_script.tab.c
|
||||
grub_script.tab.h
|
||||
grub_script.yy.c
|
||||
grub_script.yy.h
|
||||
grub-set-default
|
||||
grub_setup_init.c
|
||||
grub_setup_init.h
|
||||
grub-shell
|
||||
grub-shell-tester
|
||||
grub-sparc64-setup
|
||||
grub-sparc64-setup.exe
|
||||
/grub-syslinux2cfg
|
||||
/grub-syslinux2cfg.exe
|
||||
VasEBoot-bin2h
|
||||
/VasEBoot-bios-setup
|
||||
/VasEBoot-bios-setup.exe
|
||||
VasEBoot_cmd_date
|
||||
VasEBoot_cmd_echo
|
||||
VasEBoot_cmd_regexp
|
||||
VasEBoot_cmd_set_date
|
||||
VasEBoot_cmd_sleep
|
||||
/VasEBoot-editenv
|
||||
/VasEBoot-editenv.exe
|
||||
VasEBoot-emu
|
||||
VasEBoot-emu-lite
|
||||
VasEBoot-emu.exe
|
||||
VasEBoot-emu-lite.exe
|
||||
VasEBoot_emu_init.c
|
||||
VasEBoot_emu_init.h
|
||||
/VasEBoot-file
|
||||
/VasEBoot-file.exe
|
||||
VasEBoot-fstest
|
||||
VasEBoot-fstest.exe
|
||||
VasEBoot_fstest_init.c
|
||||
VasEBoot_fstest_init.h
|
||||
VasEBoot_func_test
|
||||
VasEBoot-install
|
||||
VasEBoot-install.exe
|
||||
VasEBoot-kbdcomp
|
||||
/VasEBoot-macbless
|
||||
/VasEBoot-macbless.exe
|
||||
VasEBoot-macho2img
|
||||
/VasEBoot-menulst2cfg
|
||||
/VasEBoot-menulst2cfg.exe
|
||||
/VasEBoot-mk*
|
||||
VasEBoot-mount
|
||||
/VasEBoot-ofpathname
|
||||
/VasEBoot-ofpathname.exe
|
||||
VasEBoot-core/build-VasEBoot-pe2elf.exe
|
||||
/VasEBoot-probe
|
||||
/VasEBoot-probe.exe
|
||||
VasEBoot_probe_init.c
|
||||
VasEBoot_probe_init.h
|
||||
/VasEBoot-reboot
|
||||
VasEBoot_script_blanklines
|
||||
VasEBoot_script_blockarg
|
||||
VasEBoot_script_break
|
||||
VasEBoot-script-check
|
||||
VasEBoot-script-check.exe
|
||||
VasEBoot_script_check_init.c
|
||||
VasEBoot_script_check_init.h
|
||||
VasEBoot_script_comments
|
||||
VasEBoot_script_continue
|
||||
VasEBoot_script_dollar
|
||||
VasEBoot_script_echo1
|
||||
VasEBoot_script_echo_keywords
|
||||
VasEBoot_script_escape_comma
|
||||
VasEBoot_script_eval
|
||||
VasEBoot_script_expansion
|
||||
VasEBoot_script_final_semicolon
|
||||
VasEBoot_script_for1
|
||||
VasEBoot_script_functions
|
||||
VasEBoot_script_gettext
|
||||
VasEBoot_script_if
|
||||
VasEBoot_script_leading_whitespace
|
||||
VasEBoot_script_no_commands
|
||||
VasEBoot_script_not
|
||||
VasEBoot_script_return
|
||||
VasEBoot_script_setparams
|
||||
VasEBoot_script_shift
|
||||
VasEBoot_script_strcmp
|
||||
VasEBoot_script_test
|
||||
VasEBoot_script_vars1
|
||||
VasEBoot_script_while1
|
||||
VasEBoot_script.tab.c
|
||||
VasEBoot_script.tab.h
|
||||
VasEBoot_script.yy.c
|
||||
VasEBoot_script.yy.h
|
||||
VasEBoot-set-default
|
||||
VasEBoot_setup_init.c
|
||||
VasEBoot_setup_init.h
|
||||
VasEBoot-shell
|
||||
VasEBoot-shell-tester
|
||||
VasEBoot-sparc64-setup
|
||||
VasEBoot-sparc64-setup.exe
|
||||
/VasEBoot-syslinux2cfg
|
||||
/VasEBoot-syslinux2cfg.exe
|
||||
gzcompress_test
|
||||
hddboot_test
|
||||
help_test
|
||||
*.img
|
||||
*.image
|
||||
*.image.exe
|
||||
include/grub/cpu
|
||||
include/grub/machine
|
||||
include/VasEBoot/cpu
|
||||
include/VasEBoot/machine
|
||||
install-sh
|
||||
lib/libgcrypt-grub
|
||||
libgrub_a_init.c
|
||||
lib/libgcrypt-VasEBoot
|
||||
libVasEBoot_a_init.c
|
||||
*.log
|
||||
*.lst
|
||||
lzocompress_test
|
||||
|
|
@ -155,7 +155,7 @@ pata_test
|
|||
*.pf2
|
||||
*.pp
|
||||
po/*.mo
|
||||
po/grub.pot
|
||||
po/VasEBoot.pot
|
||||
po/POTFILES
|
||||
po/stamp-po
|
||||
printf_test
|
||||
|
|
@ -169,7 +169,7 @@ symlist.h
|
|||
trigtables.c
|
||||
*.trs
|
||||
uhci_test
|
||||
update-grub_lib
|
||||
update-VasEBoot_lib
|
||||
unidata.c
|
||||
xzcompress_test
|
||||
Makefile.in
|
||||
|
|
@ -181,48 +181,48 @@ compile
|
|||
depcomp
|
||||
mdate-sh
|
||||
texinfo.tex
|
||||
grub-core/lib/libgcrypt-grub
|
||||
VasEBoot-core/lib/libgcrypt-VasEBoot
|
||||
.deps
|
||||
.deps-util
|
||||
.deps-core
|
||||
.dirstamp
|
||||
Makefile.util.am
|
||||
contrib
|
||||
grub-core/bootinfo.txt
|
||||
grub-core/Makefile.core.am
|
||||
grub-core/Makefile.gcry.def
|
||||
grub-core/contrib
|
||||
grub-core/gdb_grub
|
||||
grub-core/genmod.sh
|
||||
grub-core/gensyminfo.sh
|
||||
grub-core/gmodule.pl
|
||||
grub-core/grub.chrp
|
||||
grub-core/modinfo.sh
|
||||
grub-core/*.module
|
||||
grub-core/*.module.exe
|
||||
grub-core/*.pp
|
||||
grub-core/kernel.img.bin
|
||||
util/bash-completion.d/grub
|
||||
grub-core/gnulib/alloca.h
|
||||
grub-core/gnulib/arg-nonnull.h
|
||||
grub-core/gnulib/c++defs.h
|
||||
grub-core/gnulib/charset.alias
|
||||
grub-core/gnulib/configmake.h
|
||||
grub-core/gnulib/float.h
|
||||
grub-core/gnulib/getopt.h
|
||||
grub-core/gnulib/langinfo.h
|
||||
grub-core/gnulib/ref-add.sed
|
||||
grub-core/gnulib/ref-del.sed
|
||||
grub-core/gnulib/stdio.h
|
||||
grub-core/gnulib/stdlib.h
|
||||
grub-core/gnulib/string.h
|
||||
grub-core/gnulib/strings.h
|
||||
grub-core/gnulib/sys
|
||||
grub-core/gnulib/unistd.h
|
||||
grub-core/gnulib/warn-on-use.h
|
||||
grub-core/gnulib/wchar.h
|
||||
grub-core/gnulib/wctype.h
|
||||
grub-core/rs_decoder.h
|
||||
VasEBoot-core/bootinfo.txt
|
||||
VasEBoot-core/Makefile.core.am
|
||||
VasEBoot-core/Makefile.gcry.def
|
||||
VasEBoot-core/contrib
|
||||
VasEBoot-core/gdb_VasEBoot
|
||||
VasEBoot-core/genmod.sh
|
||||
VasEBoot-core/gensyminfo.sh
|
||||
VasEBoot-core/gmodule.pl
|
||||
VasEBoot-core/VasEBoot.chrp
|
||||
VasEBoot-core/modinfo.sh
|
||||
VasEBoot-core/*.module
|
||||
VasEBoot-core/*.module.exe
|
||||
VasEBoot-core/*.pp
|
||||
VasEBoot-core/kernel.img.bin
|
||||
util/bash-completion.d/VasEBoot
|
||||
VasEBoot-core/gnulib/alloca.h
|
||||
VasEBoot-core/gnulib/arg-nonnull.h
|
||||
VasEBoot-core/gnulib/c++defs.h
|
||||
VasEBoot-core/gnulib/charset.alias
|
||||
VasEBoot-core/gnulib/configmake.h
|
||||
VasEBoot-core/gnulib/float.h
|
||||
VasEBoot-core/gnulib/getopt.h
|
||||
VasEBoot-core/gnulib/langinfo.h
|
||||
VasEBoot-core/gnulib/ref-add.sed
|
||||
VasEBoot-core/gnulib/ref-del.sed
|
||||
VasEBoot-core/gnulib/stdio.h
|
||||
VasEBoot-core/gnulib/stdlib.h
|
||||
VasEBoot-core/gnulib/string.h
|
||||
VasEBoot-core/gnulib/strings.h
|
||||
VasEBoot-core/gnulib/sys
|
||||
VasEBoot-core/gnulib/unistd.h
|
||||
VasEBoot-core/gnulib/warn-on-use.h
|
||||
VasEBoot-core/gnulib/wchar.h
|
||||
VasEBoot-core/gnulib/wctype.h
|
||||
VasEBoot-core/rs_decoder.h
|
||||
widthspec.bin
|
||||
widthspec.h
|
||||
docs/stamp-1
|
||||
|
|
@ -232,19 +232,19 @@ po/*.po
|
|||
po/*.gmo
|
||||
po/LINGUAS
|
||||
po/remove-potcdate.sed
|
||||
include/grub/gcrypt/gcrypt.h
|
||||
include/grub/gcrypt/g10lib.h
|
||||
include/VasEBoot/gcrypt/gcrypt.h
|
||||
include/VasEBoot/gcrypt/g10lib.h
|
||||
po/POTFILES.in
|
||||
po/POTFILES-shell.in
|
||||
/grub-glue-efi
|
||||
/grub-render-label
|
||||
/grub-glue-efi.exe
|
||||
/grub-render-label.exe
|
||||
grub-core/gnulib/locale.h
|
||||
grub-core/gnulib/unitypes.h
|
||||
grub-core/gnulib/uniwidth.h
|
||||
/VasEBoot-glue-efi
|
||||
/VasEBoot-render-label
|
||||
/VasEBoot-glue-efi.exe
|
||||
/VasEBoot-render-label.exe
|
||||
VasEBoot-core/gnulib/locale.h
|
||||
VasEBoot-core/gnulib/unitypes.h
|
||||
VasEBoot-core/gnulib/uniwidth.h
|
||||
build-aux/test-driver
|
||||
/garbage-gen
|
||||
/garbage-gen.exe
|
||||
/grub-fs-tester
|
||||
grub-core/build-grub-module-verifier
|
||||
/VasEBoot-fs-tester
|
||||
VasEBoot-core/build-VasEBoot-module-verifier
|
||||
|
|
|
|||
2
AUTHORS
2
AUTHORS
|
|
@ -6,7 +6,7 @@ Yoshinori K. Okuji designed and implemented the initial version.
|
|||
Jeroen Dekkers added initrd support, Multiboot support, and fixed bugs
|
||||
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.
|
||||
|
||||
Omniflux added terminfo and serial support.
|
||||
|
|
|
|||
2
BUGS
2
BUGS
|
|
@ -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
|
||||
all the devices which can be slow.
|
||||
- Cache isn't used correctly for video which results in slowness.
|
||||
|
|
|
|||
37644
ChangeLog-2015
37644
ChangeLog-2015
File diff suppressed because it is too large
Load Diff
36
INSTALL
36
INSTALL
|
|
@ -1,15 +1,15 @@
|
|||
-*- 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
|
||||
================
|
||||
|
||||
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
|
||||
configuring the GRUB.
|
||||
configuring the VasEBoot.
|
||||
|
||||
* GCC 4.1.3 or later
|
||||
Note: older versions may work but support is limited
|
||||
|
|
@ -30,7 +30,7 @@ configuring the GRUB.
|
|||
earlier versions not tested
|
||||
Note: clang 3.5 or later works for sparc64
|
||||
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
|
||||
* GNU Make
|
||||
* GNU Bison 2.3 or later
|
||||
|
|
@ -44,18 +44,18 @@ On GNU/Linux, you also need:
|
|||
|
||||
* libdevmapper 1.02.34 or later (recommended)
|
||||
|
||||
For optional grub-emu features, you need:
|
||||
For optional VasEBoot-emu features, you need:
|
||||
|
||||
* SDL (recommended)
|
||||
* libpciaccess (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
|
||||
* 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.
|
||||
|
||||
* Python 2.6 or later
|
||||
|
|
@ -65,9 +65,9 @@ need the following.
|
|||
Prerequisites for make-check:
|
||||
|
||||
* 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
|
||||
|
|
@ -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'.
|
||||
|
||||
|
||||
Building the GRUB
|
||||
Building the VasEBoot
|
||||
=================
|
||||
|
||||
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
|
||||
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.
|
||||
- "Host" is where you execute GRUB utils.
|
||||
- "Target" is where GRUB itself runs.
|
||||
- "Host" is where you execute VasEBoot utils.
|
||||
- "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.
|
||||
|
||||
|
|
@ -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'
|
||||
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
|
||||
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.
|
||||
|
||||
|
||||
|
|
|
|||
268
Makefile.am
268
Makefile.am
|
|
@ -1,9 +1,9 @@
|
|||
AUTOMAKE_OPTIONS = subdir-objects -Wno-portability
|
||||
|
||||
DEPDIR = .deps-util
|
||||
SUBDIRS = grub-core/gnulib .
|
||||
SUBDIRS = VasEBoot-core/gnulib .
|
||||
if COND_real_platform
|
||||
SUBDIRS += grub-core
|
||||
SUBDIRS += VasEBoot-core
|
||||
endif
|
||||
SUBDIRS += po docs util/bash-completion.d
|
||||
|
||||
|
|
@ -25,44 +25,44 @@ CCASFLAGS_PROGRAM += $(CCASFLAGS_GNULIB)
|
|||
include $(srcdir)/Makefile.util.am
|
||||
|
||||
# XXX Use Automake's LEX & YACC support
|
||||
grub_script.tab.h: $(top_srcdir)/grub-core/script/parser.y
|
||||
$(YACC) -d -p grub_script_yy -b grub_script $(top_srcdir)/grub-core/script/parser.y
|
||||
grub_script.tab.c: grub_script.tab.h
|
||||
CLEANFILES += grub_script.tab.c grub_script.tab.h
|
||||
VasEBoot_script.tab.h: $(top_srcdir)/VasEBoot-core/script/parser.y
|
||||
$(YACC) -d -p VasEBoot_script_yy -b VasEBoot_script $(top_srcdir)/VasEBoot-core/script/parser.y
|
||||
VasEBoot_script.tab.c: VasEBoot_script.tab.h
|
||||
CLEANFILES += VasEBoot_script.tab.c VasEBoot_script.tab.h
|
||||
|
||||
# For the lexer.
|
||||
grub_script.yy.h: $(top_srcdir)/grub-core/script/yylex.l
|
||||
$(LEX) -o grub_script.yy.c --header-file=grub_script.yy.h $(top_srcdir)/grub-core/script/yylex.l
|
||||
grub_script.yy.c: grub_script.yy.h
|
||||
CLEANFILES += grub_script.yy.c grub_script.yy.h
|
||||
VasEBoot_script.yy.h: $(top_srcdir)/VasEBoot-core/script/yylex.l
|
||||
$(LEX) -o VasEBoot_script.yy.c --header-file=VasEBoot_script.yy.h $(top_srcdir)/VasEBoot-core/script/yylex.l
|
||||
VasEBoot_script.yy.c: VasEBoot_script.yy.h
|
||||
CLEANFILES += VasEBoot_script.yy.c VasEBoot_script.yy.h
|
||||
|
||||
# For libgrub.a
|
||||
libgrub.pp: grub_script.tab.h grub_script.yy.h $(libgrubmods_a_SOURCES) $(libgrubkern_a_SOURCES)
|
||||
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgrubmods_a_CPPFLAGS) $(libgrubkern_a_CPPFLAGS) $(CPPFLAGS) \
|
||||
-D'GRUB_MOD_INIT(x)=@MARKER@x@' $^ > $@ || (rm -f $@; exit 1)
|
||||
CLEANFILES += libgrub.pp
|
||||
# For libVasEBoot.a
|
||||
libVasEBoot.pp: VasEBoot_script.tab.h VasEBoot_script.yy.h $(libVasEBootmods_a_SOURCES) $(libVasEBootkern_a_SOURCES)
|
||||
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libVasEBootmods_a_CPPFLAGS) $(libVasEBootkern_a_CPPFLAGS) $(CPPFLAGS) \
|
||||
-D'VasEBoot_MOD_INIT(x)=@MARKER@x@' $^ > $@ || (rm -f $@; exit 1)
|
||||
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)
|
||||
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)
|
||||
CLEANFILES += libgrub_a_init.c
|
||||
CLEANFILES += libVasEBoot_a_init.c
|
||||
|
||||
# For grub-fstest
|
||||
grub_fstest.pp: $(grub_fstest_SOURCES)
|
||||
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(grub_fstest_CPPFLAGS) $(CPPFLAGS) \
|
||||
-D'GRUB_MOD_INIT(x)=@MARKER@x@' $^ > $@ || (rm -f $@; exit 1)
|
||||
CLEANFILES += grub_fstest.pp
|
||||
# For VasEBoot-fstest
|
||||
VasEBoot_fstest.pp: $(VasEBoot_fstest_SOURCES)
|
||||
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(VasEBoot_fstest_CPPFLAGS) $(CPPFLAGS) \
|
||||
-D'VasEBoot_MOD_INIT(x)=@MARKER@x@' $^ > $@ || (rm -f $@; exit 1)
|
||||
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)
|
||||
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)
|
||||
CLEANFILES += grub_fstest_init.c
|
||||
CLEANFILES += VasEBoot_fstest_init.c
|
||||
|
||||
if COND_HAVE_FONT_SOURCE
|
||||
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
|
||||
|
||||
build-grub-mkfont$(BUILD_EXEEXT): util/grub-mkfont.c grub-core/unidata.c grub-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)
|
||||
CLEANFILES += build-grub-mkfont$(BUILD_EXEEXT)
|
||||
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) -DVasEBoot_MKFONT=1 -DVasEBoot_BUILD=1 -DVasEBoot_UTIL=1 -DVasEBoot_BUILD_PROGRAM_NAME=\"build-VasEBoot-mkfont\" $^ $(build_freetype_cflags) $(build_freetype_libs)
|
||||
CLEANFILES += build-VasEBoot-mkfont$(BUILD_EXEEXT)
|
||||
|
||||
garbage-gen$(BUILD_EXEEXT): util/garbage-gen.c
|
||||
$(BUILD_CC) -o $@ $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) $^
|
||||
CLEANFILES += garbage-gen$(BUILD_EXEEXT)
|
||||
EXTRA_DIST += util/garbage-gen.c
|
||||
|
||||
build-grub-gen-asciih$(BUILD_EXEEXT): util/grub-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
|
||||
CLEANFILES += build-grub-gen-asciih$(BUILD_EXEEXT)
|
||||
build-VasEBoot-gen-asciih$(BUILD_EXEEXT): util/VasEBoot-gen-asciih.c
|
||||
$(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-VasEBoot-gen-asciih$(BUILD_EXEEXT)
|
||||
|
||||
build-grub-gen-widthspec$(BUILD_EXEEXT): util/grub-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
|
||||
CLEANFILES += build-grub-gen-widthspec$(BUILD_EXEEXT)
|
||||
build-VasEBoot-gen-widthspec$(BUILD_EXEEXT): util/VasEBoot-gen-widthspec.c
|
||||
$(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-VasEBoot-gen-widthspec$(BUILD_EXEEXT)
|
||||
|
||||
if COND_STARFIELD
|
||||
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)
|
||||
./build-grub-mkfont$(BUILD_EXEEXT) -s 10 -o $@ $(DJVU_FONT_SOURCE)
|
||||
dejavu_10.pf2: $(DJVU_FONT_SOURCE) build-VasEBoot-mkfont$(BUILD_EXEEXT)
|
||||
./build-VasEBoot-mkfont$(BUILD_EXEEXT) -s 10 -o $@ $(DJVU_FONT_SOURCE)
|
||||
CLEANFILES += dejavu_10.pf2
|
||||
dejavu_12.pf2: $(DJVU_FONT_SOURCE) build-grub-mkfont$(BUILD_EXEEXT)
|
||||
./build-grub-mkfont$(BUILD_EXEEXT) -s 12 -o $@ $(DJVU_FONT_SOURCE)
|
||||
dejavu_12.pf2: $(DJVU_FONT_SOURCE) build-VasEBoot-mkfont$(BUILD_EXEEXT)
|
||||
./build-VasEBoot-mkfont$(BUILD_EXEEXT) -s 12 -o $@ $(DJVU_FONT_SOURCE)
|
||||
CLEANFILES += dejavu_12.pf2
|
||||
dejavu_14.pf2: $(DJVU_FONT_SOURCE) build-grub-mkfont$(BUILD_EXEEXT)
|
||||
./build-grub-mkfont$(BUILD_EXEEXT) -s 14 -o $@ $(DJVU_FONT_SOURCE)
|
||||
dejavu_14.pf2: $(DJVU_FONT_SOURCE) build-VasEBoot-mkfont$(BUILD_EXEEXT)
|
||||
./build-VasEBoot-mkfont$(BUILD_EXEEXT) -s 14 -o $@ $(DJVU_FONT_SOURCE)
|
||||
CLEANFILES += dejavu_14.pf2
|
||||
dejavu_bold_14.pf2: $(DJVU_FONT_SOURCE) build-grub-mkfont$(BUILD_EXEEXT)
|
||||
./build-grub-mkfont$(BUILD_EXEEXT) -b -s 14 -o $@ $(DJVU_FONT_SOURCE)
|
||||
dejavu_bold_14.pf2: $(DJVU_FONT_SOURCE) build-VasEBoot-mkfont$(BUILD_EXEEXT)
|
||||
./build-VasEBoot-mkfont$(BUILD_EXEEXT) -b -s 14 -o $@ $(DJVU_FONT_SOURCE)
|
||||
CLEANFILES += dejavu_bold_14.pf2
|
||||
dejavu_16.pf2: $(DJVU_FONT_SOURCE) build-grub-mkfont$(BUILD_EXEEXT)
|
||||
./build-grub-mkfont$(BUILD_EXEEXT) -s 16 -o $@ $(DJVU_FONT_SOURCE)
|
||||
dejavu_16.pf2: $(DJVU_FONT_SOURCE) build-VasEBoot-mkfont$(BUILD_EXEEXT)
|
||||
./build-VasEBoot-mkfont$(BUILD_EXEEXT) -s 16 -o $@ $(DJVU_FONT_SOURCE)
|
||||
CLEANFILES += dejavu_16.pf2
|
||||
else
|
||||
starfield_DATA =
|
||||
|
|
@ -111,34 +111,34 @@ endif
|
|||
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
|
||||
|
||||
unicode.pf2: $(FONT_SOURCE) build-grub-mkfont$(BUILD_EXEEXT)
|
||||
./build-grub-mkfont$(BUILD_EXEEXT) -o $@ $(FONT_SOURCE) || (rm -f $@; exit 1)
|
||||
unicode.pf2: $(FONT_SOURCE) build-VasEBoot-mkfont$(BUILD_EXEEXT)
|
||||
./build-VasEBoot-mkfont$(BUILD_EXEEXT) -o $@ $(FONT_SOURCE) || (rm -f $@; exit 1)
|
||||
CLEANFILES += unicode.pf2
|
||||
|
||||
# Arrows and lines are needed to draw the menu, so always include them
|
||||
UNICODE_ARROWS=0x2190-0x2193
|
||||
UNICODE_LINES=0x2501-0x251B
|
||||
|
||||
ascii.pf2: $(FONT_SOURCE) build-grub-mkfont$(BUILD_EXEEXT)
|
||||
./build-grub-mkfont$(BUILD_EXEEXT) -o $@ $(FONT_SOURCE) -r 0x0-0x7f,$(UNICODE_ARROWS),$(UNICODE_LINES) || (rm -f $@; exit 1)
|
||||
ascii.pf2: $(FONT_SOURCE) build-VasEBoot-mkfont$(BUILD_EXEEXT)
|
||||
./build-VasEBoot-mkfont$(BUILD_EXEEXT) -o $@ $(FONT_SOURCE) -r 0x0-0x7f,$(UNICODE_ARROWS),$(UNICODE_LINES) || (rm -f $@; exit 1)
|
||||
CLEANFILES += ascii.pf2
|
||||
|
||||
euro.pf2: $(FONT_SOURCE) build-grub-mkfont$(BUILD_EXEEXT)
|
||||
./build-grub-mkfont$(BUILD_EXEEXT) -o $@ $(FONT_SOURCE) -r 0x0-0x4ff,0x1e00-0x1fff,$(UNICODE_ARROWS),$(UNICODE_LINES) || (rm -f $@; exit 1)
|
||||
euro.pf2: $(FONT_SOURCE) build-VasEBoot-mkfont$(BUILD_EXEEXT)
|
||||
./build-VasEBoot-mkfont$(BUILD_EXEEXT) -o $@ $(FONT_SOURCE) -r 0x0-0x4ff,0x1e00-0x1fff,$(UNICODE_ARROWS),$(UNICODE_LINES) || (rm -f $@; exit 1)
|
||||
CLEANFILES += euro.pf2
|
||||
|
||||
ascii.h: $(FONT_SOURCE) build-grub-gen-asciih$(BUILD_EXEEXT)
|
||||
./build-grub-gen-asciih$(BUILD_EXEEXT) $(FONT_SOURCE) $@ || (rm -f $@; exit 1)
|
||||
ascii.h: $(FONT_SOURCE) build-VasEBoot-gen-asciih$(BUILD_EXEEXT)
|
||||
./build-VasEBoot-gen-asciih$(BUILD_EXEEXT) $(FONT_SOURCE) $@ || (rm -f $@; exit 1)
|
||||
CLEANFILES += ascii.h
|
||||
|
||||
widthspec.h: $(FONT_SOURCE) build-grub-gen-widthspec$(BUILD_EXEEXT)
|
||||
./build-grub-gen-widthspec$(BUILD_EXEEXT) $(FONT_SOURCE) $@ || (rm -f $@; exit 1)
|
||||
widthspec.h: $(FONT_SOURCE) build-VasEBoot-gen-widthspec$(BUILD_EXEEXT)
|
||||
./build-VasEBoot-gen-widthspec$(BUILD_EXEEXT) $(FONT_SOURCE) $@ || (rm -f $@; exit 1)
|
||||
CLEANFILES += widthspec.h
|
||||
|
||||
# Install config.h into platformdir
|
||||
nodist_platform_HEADERS = config.h
|
||||
|
||||
pkgdata_DATA += grub-mkconfig_lib
|
||||
pkgdata_DATA += VasEBoot-mkconfig_lib
|
||||
|
||||
|
||||
if COND_real_platform
|
||||
|
|
@ -178,64 +178,64 @@ QEMU32=qemu-system-x86_64
|
|||
MINIMUM_CPU_LINUX=core2duo
|
||||
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)\"
|
||||
|
||||
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)\"
|
||||
|
||||
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)\"
|
||||
|
||||
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)\"
|
||||
|
||||
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)\"
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
kfreebsd.aout: kfreebsd.elf
|
||||
$(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
|
||||
|
||||
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 $< $@;
|
||||
|
||||
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
|
||||
|
||||
ntldr.bin: ntldr.elf
|
||||
$(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
|
||||
|
||||
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 $@
|
||||
|
||||
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 $@
|
||||
|
||||
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)\"
|
||||
|
||||
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)\"
|
||||
|
||||
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)\"
|
||||
|
||||
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)\"
|
||||
|
||||
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
|
||||
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
|
||||
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
|
||||
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)/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
|
||||
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 $@
|
||||
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)/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
|
||||
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 $@
|
||||
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)/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
|
||||
$(TARGET_OBJCOPY) --add-section=miniroot=$< $(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=$< $(VasEBoot_PAYLOADS_DIR)/knetbsd.miniroot.i386 $@
|
||||
|
||||
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
|
||||
|
||||
knetbsd.image.x86_64: knetbsd.init.x86_64 $(srcdir)/grub-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
|
||||
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)/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
|
||||
$(TARGET_OBJCOPY) --add-section=miniroot=$< $(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=$< $(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
|
||||
|
||||
kfreebsd-mfsroot.i386.gz: kfreebsd-mfsroot.i386.img
|
||||
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
|
||||
./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
|
||||
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
|
||||
./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
|
||||
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
|
||||
./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
|
||||
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
|
||||
./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
|
||||
gzip < $< > $@
|
||||
|
||||
bootcheck-knetbsd-i386: knetbsd.miniroot-image.i386.gz $(GRUB_PAYLOADS_DIR)/knetbsd.i386 $(srcdir)/grub-core/tests/boot/knetbsd.cfg grub-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
|
||||
bootcheck-knetbsd-i386: knetbsd.miniroot-image.i386.gz $(VasEBoot_PAYLOADS_DIR)/knetbsd.i386 $(srcdir)/VasEBoot-core/tests/boot/knetbsd.cfg VasEBoot-shell
|
||||
./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
|
||||
./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
|
||||
bootcheck-kopenbsd-i386: kopenbsd.image.i386 $(VasEBoot_PAYLOADS_DIR)/kopenbsd.i386 $(srcdir)/VasEBoot-core/tests/boot/kopenbsd.cfg VasEBoot-shell
|
||||
./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
|
||||
./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
|
||||
bootcheck-kopenbsd-x86_64: kopenbsd.image.x86_64 $(VasEBoot_PAYLOADS_DIR)/kopenbsd.x86_64 $(srcdir)/VasEBoot-core/tests/boot/kopenbsd.cfg VasEBoot-shell
|
||||
./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
|
||||
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
|
||||
./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
|
||||
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
|
||||
./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
|
||||
./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
|
||||
bootcheck-linux-i386: linux-initramfs.i386 $(VasEBoot_PAYLOADS_DIR)/linux.i386 $(srcdir)/VasEBoot-core/tests/boot/linux.cfg VasEBoot-shell
|
||||
./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
|
||||
./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
|
||||
bootcheck-linux-x86_64: linux-initramfs.x86_64 $(VasEBoot_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/VasEBoot-core/tests/boot/linux.cfg VasEBoot-shell
|
||||
./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
|
||||
./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
|
||||
bootcheck-linux-mips: linux-initramfs.mips $(VasEBoot_PAYLOADS_DIR)/linux.mips $(srcdir)/VasEBoot-core/tests/boot/linux.cfg VasEBoot-shell
|
||||
./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
|
||||
./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
|
||||
bootcheck-linux-ppc: linux-initramfs.ppc $(VasEBoot_PAYLOADS_DIR)/linux.ppc $(srcdir)/VasEBoot-core/tests/boot/linux.cfg VasEBoot-shell
|
||||
./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
|
||||
./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
|
||||
bootcheck-linux-mipsel: linux-initramfs.mipsel $(VasEBoot_PAYLOADS_DIR)/linux.mipsel $(srcdir)/VasEBoot-core/tests/boot/linux.cfg VasEBoot-shell
|
||||
./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
|
||||
./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
|
||||
bootcheck-linux-loongson: linux-initramfs.loongson $(VasEBoot_PAYLOADS_DIR)/linux.loongson $(srcdir)/VasEBoot-core/tests/boot/linux.cfg VasEBoot-shell
|
||||
./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
|
||||
./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
|
||||
bootcheck-linux16-i386: linux-initramfs.i386 $(VasEBoot_PAYLOADS_DIR)/linux.i386 $(srcdir)/VasEBoot-core/tests/boot/linux.cfg VasEBoot-shell
|
||||
./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
|
||||
./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
|
||||
bootcheck-linux16-x86_64: linux-initramfs.x86_64 $(VasEBoot_PAYLOADS_DIR)/linux.x86_64 $(srcdir)/VasEBoot-core/tests/boot/linux.cfg VasEBoot-shell
|
||||
./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
|
||||
./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
|
||||
bootcheck-multiboot: multiboot.elf $(srcdir)/VasEBoot-core/tests/boot/multiboot.cfg VasEBoot-shell
|
||||
./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
|
||||
./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
|
||||
bootcheck-multiboot2: multiboot2.elf $(srcdir)/VasEBoot-core/tests/boot/multiboot2.cfg VasEBoot-shell
|
||||
./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
|
||||
./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
|
||||
bootcheck-kfreebsd-aout: kfreebsd.aout $(srcdir)/VasEBoot-core/tests/boot/kfreebsd-aout.cfg VasEBoot-shell
|
||||
./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
|
||||
./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
|
||||
bootcheck-pc-chainloader: pc-chainloader.bin $(srcdir)/VasEBoot-core/tests/boot/pc-chainloader.cfg VasEBoot-shell
|
||||
./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
|
||||
./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
|
||||
bootcheck-ntldr: ntldr.bin $(srcdir)/VasEBoot-core/tests/boot/ntldr.cfg VasEBoot-shell
|
||||
./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
|
||||
# NetBSD has no support for finding ACPI on EFI
|
||||
|
|
@ -422,21 +422,21 @@ BOOTCHECK_TIMEOUT=180
|
|||
bootcheck: $(BOOTCHECKS)
|
||||
|
||||
if COND_i386_coreboot
|
||||
default_payload.elf: grub-mkstandalone grub-mkimage FORCE
|
||||
default_payload.elf: VasEBoot-mkstandalone VasEBoot-mkimage FORCE
|
||||
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
|
||||
|
||||
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: $(PROGRAMS) $(starfield_DATA) $(platform_DATA)
|
||||
test -d $(windowsdir) && rm -rf $(windowsdir) || true
|
||||
test -d $(windowsdir) || mkdir $(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/starfield || mkdir $(windowsdir)/themes/starfield
|
||||
for x in $(PROGRAMS); do \
|
||||
|
|
@ -449,7 +449,7 @@ windowsdir: $(PROGRAMS) $(starfield_DATA) $(platform_DATA)
|
|||
for x in $(starfield_DATA); do \
|
||||
cp -fp $$x $(windowsdir)/themes/starfield/$$(basename $$x); \
|
||||
done
|
||||
for x in $(GRUB_WINDOWS_EXTRA_DIST); do \
|
||||
for x in $(VasEBoot_WINDOWS_EXTRA_DIST); do \
|
||||
cp -fp $$x $(windowsdir); \
|
||||
done
|
||||
|
||||
|
|
@ -474,8 +474,8 @@ ChangeLog: FORCE
|
|||
|
||||
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
|
||||
(for x in tests/syslinux/ubuntu10.04_grub.cfg.in ; do cat $(srcdir)/"$$x"; done) | $(top_builddir)/config.status --file=$@:-
|
||||
CLEANFILES += tests/syslinux/ubuntu10.04_grub.cfg
|
||||
tests/syslinux/ubuntu10.04_VasEBoot.cfg: $(top_builddir)/config.status tests/syslinux/ubuntu10.04_VasEBoot.cfg.in
|
||||
(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_VasEBoot.cfg
|
||||
|
|
|
|||
1200
Makefile.util.def
1200
Makefile.util.def
File diff suppressed because it is too large
Load Diff
160
NEWS
160
NEWS
|
|
@ -21,13 +21,13 @@ New in 2.02:
|
|||
* LVM RAID1 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.
|
||||
* `spkmodem' output (simple data protocol using system speaker).
|
||||
* Handle Japanese special keys.
|
||||
* coreboot framebuffer.
|
||||
* 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.
|
||||
* New gfxmenu options for terminal window positioning, theme background
|
||||
image handling, and scrollbar padding, plus `item_pixmap_style' and
|
||||
|
|
@ -48,7 +48,7 @@ New in 2.02:
|
|||
interface.
|
||||
* Autoload `http' and `tftp' modules if necessary.
|
||||
* 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.
|
||||
* Support IPv6 Router Advertisement to configure default router.
|
||||
* New variable net_<interface>_next_server containing next server
|
||||
|
|
@ -71,11 +71,11 @@ New in 2.02:
|
|||
* New command `pcidump' for PCI platforms.
|
||||
* Improve opcode parsing in ACPI halt implementation.
|
||||
* Use the TSC as a possible time source on i386-ieee1275.
|
||||
* Merge PowerPC grub-mkrescue implementation with the common one.
|
||||
* Support grub-mkrescue on i386-ieee1275, sparc64, bootinfo machines such
|
||||
* Merge PowerPC VasEBoot-mkrescue implementation with the common one.
|
||||
* Support VasEBoot-mkrescue on i386-ieee1275, sparc64, bootinfo machines such
|
||||
as pSeries, and mips-arc.
|
||||
* Make grub-mkrescue better support Apple Intel Macs on CD.
|
||||
* Enable GRUB Legacy configuration file parsing on EFI.
|
||||
* Make VasEBoot-mkrescue better support Apple Intel Macs on CD.
|
||||
* Enable VasEBoot Legacy configuration file parsing on EFI.
|
||||
* Support halt for Loongson 2E.
|
||||
* ARM U-Boot and EFI ports.
|
||||
* Reorganise platform-dependent code in utilities to avoid #ifdef mess.
|
||||
|
|
@ -84,8 +84,8 @@ New in 2.02:
|
|||
* Fix EFI stack alignment.
|
||||
* ARM64 EFI port.
|
||||
* On Linux, read partition start offsets from sysfs if possible.
|
||||
* New grub-macbless utility, and better integration with Mac firmware in
|
||||
grub-install.
|
||||
* New VasEBoot-macbless utility, and better integration with Mac firmware in
|
||||
VasEBoot-install.
|
||||
* Support Yeeloong 3A.
|
||||
* Add `cpuid --pae' option to detect Physical Address Extension on x86.
|
||||
* Support for USB debug dongles.
|
||||
|
|
@ -118,36 +118,36 @@ New in 2.02:
|
|||
|
||||
* Scripting:
|
||||
* 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:
|
||||
* 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).
|
||||
* Fix inconsistent use of `GRUB_CRYPTODISK_ENABLE' and
|
||||
`GRUB_ENABLE_CRYPTODISK'; the latter is now used consistently.
|
||||
* grub-mount handles symbolic links to directories.
|
||||
* Support disabling submenus with `GRUB_DISABLE_SUBMENU' configuration key
|
||||
for grub-mkconfig.
|
||||
* grub-install, grub-mknetdir, grub-mkrescue, and grub-mkstandalone
|
||||
* Fix inconsistent use of `VasEBoot_CRYPTODISK_ENABLE' and
|
||||
`VasEBoot_ENABLE_CRYPTODISK'; the latter is now used consistently.
|
||||
* VasEBoot-mount handles symbolic links to directories.
|
||||
* Support disabling submenus with `VasEBoot_DISABLE_SUBMENU' configuration key
|
||||
for VasEBoot-mkconfig.
|
||||
* VasEBoot-install, VasEBoot-mknetdir, VasEBoot-mkrescue, and VasEBoot-mkstandalone
|
||||
rewritten in C. They should now work in supported non-Unix-like
|
||||
environments.
|
||||
* Native mingw support.
|
||||
* Ability to install on EFI under windows.
|
||||
* 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 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.
|
||||
* Set menu entry class to primary OS name returned by os-prober to display
|
||||
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
|
||||
4.0 or higher.
|
||||
|
||||
* 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.
|
||||
* Fix documentation build with Texinfo >= 5.1.
|
||||
* 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 mingw32 i386-* (other than already present i386-pc)
|
||||
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
|
||||
improvements to the build system.
|
||||
* Remove variable length arrays.
|
||||
|
|
@ -170,7 +170,7 @@ New in 2.02:
|
|||
system.
|
||||
* emu libusb support removed (was broken and unmaintained).
|
||||
* 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
|
||||
structure matches what boot-time module loader expects.
|
||||
* Do not require fonts on powerpc-ieee1275.
|
||||
|
|
@ -186,12 +186,12 @@ New in 2.00:
|
|||
|
||||
* New platforms:
|
||||
* Itanium port.
|
||||
* Fuloong2F support (including GRUB as firmware)
|
||||
* Fuloong2E support (except GRUB as firmware)
|
||||
* Fuloong2F support (including VasEBoot as firmware)
|
||||
* Fuloong2E support (except VasEBoot as firmware)
|
||||
* ARCS (SGI machines) 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
|
||||
defined.
|
||||
|
|
@ -250,8 +250,8 @@ New in 2.00:
|
|||
* Basic illumos and xnu autoconfig.
|
||||
|
||||
* Testing and debugging:
|
||||
* New grub-fstest commands: cat, zfsinfo, testload xnu_uuid
|
||||
* grub-fstest recursive directory compare for quickly checking that
|
||||
* New VasEBoot-fstest commands: cat, zfsinfo, testload xnu_uuid
|
||||
* VasEBoot-fstest recursive directory compare for quickly checking that
|
||||
a directory is read correctly.
|
||||
* Backtace on crash (if gdb module is loaded, x86 only)
|
||||
* Disk cache statistics gathering.
|
||||
|
|
@ -269,12 +269,12 @@ New in 2.00:
|
|||
|
||||
* Internationalisation:
|
||||
* Updated to Unicode 6.0.
|
||||
* $"..." syntax for translation in grub scripting language. This allows easy
|
||||
translation of grub.cfg at runtime.
|
||||
* $"..." syntax for translation in VasEBoot scripting language. This allows easy
|
||||
translation of VasEBoot.cfg at runtime.
|
||||
* Translations to many languages included in official distribution.
|
||||
|
||||
* 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.
|
||||
* $feature_* variables to condition scripts on available features.
|
||||
* Use of ids to identify menu entries.
|
||||
|
|
@ -282,16 +282,16 @@ New in 2.00:
|
|||
allowing easy loading of all of them.
|
||||
|
||||
* Installation:
|
||||
* grub-mknetdir script for easy creation of netbootable GRUB directory.
|
||||
* Itanium and mips support in grub-mkrescue.
|
||||
* grub-install support for all platforms except emu.
|
||||
* VasEBoot-mknetdir script for easy creation of netbootable VasEBoot directory.
|
||||
* Itanium and mips support in VasEBoot-mkrescue.
|
||||
* VasEBoot-install support for all platforms except emu.
|
||||
* PreP partition install support.
|
||||
* No files conflict between flavours (except grub-mkrescue for ppc). This
|
||||
allows easy install of GRUB for several platforms.
|
||||
* grub-mkstandalone script for easy creating of image including all modules
|
||||
* No files conflict between flavours (except VasEBoot-mkrescue for ppc). This
|
||||
allows easy install of VasEBoot for several platforms.
|
||||
* VasEBoot-mkstandalone script for easy creating of image including all modules
|
||||
for platforms with generous limit on image size.
|
||||
* 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).
|
||||
|
||||
|
|
@ -299,8 +299,8 @@ New in 2.00:
|
|||
|
||||
* Experimental support for compiling with Apple toolchain.
|
||||
|
||||
* grub-mkdevicemap removed. Now all devices are detected on invocation of
|
||||
any grub utility.
|
||||
* VasEBoot-mkdevicemap removed. Now all devices are detected on invocation of
|
||||
any VasEBoot utility.
|
||||
|
||||
New in 1.99:
|
||||
|
||||
|
|
@ -308,7 +308,7 @@ New in 1.99:
|
|||
|
||||
* New `lsapm' command (i386-pc only).
|
||||
|
||||
* Parser for GRUB Legacy configuration files.
|
||||
* Parser for VasEBoot Legacy configuration files.
|
||||
|
||||
* 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
|
||||
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.
|
||||
|
||||
|
|
@ -335,15 +335,15 @@ New in 1.99:
|
|||
|
||||
* Btrfs support.
|
||||
|
||||
* New `--boot-directory' option to `grub-install', `grub-reboot', and
|
||||
`grub-set-default', with clearer semantics than the previous
|
||||
* New `--boot-directory' option to `VasEBoot-install', `VasEBoot-reboot', and
|
||||
`VasEBoot-set-default', with clearer semantics than the previous
|
||||
`--root-directory' option.
|
||||
|
||||
* Rename CD-ROM device to "cd" on BIOS platforms.
|
||||
|
||||
* 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.
|
||||
|
||||
* New relocator. Allows for more kernel support and more
|
||||
|
|
@ -367,18 +367,18 @@ New in 1.99:
|
|||
|
||||
* 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.
|
||||
|
||||
* 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.
|
||||
|
||||
* 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,
|
||||
and USB serial support.
|
||||
|
|
@ -395,12 +395,12 @@ New in 1.99:
|
|||
|
||||
* 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.
|
||||
|
||||
* `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.
|
||||
|
||||
* 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.
|
||||
|
||||
* `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.
|
||||
|
||||
|
|
@ -423,17 +423,17 @@ New in 1.99:
|
|||
|
||||
* 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',
|
||||
multi-line quoted strings, positional parameters with `setparams',
|
||||
`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)'.
|
||||
|
||||
* 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:
|
||||
|
||||
|
|
@ -443,18 +443,18 @@ New in 1.98 - 2010-03-06:
|
|||
|
||||
* MIPS support.
|
||||
|
||||
* Saved default menu entry support, with new utilities `grub-reboot' and
|
||||
`grub-set-default'.
|
||||
* Saved default menu entry support, with new utilities `VasEBoot-reboot' and
|
||||
`VasEBoot-set-default'.
|
||||
|
||||
* Unit testing framework.
|
||||
|
||||
* 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.
|
||||
|
||||
|
|
@ -482,7 +482,7 @@ New in 1.97:
|
|||
|
||||
* 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.
|
||||
|
||||
|
|
@ -510,7 +510,7 @@ New in 1.97:
|
|||
* Create partmap.lst and use it to automatically load partition map
|
||||
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.
|
||||
|
||||
* The ATA driver supports devices bigger than 2 TiB.
|
||||
|
|
@ -525,26 +525,26 @@ New in 1.97:
|
|||
|
||||
* Support for direct access to AT keyboards.
|
||||
|
||||
* New utility `grub-fstest'.
|
||||
* New utility `VasEBoot-fstest'.
|
||||
|
||||
New in 1.96 - 2008-02-03:
|
||||
|
||||
* The license term is changed to GNU General Public License Version 3.
|
||||
|
||||
* grub-emu is made optional. Now you have to use
|
||||
`--enable-grub-emu' to enable it.
|
||||
* VasEBoot-emu is made optional. Now you have to use
|
||||
`--enable-VasEBoot-emu' to enable it.
|
||||
|
||||
* 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 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).
|
||||
|
||||
* 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.
|
||||
|
||||
* Add grub-install for EFI.
|
||||
* Add VasEBoot-install for EFI.
|
||||
|
||||
* Ported to the following new platforms: Efika, coreboot (a.k.a. LinuxBIOS),
|
||||
OLPC XO.
|
||||
|
|
@ -568,8 +568,8 @@ New in 1.95 - 2006-10-15:
|
|||
* Number partitions from 1 instead of 0. For instance, the first
|
||||
partition of "hd0" is now "hd0,1" but not "hd0,0".
|
||||
|
||||
* grub-probefs is renamed to grub-probe, and supports printing a
|
||||
guessed OS device name and a GRUB drive name.
|
||||
* VasEBoot-probefs is renamed to VasEBoot-probe, and supports printing a
|
||||
guessed OS device name and a VasEBoot drive name.
|
||||
|
||||
* 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,
|
||||
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
|
||||
command "export".
|
||||
|
|
@ -646,17 +646,17 @@ New in 1.91 - 2005-10-15:
|
|||
|
||||
* 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.
|
||||
|
||||
|
||||
New in 1.90 - 2005-08-07:
|
||||
|
||||
* Rename the project name PUPA to GRUB. Now this version is the
|
||||
developmental version of GRUB officially.
|
||||
* Rename the project name PUPA to VasEBoot. Now this version is the
|
||||
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
|
||||
PowerPC-based machines as well, if they use IEEE 1275
|
||||
|
|
|
|||
18
README
18
README
|
|
@ -1,20 +1,20 @@
|
|||
This is GRUB 2, the second version of the GRand Unified Bootloader.
|
||||
GRUB 2 is rewritten from scratch to make GNU GRUB cleaner, safer, more
|
||||
This is VasEBoot 2, the second version of the GRand Unified Bootloader.
|
||||
VasEBoot 2 is rewritten from scratch to make GNU VasEBoot cleaner, safer, more
|
||||
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
|
||||
GRUB 2 data and program files.
|
||||
VasEBoot 2 data and program files.
|
||||
|
||||
Please visit the official web page of GRUB 2, for more information.
|
||||
The URL is <http://www.gnu.org/software/grub/grub.html>.
|
||||
Please visit the official web page of VasEBoot 2, for more information.
|
||||
The URL is <http://www.gnu.org/software/VasEBoot/VasEBoot.html>.
|
||||
|
||||
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
|
||||
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:
|
||||
|
||||
info grub Introduction 'Changes from GRUB Legacy'
|
||||
info VasEBoot Introduction 'Changes from VasEBoot Legacy'
|
||||
|
|
|
|||
4
THANKS
4
THANKS
|
|
@ -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
|
||||
bugs.
|
||||
|
||||
The following people made especially gracious contributions of their
|
||||
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>
|
||||
Bibo Mao <bibo.mao@intel.com>
|
||||
|
|
|
|||
8
TODO
8
TODO
|
|
@ -1,9 +1,9 @@
|
|||
|
||||
Before working on improving GRUB, it's very important that you
|
||||
make contact with the core GRUB developers. Things herein might be
|
||||
Before working on improving VasEBoot, it's very important that you
|
||||
make contact with the core VasEBoot developers. Things herein might be
|
||||
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:
|
||||
|
||||
http://savannah.gnu.org/bugs/?group=grub
|
||||
http://savannah.gnu.org/bugs/?group=VasEBoot
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ CCAS=$(TARGET_CC)
|
|||
RANLIB=$(TARGET_RANLIB)
|
||||
STRIP=$(TARGET_STRIP)
|
||||
|
||||
MACHO2IMG=$(top_builddir)/grub-macho2img
|
||||
MACHO2IMG=$(top_builddir)/VasEBoot-macho2img
|
||||
|
||||
AM_CFLAGS = $(TARGET_CFLAGS)
|
||||
AM_LDFLAGS = $(TARGET_LDFLAGS)
|
||||
|
|
@ -26,22 +26,22 @@ CFLAGS_LIBRARY += $(CFLAGS_PLATFORM) -fno-builtin
|
|||
CPPFLAGS_LIBRARY += $(CPPFLAGS_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_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\" $^
|
||||
CLEANFILES += build-grub-pep2elf$(BUILD_EXEEXT)
|
||||
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) -DVasEBoot_BUILD=1 -DVasEBoot_TARGET_WORDSIZE=64 -DVasEBoot_UTIL=1 -DVasEBoot_BUILD_PROGRAM_NAME=\"build-VasEBoot-pep2elf\" $^
|
||||
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_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\" $^
|
||||
CLEANFILES += build-grub-pe2elf$(BUILD_EXEEXT)
|
||||
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) -DVasEBoot_BUILD=1 -DVasEBoot_TARGET_WORDSIZE=32 -DVasEBoot_UTIL=1 -DVasEBoot_BUILD_PROGRAM_NAME=\"build-VasEBoot-pe2elf\" $^
|
||||
CLEANFILES += build-VasEBoot-pe2elf$(BUILD_EXEEXT)
|
||||
|
||||
# gentrigtables
|
||||
gentrigtables$(BUILD_EXEEXT): gentrigtables.c
|
||||
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(BUILD_CFLAGS) $(BUILD_CPPFLAGS) $(BUILD_LDFLAGS) $< $(BUILD_LIBM)
|
||||
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_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\" $^
|
||||
CLEANFILES += build-grub-module-verifier$(BUILD_EXEEXT)
|
||||
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) -DVasEBoot_BUILD=1 -DVasEBoot_UTIL=1 -DVasEBoot_BUILD_PROGRAM_NAME=\"build-VasEBoot-module-verifier\" $^
|
||||
CLEANFILES += build-VasEBoot-module-verifier$(BUILD_EXEEXT)
|
||||
|
||||
# trigtables.c
|
||||
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
|
||||
|
||||
# XXX Use Automake's LEX & YACC support
|
||||
grub_script.tab.h: script/parser.y
|
||||
$(YACC) -d -p grub_script_yy -b grub_script $<
|
||||
grub_script.tab.c: grub_script.tab.h
|
||||
CLEANFILES += grub_script.tab.c grub_script.tab.h
|
||||
VasEBoot_script.tab.h: script/parser.y
|
||||
$(YACC) -d -p VasEBoot_script_yy -b VasEBoot_script $<
|
||||
VasEBoot_script.tab.c: VasEBoot_script.tab.h
|
||||
CLEANFILES += VasEBoot_script.tab.c VasEBoot_script.tab.h
|
||||
|
||||
# For the lexer.
|
||||
grub_script.yy.h: script/yylex.l
|
||||
$(LEX) -o grub_script.yy.c --header-file=grub_script.yy.h $<
|
||||
grub_script.yy.c: grub_script.yy.h
|
||||
VasEBoot_script.yy.h: script/yylex.l
|
||||
$(LEX) -o VasEBoot_script.yy.c --header-file=VasEBoot_script.yy.h $<
|
||||
VasEBoot_script.yy.c: VasEBoot_script.yy.h
|
||||
|
||||
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
|
||||
|
||||
CLEANFILES += grub_script.yy.c grub_script.yy.h
|
||||
CLEANFILES += VasEBoot_script.yy.c VasEBoot_script.yy.h
|
||||
|
||||
include $(srcdir)/Makefile.core.am
|
||||
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/cache.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/command.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/device.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/disk.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/dl.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env_private.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/err.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/file.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/fs.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i18n.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/kernel.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/list.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/misc.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/cache.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/command.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/device.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/disk.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/dl.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/env.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/env_private.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/err.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/file.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/fs.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/i18n.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/kernel.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/list.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/misc.h
|
||||
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
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/compiler-rt.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/compiler-rt.h
|
||||
endif
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/parser.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/partition.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/term.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/time.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm_private.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/net.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/tpm.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/memory.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/mm.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/parser.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/partition.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/term.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/time.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/mm_private.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/net.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/tpm.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/memory.h
|
||||
|
||||
if COND_i386_pc
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/pxe.h
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/int.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/VasEBoot/machine/kernel.h
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/VasEBoot/machine/pxe.h
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/VasEBoot/machine/int.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/i386/tsc.h
|
||||
endif
|
||||
|
||||
if COND_i386_efi
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pmtimer.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/efi/efi.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/efi/disk.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/i386/tsc.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/acpi.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/pci.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/i386/pmtimer.h
|
||||
endif
|
||||
|
||||
if COND_i386_coreboot
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/coreboot/lbio.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video_fb.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gfxterm.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/font.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bufio.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/i386/tsc.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/i386/coreboot/lbio.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/video.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/video_fb.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/gfxterm.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/font.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/bufio.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/acpi.h
|
||||
endif
|
||||
|
||||
if COND_i386_multiboot
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/i386/tsc.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/acpi.h
|
||||
endif
|
||||
|
||||
if COND_i386_qemu
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/pci.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/i386/tsc.h
|
||||
endif
|
||||
|
||||
if COND_i386_ieee1275
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/ieee1275/ieee1275.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/terminfo.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/extcmd.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/lib/arg.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/i386/tsc.h
|
||||
endif
|
||||
|
||||
if COND_i386_xen
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/xen.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/xen/hypercall.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/xen.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/i386/xen/hypercall.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/terminfo.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/extcmd.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/lib/arg.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/loader.h
|
||||
endif
|
||||
|
||||
if COND_x86_64_xen
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/xen.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/x86_64/xen/hypercall.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/xen.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/x86_64/xen/hypercall.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/terminfo.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/extcmd.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/lib/arg.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/loader.h
|
||||
endif
|
||||
|
||||
if COND_x86_64_efi
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/tsc.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pmtimer.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/efi/efi.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/efi/disk.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/i386/tsc.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/pci.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/acpi.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/i386/pmtimer.h
|
||||
endif
|
||||
|
||||
if COND_ia64_efi
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/efi/efi.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/efi/disk.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/acpi.h
|
||||
endif
|
||||
|
||||
if COND_mips
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/kernel.h
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/VasEBoot/cpu/kernel.h
|
||||
endif
|
||||
|
||||
if COND_mips_arc
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arc/arc.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/extcmd.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/arc/arc.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/terminfo.h
|
||||
endif
|
||||
|
||||
if COND_mips_qemu_mips
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/keyboard_layouts.h
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/serial.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/VasEBoot/keyboard_layouts.h
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/VasEBoot/machine/kernel.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/serial.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/loader.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/terminfo.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/extcmd.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/lib/arg.h
|
||||
endif
|
||||
|
||||
if COND_mips_loongson
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/keyboard_layouts.h
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/time.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video_fb.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gfxterm.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/font.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bufio.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/cs5536.h
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/pci.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/serial.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/VasEBoot/keyboard_layouts.h
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/VasEBoot/machine/kernel.h
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/VasEBoot/machine/time.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/video.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/video_fb.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/gfxterm.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/font.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/bufio.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/pci.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/cs5536.h
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/VasEBoot/machine/pci.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/serial.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/loader.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/terminfo.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/extcmd.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/lib/arg.h
|
||||
endif
|
||||
|
||||
if COND_mips_qemu_mips
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/VasEBoot/machine/memory.h
|
||||
KERNEL_HEADER_FILES += $(top_builddir)/include/VasEBoot/machine/kernel.h
|
||||
endif
|
||||
|
||||
if COND_powerpc_ieee1275
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/ieee1275/ieee1275.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/terminfo.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/extcmd.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/lib/arg.h
|
||||
endif
|
||||
|
||||
if COND_sparc64_ieee1275
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sparc64/ieee1275/ieee1275.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/ieee1275/ieee1275.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/sparc64/ieee1275/ieee1275.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/terminfo.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/extcmd.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/lib/arg.h
|
||||
endif
|
||||
|
||||
if COND_arm_uboot
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/uboot/uboot.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/uboot/disk.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/lib/arg.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/system.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/uboot/uboot.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/uboot/disk.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/extcmd.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/lib/arg.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/arm/system.h
|
||||
endif
|
||||
|
||||
if COND_arm_efi
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/efi/loader.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/arm/system.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/arm/efi/loader.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/efi/efi.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/efi/disk.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/arm/system.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/acpi.h
|
||||
endif
|
||||
|
||||
if COND_arm64_efi
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/acpi.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/efi/efi.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/efi/disk.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/acpi.h
|
||||
endif
|
||||
|
||||
if COND_emu
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/datetime.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/misc.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/net.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/hostdisk.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/hostfile.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/extcmd.h
|
||||
if COND_GRUB_EMU_SDL
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sdl.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/datetime.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/emu/misc.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/emu/net.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/emu/hostdisk.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/emu/hostfile.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/extcmd.h
|
||||
if COND_VasEBoot_EMU_SDL
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/sdl.h
|
||||
endif
|
||||
if COND_GRUB_EMU_PCI
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libpciaccess.h
|
||||
if COND_VasEBoot_EMU_PCI
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/VasEBoot/libpciaccess.h
|
||||
endif
|
||||
endif
|
||||
|
||||
|
|
@ -278,7 +278,7 @@ CLEANFILES += symlist.h
|
|||
BUILT_SOURCES += symlist.h
|
||||
|
||||
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)
|
||||
rm -f symlist.p
|
||||
CLEANFILES += symlist.c
|
||||
|
|
@ -293,7 +293,7 @@ endif
|
|||
noinst_DATA += kernel_syms.lst
|
||||
|
||||
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 \
|
||||
-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;}' \
|
||||
|
|
@ -302,18 +302,18 @@ kernel_syms.lst: $(KERNEL_HEADER_FILES) $(top_builddir)/config.h
|
|||
CLEANFILES += kernel_syms.lst
|
||||
|
||||
if COND_emu
|
||||
kern/emu/grub_emu-main.$(OBJEXT):grub_emu_init.h
|
||||
grub_emu-grub_emu_init.$(OBJEXT):grub_emu_init.h
|
||||
kern/emu/grub_emu_dyn-main.$(OBJEXT):grub_emu_init.h
|
||||
grub_emu_dyn-grub_emu_init.$(OBJEXT):grub_emu_init.h
|
||||
kern/emu/VasEBoot_emu-main.$(OBJEXT):VasEBoot_emu_init.h
|
||||
VasEBoot_emu-VasEBoot_emu_init.$(OBJEXT):VasEBoot_emu_init.h
|
||||
kern/emu/VasEBoot_emu_dyn-main.$(OBJEXT):VasEBoot_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) > $@
|
||||
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) > $@
|
||||
CLEANFILES += grub_emu_init.c
|
||||
CLEANFILES += VasEBoot_emu_init.c
|
||||
endif
|
||||
|
||||
# List files
|
||||
|
|
@ -379,7 +379,7 @@ platform_DATA += video.lst
|
|||
CLEANFILES += video.lst
|
||||
|
||||
# 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 $^ $@
|
||||
platform_DATA += crypto.lst
|
||||
CLEANFILES += crypto.lst
|
||||
|
|
@ -397,7 +397,7 @@ moddep.lst: syminfo.lst genmoddep.awk video.lst
|
|||
platform_DATA += 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 $^ $@
|
||||
platform_DATA += $(MOD_FILES)
|
||||
platform_DATA += modinfo.sh
|
||||
|
|
|
|||
|
|
@ -26,14 +26,14 @@ transform_data = {
|
|||
|
||||
transform_data = {
|
||||
installdir = platform;
|
||||
name = gdb_grub;
|
||||
common = gdb_grub.in;
|
||||
name = gdb_VasEBoot;
|
||||
common = gdb_VasEBoot.in;
|
||||
};
|
||||
|
||||
transform_data = {
|
||||
installdir = platform;
|
||||
name = grub.chrp;
|
||||
common = boot/powerpc/grub.chrp.in;
|
||||
name = VasEBoot.chrp;
|
||||
common = boot/powerpc/VasEBoot.chrp.in;
|
||||
enable = powerpc_ieee1275;
|
||||
};
|
||||
|
||||
|
|
@ -86,8 +86,8 @@ kernel = {
|
|||
mips_arc_ldflags = '-Wl,-Ttext,$(TARGET_LINK_ADDR)';
|
||||
mips_qemu_mips_ldflags = '-Wl,-Ttext,0x80200000';
|
||||
|
||||
mips_arc_cppflags = '-DGRUB_DECOMPRESSOR_LINK_ADDR=$(TARGET_DECOMPRESSOR_LINK_ADDR)';
|
||||
i386_qemu_cppflags = '-DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)';
|
||||
mips_arc_cppflags = '-DVasEBoot_DECOMPRESSOR_LINK_ADDR=$(TARGET_DECOMPRESSOR_LINK_ADDR)';
|
||||
i386_qemu_cppflags = '-DVasEBoot_BOOT_MACHINE_LINK_ADDR=$(VasEBoot_BOOT_MACHINE_LINK_ADDR)';
|
||||
emu_cflags = '$(CFLAGS_GNULIB)';
|
||||
emu_cppflags = '$(CPPFLAGS_GNULIB)';
|
||||
arm_uboot_ldflags = '-Wl,-r,-d';
|
||||
|
|
@ -334,11 +334,11 @@ kernel = {
|
|||
};
|
||||
|
||||
program = {
|
||||
name = grub-emu;
|
||||
name = VasEBoot-emu;
|
||||
mansection = 1;
|
||||
|
||||
emu = kern/emu/full.c;
|
||||
emu_nodist = grub_emu_init.c;
|
||||
emu_nodist = VasEBoot_emu_init.c;
|
||||
|
||||
ldadd = 'kernel.exec$(EXEEXT)';
|
||||
ldadd = '$(MODULE_FILES)';
|
||||
|
|
@ -348,7 +348,7 @@ program = {
|
|||
};
|
||||
|
||||
program = {
|
||||
name = grub-emu-lite;
|
||||
name = VasEBoot-emu-lite;
|
||||
|
||||
emu = kern/emu/lite.c;
|
||||
emu_nodist = symlist.c;
|
||||
|
|
@ -369,8 +369,8 @@ image = {
|
|||
i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x7C00';
|
||||
|
||||
i386_qemu_ldflags = '$(TARGET_IMG_LDFLAGS)';
|
||||
i386_qemu_ldflags = '$(TARGET_IMG_BASE_LDOPT),$(GRUB_BOOT_MACHINE_LINK_ADDR)';
|
||||
i386_qemu_ccasflags = '-DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)';
|
||||
i386_qemu_ldflags = '$(TARGET_IMG_BASE_LDOPT),$(VasEBoot_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_ldflags = ' -Wl,-Ttext=0x4000';
|
||||
|
|
@ -460,7 +460,7 @@ image = {
|
|||
common = lib/xzembed/xz_dec_stream.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';
|
||||
mips_ldflags = '-Wl,-Ttext,$(TARGET_DECOMPRESSOR_LINK_ADDR)';
|
||||
|
|
@ -473,7 +473,7 @@ image = {
|
|||
mips = boot/mips/startup_raw.S;
|
||||
common = boot/decompressor/none.c;
|
||||
|
||||
cppflags = '-DGRUB_EMBED_DECOMPRESSOR=1';
|
||||
cppflags = '-DVasEBoot_EMBED_DECOMPRESSOR=1';
|
||||
|
||||
objcopyflags = '-O binary';
|
||||
mips_ldflags = '-Wl,-Ttext,$(TARGET_DECOMPRESSOR_LINK_ADDR)';
|
||||
|
|
@ -606,7 +606,7 @@ module = {
|
|||
common = commands/lspci.c;
|
||||
|
||||
enable = emu;
|
||||
condition = COND_GRUB_EMU_PCI;
|
||||
condition = COND_VasEBoot_EMU_PCI;
|
||||
};
|
||||
|
||||
module = {
|
||||
|
|
@ -1557,7 +1557,7 @@ module = {
|
|||
name = crypto;
|
||||
common = lib/crypto.c;
|
||||
|
||||
extra_dist = lib/libgcrypt-grub/cipher/crypto.lst;
|
||||
extra_dist = lib/libgcrypt-VasEBoot/cipher/crypto.lst;
|
||||
};
|
||||
|
||||
module = {
|
||||
|
|
@ -1688,7 +1688,7 @@ module = {
|
|||
|
||||
module = {
|
||||
name = multiboot2;
|
||||
cppflags = "-DGRUB_USE_MULTIBOOT2";
|
||||
cppflags = "-DVasEBoot_USE_MULTIBOOT2";
|
||||
|
||||
common = loader/multiboot.c;
|
||||
common = lib/cmdline.c;
|
||||
|
|
@ -1856,10 +1856,10 @@ module = {
|
|||
common = commands/menuentry.c;
|
||||
|
||||
common = unidata.c;
|
||||
common_nodist = grub_script.tab.c;
|
||||
common_nodist = grub_script.yy.c;
|
||||
common_nodist = grub_script.tab.h;
|
||||
common_nodist = grub_script.yy.h;
|
||||
common_nodist = VasEBoot_script.tab.c;
|
||||
common_nodist = VasEBoot_script.yy.c;
|
||||
common_nodist = VasEBoot_script.tab.h;
|
||||
common_nodist = VasEBoot_script.yy.h;
|
||||
|
||||
extra_dist = script/yylex.l;
|
||||
extra_dist = script/parser.y;
|
||||
|
|
@ -2184,7 +2184,7 @@ module = {
|
|||
name = sdl;
|
||||
emu = video/emu/sdl.c;
|
||||
enable = emu;
|
||||
condition = COND_GRUB_EMU_SDL;
|
||||
condition = COND_VasEBoot_EMU_SDL;
|
||||
};
|
||||
|
||||
module = {
|
||||
|
|
@ -2348,28 +2348,28 @@ module = {
|
|||
|
||||
module = {
|
||||
name = mpi;
|
||||
common = lib/libgcrypt-grub/mpi/mpiutil.c;
|
||||
common = lib/libgcrypt-grub/mpi/mpi-bit.c;
|
||||
common = lib/libgcrypt-grub/mpi/mpi-add.c;
|
||||
common = lib/libgcrypt-grub/mpi/mpi-mul.c;
|
||||
common = lib/libgcrypt-grub/mpi/mpi-mod.c;
|
||||
common = lib/libgcrypt-grub/mpi/mpi-gcd.c;
|
||||
common = lib/libgcrypt-grub/mpi/mpi-div.c;
|
||||
common = lib/libgcrypt-grub/mpi/mpi-cmp.c;
|
||||
common = lib/libgcrypt-grub/mpi/mpi-inv.c;
|
||||
common = lib/libgcrypt-grub/mpi/mpi-pow.c;
|
||||
common = lib/libgcrypt-grub/mpi/mpi-mpow.c;
|
||||
common = lib/libgcrypt-grub/mpi/mpih-lshift.c;
|
||||
common = lib/libgcrypt-grub/mpi/mpih-mul.c;
|
||||
common = lib/libgcrypt-grub/mpi/mpih-mul1.c;
|
||||
common = lib/libgcrypt-grub/mpi/mpih-mul2.c;
|
||||
common = lib/libgcrypt-grub/mpi/mpih-mul3.c;
|
||||
common = lib/libgcrypt-grub/mpi/mpih-add1.c;
|
||||
common = lib/libgcrypt-grub/mpi/mpih-sub1.c;
|
||||
common = lib/libgcrypt-grub/mpi/mpih-div.c;
|
||||
common = lib/libgcrypt-grub/mpi/mpicoder.c;
|
||||
common = lib/libgcrypt-grub/mpi/mpih-rshift.c;
|
||||
common = lib/libgcrypt-grub/mpi/mpi-inline.c;
|
||||
common = lib/libgcrypt-VasEBoot/mpi/mpiutil.c;
|
||||
common = lib/libgcrypt-VasEBoot/mpi/mpi-bit.c;
|
||||
common = lib/libgcrypt-VasEBoot/mpi/mpi-add.c;
|
||||
common = lib/libgcrypt-VasEBoot/mpi/mpi-mul.c;
|
||||
common = lib/libgcrypt-VasEBoot/mpi/mpi-mod.c;
|
||||
common = lib/libgcrypt-VasEBoot/mpi/mpi-gcd.c;
|
||||
common = lib/libgcrypt-VasEBoot/mpi/mpi-div.c;
|
||||
common = lib/libgcrypt-VasEBoot/mpi/mpi-cmp.c;
|
||||
common = lib/libgcrypt-VasEBoot/mpi/mpi-inv.c;
|
||||
common = lib/libgcrypt-VasEBoot/mpi/mpi-pow.c;
|
||||
common = lib/libgcrypt-VasEBoot/mpi/mpi-mpow.c;
|
||||
common = lib/libgcrypt-VasEBoot/mpi/mpih-lshift.c;
|
||||
common = lib/libgcrypt-VasEBoot/mpi/mpih-mul.c;
|
||||
common = lib/libgcrypt-VasEBoot/mpi/mpih-mul1.c;
|
||||
common = lib/libgcrypt-VasEBoot/mpi/mpih-mul2.c;
|
||||
common = lib/libgcrypt-VasEBoot/mpi/mpih-mul3.c;
|
||||
common = lib/libgcrypt-VasEBoot/mpi/mpih-add1.c;
|
||||
common = lib/libgcrypt-VasEBoot/mpi/mpih-sub1.c;
|
||||
common = lib/libgcrypt-VasEBoot/mpi/mpih-div.c;
|
||||
common = lib/libgcrypt-VasEBoot/mpi/mpicoder.c;
|
||||
common = lib/libgcrypt-VasEBoot/mpi/mpih-rshift.c;
|
||||
common = lib/libgcrypt-VasEBoot/mpi/mpi-inline.c;
|
||||
common = lib/libgcrypt_wrap/mem.c;
|
||||
|
||||
cflags = '$(CFLAGS_GCRY) -Wno-redundant-decls -Wno-sign-compare';
|
||||
|
|
|
|||
|
|
@ -1,36 +1,36 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/decompressor.h>
|
||||
#include <VasEBoot/types.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/decompressor.h>
|
||||
|
||||
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--)
|
||||
*ptr = c;
|
||||
return s;
|
||||
}
|
||||
|
||||
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;
|
||||
const char *s = (const char *) src;
|
||||
|
|
@ -51,7 +51,7 @@ grub_memmove (void *dest, const void *src, grub_size_t n)
|
|||
}
|
||||
|
||||
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 *t2 = s2;
|
||||
|
|
@ -68,7 +68,7 @@ grub_memcmp (const void *s1, const void *s2, grub_size_t n)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void *grub_decompressor_scratch;
|
||||
void *VasEBoot_decompressor_scratch;
|
||||
|
||||
void
|
||||
find_scratch (void *src, void *dst, unsigned long srcsize,
|
||||
|
|
@ -76,18 +76,18 @@ find_scratch (void *src, void *dst, unsigned long srcsize,
|
|||
{
|
||||
#ifdef _mips
|
||||
/* 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);
|
||||
return;
|
||||
}
|
||||
#endif
|
||||
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);
|
||||
else
|
||||
grub_decompressor_scratch = (void *) ALIGN_UP ((grub_addr_t) dst + dstsize,
|
||||
VasEBoot_decompressor_scratch = (void *) ALIGN_UP ((VasEBoot_addr_t) dst + dstsize,
|
||||
256);
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,25 +1,25 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/decompressor.h>
|
||||
#include <VasEBoot/decompressor.h>
|
||||
|
||||
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)))
|
||||
{
|
||||
char *d = (char *) dest;
|
||||
|
|
|
|||
|
|
@ -1,30 +1,30 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/decompressor.h>
|
||||
#include <VasEBoot/types.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/decompressor.h>
|
||||
|
||||
#include "xz.h"
|
||||
#include "xz_stream.h"
|
||||
|
||||
void
|
||||
grub_decompress_core (void *src, void *dst, unsigned long srcsize,
|
||||
VasEBoot_decompress_core (void *src, void *dst, unsigned long srcsize,
|
||||
unsigned long dstsize)
|
||||
{
|
||||
struct xz_dec *dec;
|
||||
|
|
@ -32,7 +32,7 @@ grub_decompress_core (void *src, void *dst, unsigned long srcsize,
|
|||
|
||||
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_pos = 0;
|
||||
|
|
|
|||
|
|
@ -1,24 +1,24 @@
|
|||
/* -*-Asm-*- */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/machine/boot.h>
|
||||
#include <VasEBoot/symbol.h>
|
||||
#include <VasEBoot/machine/boot.h>
|
||||
|
||||
/*
|
||||
* defines for the code go here
|
||||
|
|
@ -72,7 +72,7 @@ fd_probe_error_string: .asciz "Floppy"
|
|||
|
||||
1:
|
||||
/* perform read */
|
||||
movw MACRO_DOLLAR(GRUB_BOOT_MACHINE_BUFFER_SEG), %bx
|
||||
movw MACRO_DOLLAR(VasEBoot_BOOT_MACHINE_BUFFER_SEG), %bx
|
||||
movw %bx, %es
|
||||
xorw %bx, %bx
|
||||
movw MACRO_DOLLAR(0x201), %ax
|
||||
|
|
@ -169,7 +169,7 @@ start:
|
|||
* this area.
|
||||
*/
|
||||
|
||||
.org GRUB_BOOT_MACHINE_BPB_START
|
||||
.org VasEBoot_BOOT_MACHINE_BPB_START
|
||||
.org 4
|
||||
#endif
|
||||
#ifdef HYBRID_BOOT
|
||||
|
|
@ -178,23 +178,23 @@ start:
|
|||
scratch
|
||||
#endif
|
||||
|
||||
.org GRUB_BOOT_MACHINE_BPB_END
|
||||
.org VasEBoot_BOOT_MACHINE_BPB_END
|
||||
/*
|
||||
* End of BIOS parameter block.
|
||||
*/
|
||||
|
||||
LOCAL(kernel_address):
|
||||
.word GRUB_BOOT_MACHINE_KERNEL_ADDR
|
||||
.word VasEBoot_BOOT_MACHINE_KERNEL_ADDR
|
||||
|
||||
#ifndef HYBRID_BOOT
|
||||
.org GRUB_BOOT_MACHINE_KERNEL_SECTOR
|
||||
.org VasEBoot_BOOT_MACHINE_KERNEL_SECTOR
|
||||
LOCAL(kernel_sector):
|
||||
.long 1
|
||||
LOCAL(kernel_sector_high):
|
||||
.long 0
|
||||
#endif
|
||||
|
||||
.org GRUB_BOOT_MACHINE_BOOT_DRIVE
|
||||
.org VasEBoot_BOOT_MACHINE_BOOT_DRIVE
|
||||
boot_drive:
|
||||
.byte 0xff /* the disk to load kernel from */
|
||||
/* 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
|
||||
* 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
|
||||
* 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).
|
||||
*/
|
||||
.org GRUB_BOOT_MACHINE_DRIVE_CHECK
|
||||
.org VasEBoot_BOOT_MACHINE_DRIVE_CHECK
|
||||
boot_drive_check:
|
||||
jmp 3f /* grub-setup may overwrite this jump */
|
||||
jmp 3f /* VasEBoot-setup may overwrite this jump */
|
||||
testb $0x80, %dl
|
||||
jz 2f
|
||||
3:
|
||||
|
|
@ -238,7 +238,7 @@ real_start:
|
|||
movw %ax, %ss
|
||||
|
||||
/* set up the REAL stack */
|
||||
movw $GRUB_BOOT_MACHINE_STACK_SEG, %sp
|
||||
movw $VasEBoot_BOOT_MACHINE_STACK_SEG, %sp
|
||||
|
||||
sti /* we're safe again */
|
||||
|
||||
|
|
@ -302,7 +302,7 @@ LOCAL(lba_mode):
|
|||
movl %ebx, 12(%si)
|
||||
|
||||
/* 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
|
||||
|
|
@ -319,7 +319,7 @@ LOCAL(lba_mode):
|
|||
/* LBA read is not supported, so fallback to CHS. */
|
||||
jc LOCAL(chs_mode)
|
||||
|
||||
movw $GRUB_BOOT_MACHINE_BUFFER_SEG, %bx
|
||||
movw $VasEBoot_BOOT_MACHINE_BUFFER_SEG, %bx
|
||||
jmp LOCAL(copy_buffer)
|
||||
|
||||
LOCAL(chs_mode):
|
||||
|
|
@ -427,7 +427,7 @@ setup_sectors:
|
|||
* %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 */
|
||||
|
||||
xorw %bx, %bx /* %bx = 0, put it at 0 in the segment */
|
||||
|
|
@ -449,7 +449,7 @@ LOCAL(copy_buffer):
|
|||
movw $0x100, %cx
|
||||
movw %bx, %ds
|
||||
xorw %si, %si
|
||||
movw $GRUB_BOOT_MACHINE_KERNEL_ADDR, %di
|
||||
movw $VasEBoot_BOOT_MACHINE_KERNEL_ADDR, %di
|
||||
movw %si, %es
|
||||
|
||||
cld
|
||||
|
|
@ -469,7 +469,7 @@ LOCAL(copy_buffer):
|
|||
jnz boot /* No TPM or TPM deactivated */
|
||||
|
||||
movw $0xBB07, %ax /* TCG_CompactHashLogExtendEvent */
|
||||
movw $GRUB_BOOT_MACHINE_KERNEL_ADDR, %di
|
||||
movw $VasEBoot_BOOT_MACHINE_KERNEL_ADDR, %di
|
||||
xorl %esi, %esi
|
||||
movl $0x41504354, %ebx /* TCPA */
|
||||
movl $0x200, %ecx /* Measure 512 bytes */
|
||||
|
|
@ -506,7 +506,7 @@ LOCAL(general_error):
|
|||
LOCAL(stop):
|
||||
jmp LOCAL(stop)
|
||||
|
||||
notification_string: .asciz "GRUB "
|
||||
notification_string: .asciz "VasEBoot "
|
||||
geometry_error_string: .asciz "Geom"
|
||||
hd_probe_error_string: .asciz "Hard Disk"
|
||||
read_error_string: .asciz "Read"
|
||||
|
|
@ -545,7 +545,7 @@ LOCAL(kernel_sector):
|
|||
LOCAL(kernel_sector_high):
|
||||
.long 0
|
||||
#endif
|
||||
.org GRUB_BOOT_MACHINE_WINDOWS_NT_MAGIC
|
||||
.org VasEBoot_BOOT_MACHINE_WINDOWS_NT_MAGIC
|
||||
nt_magic:
|
||||
.long 0
|
||||
.word 0
|
||||
|
|
@ -556,7 +556,7 @@ nt_magic:
|
|||
* sneaky, huh?
|
||||
*/
|
||||
|
||||
.org GRUB_BOOT_MACHINE_PART_START
|
||||
.org VasEBoot_BOOT_MACHINE_PART_START
|
||||
|
||||
#ifndef HYBRID_BOOT
|
||||
floppy
|
||||
|
|
@ -564,7 +564,7 @@ nt_magic:
|
|||
scratch
|
||||
#endif
|
||||
|
||||
.org GRUB_BOOT_MACHINE_PART_END
|
||||
.org VasEBoot_BOOT_MACHINE_PART_END
|
||||
|
||||
/* the last 2 bytes in the sector 0 contain the signature */
|
||||
.word GRUB_BOOT_MACHINE_SIGNATURE
|
||||
.word VasEBoot_BOOT_MACHINE_SIGNATURE
|
||||
|
|
|
|||
|
|
@ -1,31 +1,31 @@
|
|||
/* -*-Asm-*- */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/machine/boot.h>
|
||||
#include <grub/machine/kernel.h>
|
||||
#include <VasEBoot/symbol.h>
|
||||
#include <VasEBoot/machine/boot.h>
|
||||
#include <VasEBoot/machine/kernel.h>
|
||||
#include <multiboot.h>
|
||||
|
||||
.file "cdboot.S"
|
||||
|
||||
#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 CDBLK_LENG 16
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/machine/boot.h>
|
||||
#include <VasEBoot/symbol.h>
|
||||
#include <VasEBoot/machine/boot.h>
|
||||
|
||||
#define TPM 1
|
||||
|
||||
|
|
@ -132,7 +132,7 @@ LOCAL(setup_sectors):
|
|||
movl %ecx, 12(%si)
|
||||
|
||||
/* 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! */
|
||||
pushw %ax
|
||||
|
|
@ -154,7 +154,7 @@ LOCAL(setup_sectors):
|
|||
|
||||
jc LOCAL(read_error)
|
||||
|
||||
movw $GRUB_BOOT_MACHINE_BUFFER_SEG, %bx
|
||||
movw $VasEBoot_BOOT_MACHINE_BUFFER_SEG, %bx
|
||||
jmp LOCAL(copy_buffer)
|
||||
|
||||
LOCAL(chs_mode):
|
||||
|
|
@ -249,7 +249,7 @@ LOCAL(chs_mode):
|
|||
* %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 */
|
||||
|
||||
xorw %bx, %bx /* %bx = 0, put it at 0 in the segment */
|
||||
|
|
@ -304,7 +304,7 @@ LOCAL(copy_buffer):
|
|||
jne LOCAL(setup_sectors)
|
||||
|
||||
/* update position to load from */
|
||||
subw $GRUB_BOOT_MACHINE_LIST_SIZE, %di
|
||||
subw $VasEBoot_BOOT_MACHINE_LIST_SIZE, %di
|
||||
|
||||
/* jump to bootloop */
|
||||
jmp LOCAL(bootloop)
|
||||
|
|
@ -321,7 +321,7 @@ LOCAL(bootit):
|
|||
|
||||
/* We've already measured the first 512 bytes, now measure the rest */
|
||||
xorl %edi, %edi
|
||||
movw $(GRUB_BOOT_MACHINE_KERNEL_ADDR + 0x200), %di
|
||||
movw $(VasEBoot_BOOT_MACHINE_KERNEL_ADDR + 0x200), %di
|
||||
|
||||
movl $0x41504354, %ebx /* EBX = "TCPA" */
|
||||
|
||||
|
|
@ -338,7 +338,7 @@ LOCAL(bootit):
|
|||
/* print a newline */
|
||||
MSG(notification_done)
|
||||
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
|
||||
|
||||
.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!!! */
|
||||
/* fill the first data listing with the default */
|
||||
blocklist_default_start:
|
||||
|
|
@ -414,9 +414,9 @@ blocklist_default_start:
|
|||
the start of the disk, sector 0 */
|
||||
.long 2, 0
|
||||
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 */
|
||||
.word 0
|
||||
blocklist_default_seg:
|
||||
/* 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)
|
||||
|
|
|
|||
|
|
@ -1,33 +1,33 @@
|
|||
/* -*-Asm-*- */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/machine/boot.h>
|
||||
#include <grub/machine/kernel.h>
|
||||
#include <VasEBoot/symbol.h>
|
||||
#include <VasEBoot/machine/boot.h>
|
||||
#include <VasEBoot/machine/kernel.h>
|
||||
#include <multiboot.h>
|
||||
|
||||
.file "lnxboot.S"
|
||||
|
||||
#define CODE_ADDR 0x6000
|
||||
#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
|
||||
|
||||
|
|
@ -201,15 +201,15 @@ real_code_2:
|
|||
1:
|
||||
|
||||
movl $(DATA_ADDR + 0x1000), %edi
|
||||
movl %ss:(DATA_ADDR + GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE), %ecx
|
||||
addl $GRUB_DECOMPRESSOR_I386_PC_MAX_DECOMPRESSOR_SIZE, %ecx
|
||||
movl %ss:(DATA_ADDR + VasEBoot_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE), %ecx
|
||||
addl $VasEBoot_DECOMPRESSOR_I386_PC_MAX_DECOMPRESSOR_SIZE, %ecx
|
||||
|
||||
2:
|
||||
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 %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
|
||||
|
||||
|
|
|
|||
|
|
@ -1,19 +1,19 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#define FIXED_PROPS
|
||||
|
|
|
|||
|
|
@ -1,22 +1,22 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/machine/boot.h>
|
||||
#include <VasEBoot/machine/boot.h>
|
||||
|
||||
.file "pxeboot.S"
|
||||
.text
|
||||
|
|
@ -30,7 +30,7 @@ _start:
|
|||
start:
|
||||
|
||||
/* 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 */
|
||||
ljmp $0, $0x8200
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/offsets.h>
|
||||
#include <grub/machine/boot.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/machine/kernel.h>
|
||||
#include <VasEBoot/symbol.h>
|
||||
#include <VasEBoot/offsets.h>
|
||||
#include <VasEBoot/machine/boot.h>
|
||||
#include <VasEBoot/machine/memory.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"
|
||||
|
||||
|
|
@ -50,23 +50,23 @@ LOCAL (base):
|
|||
* This is a special data area.
|
||||
*/
|
||||
|
||||
.org GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE
|
||||
.org VasEBoot_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE
|
||||
LOCAL(compressed_size):
|
||||
.long 0
|
||||
.org GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE
|
||||
.org VasEBoot_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE
|
||||
LOCAL(uncompressed_size):
|
||||
.long 0
|
||||
|
||||
.org GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY
|
||||
.org VasEBoot_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY
|
||||
reed_solomon_redundancy:
|
||||
.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)
|
||||
|
||||
/*
|
||||
* 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):
|
||||
.byte 0xFF, 0xFF, 0xFF
|
||||
LOCAL(boot_drive):
|
||||
|
|
@ -83,7 +83,7 @@ LOCAL (codestart):
|
|||
movw %ax, %es
|
||||
|
||||
/* set up the real mode/BIOS stack */
|
||||
movl $GRUB_MEMORY_MACHINE_REAL_STACK, %ebp
|
||||
movl $VasEBoot_MEMORY_MACHINE_REAL_STACK, %ebp
|
||||
movl %ebp, %esp
|
||||
|
||||
sti /* we're safe again */
|
||||
|
|
@ -101,7 +101,7 @@ LOCAL (codestart):
|
|||
.code32
|
||||
|
||||
cld
|
||||
call grub_gate_a20
|
||||
call VasEBoot_gate_a20
|
||||
|
||||
movl LOCAL(compressed_size), %edx
|
||||
#ifdef __APPLE__
|
||||
|
|
@ -113,7 +113,7 @@ LOCAL (codestart):
|
|||
movl reed_solomon_redundancy, %ecx
|
||||
leal LOCAL(reed_solomon_part), %eax
|
||||
cld
|
||||
call EXT_C (grub_reed_solomon_recover)
|
||||
call EXT_C (VasEBoot_reed_solomon_recover)
|
||||
jmp post_reed_solomon
|
||||
|
||||
#include "../../../kern/i386/realmode.S"
|
||||
|
|
@ -123,7 +123,7 @@ LOCAL (codestart):
|
|||
.text
|
||||
|
||||
/*
|
||||
* grub_gate_a20(void)
|
||||
* VasEBoot_gate_a20(void)
|
||||
*
|
||||
* Gate address-line 20 for high memory.
|
||||
*
|
||||
|
|
@ -132,7 +132,7 @@ LOCAL (codestart):
|
|||
* It also eats any keystrokes in the keyboard buffer. :-(
|
||||
*/
|
||||
|
||||
grub_gate_a20:
|
||||
VasEBoot_gate_a20:
|
||||
gate_a20_test_current_state:
|
||||
/* first of all, test if already in a good state */
|
||||
call gate_a20_check_state
|
||||
|
|
@ -228,7 +228,7 @@ gate_a20_check_state:
|
|||
pushl %ecx
|
||||
xorl %eax, %eax
|
||||
/* 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
|
||||
/* save the original byte in CL */
|
||||
movb (%ebx), %cl
|
||||
|
|
@ -259,7 +259,7 @@ gate_a20_check_state:
|
|||
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,
|
||||
* and relocates itself after loaded.
|
||||
*/
|
||||
|
|
@ -287,7 +287,7 @@ multiboot_entry:
|
|||
/* obtain the boot device */
|
||||
movl 12(%ebx), %edx
|
||||
|
||||
movl $GRUB_MEMORY_MACHINE_PROT_STACK, %ebp
|
||||
movl $VasEBoot_MEMORY_MACHINE_PROT_STACK, %ebp
|
||||
movl %ebp, %esp
|
||||
|
||||
/* relocate the code */
|
||||
|
|
@ -302,7 +302,7 @@ multiboot_entry:
|
|||
addl LOCAL(compressed_size) - _start + 0x100000 + 0x200, %ecx
|
||||
#endif
|
||||
movl $0x100000, %esi
|
||||
movl $GRUB_BOOT_MACHINE_KERNEL_ADDR, %edi
|
||||
movl $VasEBoot_BOOT_MACHINE_KERNEL_ADDR, %edi
|
||||
cld
|
||||
rep
|
||||
movsb
|
||||
|
|
@ -323,7 +323,7 @@ multiboot_trampoline:
|
|||
post_reed_solomon:
|
||||
|
||||
#ifdef ENABLE_LZMA
|
||||
movl $GRUB_MEMORY_MACHINE_DECOMPRESSION_ADDR, %edi
|
||||
movl $VasEBoot_MEMORY_MACHINE_DECOMPRESSION_ADDR, %edi
|
||||
#ifdef __APPLE__
|
||||
movl $decompressor_end, %esi
|
||||
#else
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <config.h>
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/machine/boot.h>
|
||||
#include <grub/machine/kernel.h>
|
||||
#include <VasEBoot/symbol.h>
|
||||
#include <VasEBoot/machine/memory.h>
|
||||
#include <VasEBoot/machine/boot.h>
|
||||
#include <VasEBoot/machine/kernel.h>
|
||||
|
||||
.text
|
||||
.code16
|
||||
|
|
@ -31,8 +31,8 @@ _start:
|
|||
|
||||
jmp 1f
|
||||
|
||||
.org GRUB_BOOT_I386_QEMU_CORE_ENTRY_ADDR
|
||||
VARIABLE(grub_core_entry_addr)
|
||||
.org VasEBoot_BOOT_I386_QEMU_CORE_ENTRY_ADDR
|
||||
VARIABLE(VasEBoot_core_entry_addr)
|
||||
.long 0
|
||||
1:
|
||||
|
||||
|
|
@ -43,7 +43,7 @@ VARIABLE(grub_core_entry_addr)
|
|||
movw %ax, %es
|
||||
|
||||
/* 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
|
||||
of a flat return address. */
|
||||
|
|
@ -58,7 +58,7 @@ VARIABLE(grub_core_entry_addr)
|
|||
andb $(~0x03), %al
|
||||
orb $0x02, %al
|
||||
outb $0x92
|
||||
movl EXT_C(grub_core_entry_addr), %edx
|
||||
movl EXT_C(VasEBoot_core_entry_addr), %edx
|
||||
jmp *%edx
|
||||
|
||||
#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
|
||||
*right here* and this is why we need this kludge. */
|
||||
|
||||
.org GRUB_BOOT_MACHINE_SIZE - 16
|
||||
.org VasEBoot_BOOT_MACHINE_SIZE - 16
|
||||
|
||||
.code16
|
||||
|
||||
jmp _start
|
||||
.org GRUB_BOOT_MACHINE_SIZE
|
||||
.org VasEBoot_BOOT_MACHINE_SIZE
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/mips/loongson/serial.h>
|
||||
#include <grub/mips/loongson/pci.h>
|
||||
#include <grub/mips/loongson.h>
|
||||
#include <grub/pci.h>
|
||||
#include <grub/machine/serial.h>
|
||||
#include <grub/machine/kernel.h>
|
||||
#include <grub/ns8250.h>
|
||||
#include <grub/cs5536.h>
|
||||
#include <grub/smbus.h>
|
||||
#include <VasEBoot/mips/loongson/serial.h>
|
||||
#include <VasEBoot/mips/loongson/pci.h>
|
||||
#include <VasEBoot/mips/loongson.h>
|
||||
#include <VasEBoot/pci.h>
|
||||
#include <VasEBoot/machine/serial.h>
|
||||
#include <VasEBoot/machine/kernel.h>
|
||||
#include <VasEBoot/ns8250.h>
|
||||
#include <VasEBoot/cs5536.h>
|
||||
#include <VasEBoot/smbus.h>
|
||||
|
||||
#ifndef FULOONG2F
|
||||
#include <grub/vgaregs.h>
|
||||
#define GRUB_SM712_REG_BASE 0x700000
|
||||
#define GRUB_SM712_PCIID 0x0712126f
|
||||
#include <VasEBoot/vgaregs.h>
|
||||
#define VasEBoot_SM712_REG_BASE 0x700000
|
||||
#define VasEBoot_SM712_PCIID 0x0712126f
|
||||
#endif
|
||||
|
||||
#ifdef FULOONG2F
|
||||
#define GRUB_MACHINE_SERIAL_PORT GRUB_MACHINE_SERIAL_PORT2
|
||||
#define GRUB_MACHINE_SERIAL_DIVISOR_115200 GRUB_MACHINE_SERIAL_PORT2_DIVISOR_115200
|
||||
#define VasEBoot_MACHINE_SERIAL_PORT VasEBoot_MACHINE_SERIAL_PORT2
|
||||
#define VasEBoot_MACHINE_SERIAL_DIVISOR_115200 VasEBoot_MACHINE_SERIAL_PORT2_DIVISOR_115200
|
||||
#else
|
||||
#define GRUB_MACHINE_SERIAL_PORT GRUB_MACHINE_SERIAL_PORT0
|
||||
#define GRUB_MACHINE_SERIAL_DIVISOR_115200 GRUB_MACHINE_SERIAL_PORT0_DIVISOR_115200
|
||||
#define VasEBoot_MACHINE_SERIAL_PORT VasEBoot_MACHINE_SERIAL_PORT0
|
||||
#define VasEBoot_MACHINE_SERIAL_DIVISOR_115200 VasEBoot_MACHINE_SERIAL_PORT0_DIVISOR_115200
|
||||
#endif
|
||||
|
||||
.set noreorder
|
||||
|
|
@ -59,22 +59,22 @@ __start:
|
|||
|
||||
/* Find CS5536 controller. */
|
||||
/* $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. */
|
||||
retry_cs5536:
|
||||
/* We have only one bus (0). Function is 0. */
|
||||
lui $t0, %hi(GRUB_MACHINE_PCI_CONF_CTRL_REG_ADDR_2F)
|
||||
lui $t1, %hi(GRUB_MACHINE_PCI_CONFSPACE_2F)
|
||||
lui $t3, %hi(GRUB_CS5536_PCIID)
|
||||
addiu $t3, $t3, %lo(GRUB_CS5536_PCIID)
|
||||
lui $t0, %hi(VasEBoot_MACHINE_PCI_CONF_CTRL_REG_ADDR_2F)
|
||||
lui $t1, %hi(VasEBoot_MACHINE_PCI_CONFSPACE_2F)
|
||||
lui $t3, %hi(VasEBoot_CS5536_PCIID)
|
||||
addiu $t3, $t3, %lo(VasEBoot_CS5536_PCIID)
|
||||
ori $t4, $zero, 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. */
|
||||
beql $t4, $zero, retry_cs5536
|
||||
nop
|
||||
sw $t4, %lo(GRUB_MACHINE_PCI_CONF_CTRL_REG_ADDR_2F) ($t0)
|
||||
lw $t2, (%lo(GRUB_MACHINE_PCI_CONFSPACE_2F) + GRUB_PCI_REG_PCI_ID) ($t1)
|
||||
sw $t4, %lo(VasEBoot_MACHINE_PCI_CONF_CTRL_REG_ADDR_2F) ($t0)
|
||||
lw $t2, (%lo(VasEBoot_MACHINE_PCI_CONFSPACE_2F) + VasEBoot_PCI_REG_PCI_ID) ($t1)
|
||||
bnel $t2, $t3, 1b
|
||||
sll $t4, $t4, 1
|
||||
|
||||
|
|
@ -86,18 +86,18 @@ retry_cs5536:
|
|||
move $a0, $t4
|
||||
#endif
|
||||
|
||||
lui $t0, %hi(GRUB_MACHINE_PCI_CONFSPACE_2F)
|
||||
li $t1, GRUB_CS5536_MSR_MAILBOX_CONFIG_ENABLED
|
||||
sw $t1, (%lo(GRUB_MACHINE_PCI_CONFSPACE_2F) + GRUB_CS5536_MSR_MAILBOX_CONFIG) ($t0)
|
||||
lui $t0, %hi(VasEBoot_MACHINE_PCI_CONFSPACE_2F)
|
||||
li $t1, VasEBoot_CS5536_MSR_MAILBOX_CONFIG_ENABLED
|
||||
sw $t1, (%lo(VasEBoot_MACHINE_PCI_CONFSPACE_2F) + VasEBoot_CS5536_MSR_MAILBOX_CONFIG) ($t0)
|
||||
|
||||
/* Set GPIO LBAR. */
|
||||
lui $a0, %hi(GRUB_CS5536_MSR_GPIO_BAR)
|
||||
addiu $a0, $a0, %lo(GRUB_CS5536_MSR_GPIO_BAR)
|
||||
ori $a1, $zero, GRUB_CS5536_LBAR_GPIO
|
||||
lui $a0, %hi(VasEBoot_CS5536_MSR_GPIO_BAR)
|
||||
addiu $a0, $a0, %lo(VasEBoot_CS5536_MSR_GPIO_BAR)
|
||||
ori $a1, $zero, VasEBoot_CS5536_LBAR_GPIO
|
||||
/* Set mask to 0xf and enabled bit to 1. */
|
||||
bal wrmsr
|
||||
ori $a2, $zero, ((GRUB_CS5536_LBAR_MASK_MASK \
|
||||
| GRUB_CS5536_LBAR_ENABLE) >> 32)
|
||||
ori $a2, $zero, ((VasEBoot_CS5536_LBAR_MASK_MASK \
|
||||
| VasEBoot_CS5536_LBAR_ENABLE) >> 32)
|
||||
|
||||
bal gpio_init
|
||||
nop
|
||||
|
|
@ -109,63 +109,63 @@ retry_cs5536:
|
|||
|
||||
/* Initialise SMBus controller. */
|
||||
/* Set SMBUS LBAR. */
|
||||
lui $a0, %hi(GRUB_CS5536_MSR_SMB_BAR)
|
||||
addiu $a0, $a0, %lo(GRUB_CS5536_MSR_SMB_BAR)
|
||||
ori $a1, $zero, GRUB_CS5536_LBAR_SMBUS
|
||||
lui $a0, %hi(VasEBoot_CS5536_MSR_SMB_BAR)
|
||||
addiu $a0, $a0, %lo(VasEBoot_CS5536_MSR_SMB_BAR)
|
||||
ori $a1, $zero, VasEBoot_CS5536_LBAR_SMBUS
|
||||
/* Set mask to 0xf and enabled bit to 1. */
|
||||
bal wrmsr
|
||||
ori $a2, $zero, ((GRUB_CS5536_LBAR_MASK_MASK \
|
||||
| GRUB_CS5536_LBAR_ENABLE) >> 32)
|
||||
ori $a2, $zero, ((VasEBoot_CS5536_LBAR_MASK_MASK \
|
||||
| VasEBoot_CS5536_LBAR_ENABLE) >> 32)
|
||||
|
||||
lui $a0, %hi(smbus_enabled)
|
||||
bal message
|
||||
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. */
|
||||
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. */
|
||||
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. */
|
||||
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. */
|
||||
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(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_CTRL3) ($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. */
|
||||
/* 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
|
||||
move $a0, $zero
|
||||
bal printhex
|
||||
move $a0, $v0
|
||||
|
||||
bal read_spd
|
||||
ori $a0, $zero, GRUB_SMBUS_SPD_MEMORY_TYPE_ADDR
|
||||
ori $t0, $zero, GRUB_SMBUS_SPD_MEMORY_TYPE_DDR2
|
||||
ori $a0, $zero, VasEBoot_SMBUS_SPD_MEMORY_TYPE_ADDR
|
||||
ori $t0, $zero, VasEBoot_SMBUS_SPD_MEMORY_TYPE_DDR2
|
||||
lui $a0, %hi(unimplemented_memory_type)
|
||||
bne $t0, $v0, fatal
|
||||
addiu $a0, $a0, %lo(unimplemented_memory_type)
|
||||
|
||||
/* And here is our goal: DDR2 controller initialisation. */
|
||||
lui $t0, %hi(GRUB_CPU_LOONGSON_CORECFG)
|
||||
ld $t1, %lo(GRUB_CPU_LOONGSON_CORECFG) ($t0)
|
||||
lui $t0, %hi(VasEBoot_CPU_LOONGSON_CORECFG)
|
||||
ld $t1, %lo(VasEBoot_CPU_LOONGSON_CORECFG) ($t0)
|
||||
/* 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
|
||||
sd $t1, %lo (GRUB_CPU_LOONGSON_CORECFG) ($t0)
|
||||
sd $t1, %lo (VasEBoot_CPU_LOONGSON_CORECFG) ($t0)
|
||||
|
||||
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:
|
||||
mfc0 $s1, GRUB_CPU_LOONGSON_COP0_EPC
|
||||
mfc0 $s2, GRUB_CPU_LOONGSON_COP0_BADVADDR
|
||||
mfc0 $s1, VasEBoot_CPU_LOONGSON_COP0_EPC
|
||||
mfc0 $s2, VasEBoot_CPU_LOONGSON_COP0_BADVADDR
|
||||
move $s3, $ra
|
||||
lui $a0, %hi(epc)
|
||||
bal message
|
||||
|
|
@ -196,17 +196,17 @@ tlb_refill:
|
|||
b fatal
|
||||
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:
|
||||
lui $a0, %hi(unhandled_cache_error)
|
||||
b fatal
|
||||
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:
|
||||
mfc0 $s0, GRUB_CPU_LOONGSON_COP0_CAUSE
|
||||
mfc0 $s1, GRUB_CPU_LOONGSON_COP0_EPC
|
||||
mfc0 $s2, GRUB_CPU_LOONGSON_COP0_BADVADDR
|
||||
mfc0 $s0, VasEBoot_CPU_LOONGSON_COP0_CAUSE
|
||||
mfc0 $s1, VasEBoot_CPU_LOONGSON_COP0_EPC
|
||||
mfc0 $s2, VasEBoot_CPU_LOONGSON_COP0_BADVADDR
|
||||
lui $a0, %hi(cause)
|
||||
bal message
|
||||
addiu $a0, $a0, %lo(cause)
|
||||
|
|
@ -237,8 +237,8 @@ other_exception:
|
|||
addiu $a0, $a0, %lo(unhandled_exception)
|
||||
|
||||
gpio_init:
|
||||
lui $t0, %hi(GRUB_MACHINE_PCI_IO_BASE_2F + GRUB_CS5536_LBAR_GPIO)
|
||||
addiu $t0, $t0, %lo(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(VasEBoot_MACHINE_PCI_IO_BASE_2F + VasEBoot_CS5536_LBAR_GPIO)
|
||||
lui $t1, %hi (gpio_dump)
|
||||
addiu $t1, $t1, %lo (gpio_dump)
|
||||
|
||||
|
|
@ -260,55 +260,55 @@ gpio_init:
|
|||
serial_hw_init:
|
||||
move $t2, $ra
|
||||
#ifdef FULOONG2F
|
||||
lui $a0, %hi(GRUB_CS5536_MSR_DIVIL_LEG_IO)
|
||||
addiu $a0, $a0, %lo(GRUB_CS5536_MSR_DIVIL_LEG_IO)
|
||||
lui $a1, %hi (GRUB_CS5536_MSR_DIVIL_LEG_IO_UART2_COM3 \
|
||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_F_REMAP \
|
||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_MODE_X86 \
|
||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_UART1_COM1)
|
||||
ori $a1, $a1, (GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE0 \
|
||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE1)
|
||||
lui $a0, %hi(VasEBoot_CS5536_MSR_DIVIL_LEG_IO)
|
||||
addiu $a0, $a0, %lo(VasEBoot_CS5536_MSR_DIVIL_LEG_IO)
|
||||
lui $a1, %hi (VasEBoot_CS5536_MSR_DIVIL_LEG_IO_UART2_COM3 \
|
||||
| VasEBoot_CS5536_MSR_DIVIL_LEG_IO_F_REMAP \
|
||||
| VasEBoot_CS5536_MSR_DIVIL_LEG_IO_MODE_X86 \
|
||||
| VasEBoot_CS5536_MSR_DIVIL_LEG_IO_UART1_COM1)
|
||||
ori $a1, $a1, (VasEBoot_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE0 \
|
||||
| VasEBoot_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE1)
|
||||
bal wrmsr
|
||||
move $a2, $zero
|
||||
|
||||
lui $a0, %hi(GRUB_CS5536_MSR_DIVIL_UART1_CONF)
|
||||
addiu $a0, $a0, %lo(GRUB_CS5536_MSR_DIVIL_UART1_CONF)
|
||||
lui $a0, %hi(VasEBoot_CS5536_MSR_DIVIL_UART1_CONF)
|
||||
addiu $a0, $a0, %lo(VasEBoot_CS5536_MSR_DIVIL_UART1_CONF)
|
||||
li $a1, 2
|
||||
bal wrmsr
|
||||
move $a2, $zero
|
||||
|
||||
lui $a0, %hi(GRUB_CS5536_MSR_DIVIL_UART2_CONF)
|
||||
addiu $a0, $a0, %lo(GRUB_CS5536_MSR_DIVIL_UART2_CONF)
|
||||
lui $a0, %hi(VasEBoot_CS5536_MSR_DIVIL_UART2_CONF)
|
||||
addiu $a0, $a0, %lo(VasEBoot_CS5536_MSR_DIVIL_UART2_CONF)
|
||||
li $a1, 2
|
||||
bal wrmsr
|
||||
move $a2, $zero
|
||||
#endif
|
||||
|
||||
lui $t0, %hi (GRUB_MACHINE_SERIAL_PORT)
|
||||
lui $t0, %hi (VasEBoot_MACHINE_SERIAL_PORT)
|
||||
|
||||
/* 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. */
|
||||
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. */
|
||||
ori $t1, $zero, GRUB_MACHINE_SERIAL_DIVISOR_115200
|
||||
sb $t1, (%lo (GRUB_MACHINE_SERIAL_PORT) + UART_DLL)($t0)
|
||||
sb $zero, (%lo (GRUB_MACHINE_SERIAL_PORT) + UART_DLH)($t0)
|
||||
ori $t1, $zero, VasEBoot_MACHINE_SERIAL_DIVISOR_115200
|
||||
sb $t1, (%lo (VasEBoot_MACHINE_SERIAL_PORT) + UART_DLL)($t0)
|
||||
sb $zero, (%lo (VasEBoot_MACHINE_SERIAL_PORT) + UART_DLH)($t0)
|
||||
|
||||
/* Set the line status. */
|
||||
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. */
|
||||
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. */
|
||||
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. */
|
||||
lui $a0, %hi(notification_string)
|
||||
|
|
@ -318,14 +318,14 @@ serial_hw_init:
|
|||
/* Print message on serial console. */
|
||||
/* In: $a0 = asciiz message. Out: none. Clobbered: $t0, $t1, $a0. */
|
||||
message:
|
||||
lui $t0, %hi (GRUB_MACHINE_SERIAL_PORT)
|
||||
lui $t0, %hi (VasEBoot_MACHINE_SERIAL_PORT)
|
||||
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
|
||||
beq $t1, $zero, 1b
|
||||
nop
|
||||
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
|
||||
addiu $a0, $a0, 1
|
||||
jr $ra
|
||||
|
|
@ -335,10 +335,10 @@ message:
|
|||
In: $a0. Out: None. Clobbered: $a0, $t0, $t1, $t2
|
||||
*/
|
||||
printhex:
|
||||
lui $t0, %hi (GRUB_MACHINE_SERIAL_PORT)
|
||||
lui $t0, %hi (VasEBoot_MACHINE_SERIAL_PORT)
|
||||
ori $t2, $zero, 8
|
||||
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
|
||||
beq $t1, $zero, 1b
|
||||
nop
|
||||
|
|
@ -348,7 +348,7 @@ printhex:
|
|||
sll $a0, $a0, 4
|
||||
addiu $t1, $t1, 'A'-10-'0'
|
||||
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
|
||||
bne $t2, $zero, 1b
|
||||
nop
|
||||
|
|
@ -368,22 +368,22 @@ self:
|
|||
Clobbered: $t0
|
||||
*/
|
||||
wrmsr:
|
||||
lui $t0, %hi(GRUB_MACHINE_PCI_CONFSPACE_2F)
|
||||
sw $a0, (%lo(GRUB_MACHINE_PCI_CONFSPACE_2F) + GRUB_CS5536_MSR_MAILBOX_ADDR) ($t0)
|
||||
sw $a1, (%lo(GRUB_MACHINE_PCI_CONFSPACE_2F) + GRUB_CS5536_MSR_MAILBOX_DATA0) ($t0)
|
||||
lui $t0, %hi(VasEBoot_MACHINE_PCI_CONFSPACE_2F)
|
||||
sw $a0, (%lo(VasEBoot_MACHINE_PCI_CONFSPACE_2F) + VasEBoot_CS5536_MSR_MAILBOX_ADDR) ($t0)
|
||||
sw $a1, (%lo(VasEBoot_MACHINE_PCI_CONFSPACE_2F) + VasEBoot_CS5536_MSR_MAILBOX_DATA0) ($t0)
|
||||
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. */
|
||||
/* In: $a0 = exception handler. Out: none. Clobbered: $t0, $t1 */
|
||||
smbus_wait:
|
||||
1:
|
||||
lui $t0, %hi(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_STATUS + GRUB_MACHINE_PCI_IO_BASE_2F)
|
||||
lb $t0, %lo(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_STATUS + GRUB_MACHINE_PCI_IO_BASE_2F) ($t0)
|
||||
andi $t1, $t0, GRUB_CS5536_SMB_REG_STATUS_SDAST
|
||||
lui $t0, %hi(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_STATUS + VasEBoot_MACHINE_PCI_IO_BASE_2F)
|
||||
lb $t0, %lo(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_STATUS + VasEBoot_MACHINE_PCI_IO_BASE_2F) ($t0)
|
||||
andi $t1, $t0, VasEBoot_CS5536_SMB_REG_STATUS_SDAST
|
||||
bne $t1, $zero, return
|
||||
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
|
||||
nop
|
||||
jr $a0
|
||||
|
|
@ -401,59 +401,59 @@ read_spd:
|
|||
addiu $a0, $a0, %lo(read_spd_fail)
|
||||
|
||||
/* Send START. */
|
||||
lui $t0, %hi(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL1 + GRUB_MACHINE_PCI_IO_BASE_2F)
|
||||
lb $t1, %lo(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL1 + GRUB_MACHINE_PCI_IO_BASE_2F) ($t0)
|
||||
ori $t1, $t1, GRUB_CS5536_SMB_REG_CTRL1_START
|
||||
lui $t0, %hi(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_CTRL1 + VasEBoot_MACHINE_PCI_IO_BASE_2F)
|
||||
lb $t1, %lo(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_CTRL1 + VasEBoot_MACHINE_PCI_IO_BASE_2F) ($t0)
|
||||
ori $t1, $t1, VasEBoot_CS5536_SMB_REG_CTRL1_START
|
||||
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. */
|
||||
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
|
||||
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. */
|
||||
lui $t0, %hi(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL1 + GRUB_MACHINE_PCI_IO_BASE_2F)
|
||||
lb $t1, %lo(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL1 + GRUB_MACHINE_PCI_IO_BASE_2F) ($t0)
|
||||
ori $t1, $t1, GRUB_CS5536_SMB_REG_CTRL1_ACK
|
||||
sb $t1, %lo(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL1 + GRUB_MACHINE_PCI_IO_BASE_2F) ($t0)
|
||||
lui $t0, %hi(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_CTRL1 + VasEBoot_MACHINE_PCI_IO_BASE_2F)
|
||||
lb $t1, %lo(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_CTRL1 + VasEBoot_MACHINE_PCI_IO_BASE_2F) ($t0)
|
||||
ori $t1, $t1, VasEBoot_CS5536_SMB_REG_CTRL1_ACK
|
||||
sb $t1, %lo(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_CTRL1 + VasEBoot_MACHINE_PCI_IO_BASE_2F) ($t0)
|
||||
|
||||
/* 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
|
||||
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. */
|
||||
lui $t0, %hi(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL1 + GRUB_MACHINE_PCI_IO_BASE_2F)
|
||||
lb $t1, %lo(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL1 + GRUB_MACHINE_PCI_IO_BASE_2F) ($t0)
|
||||
ori $t1, $t1, GRUB_CS5536_SMB_REG_CTRL1_START
|
||||
lui $t0, %hi(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_CTRL1 + VasEBoot_MACHINE_PCI_IO_BASE_2F)
|
||||
lb $t1, %lo(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_CTRL1 + VasEBoot_MACHINE_PCI_IO_BASE_2F) ($t0)
|
||||
ori $t1, $t1, VasEBoot_CS5536_SMB_REG_CTRL1_START
|
||||
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. */
|
||||
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
|
||||
ori $t1, $t1, 1
|
||||
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. */
|
||||
lui $t0, %hi(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL1 + GRUB_MACHINE_PCI_IO_BASE_2F)
|
||||
lb $t1, %lo(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL1 + GRUB_MACHINE_PCI_IO_BASE_2F) ($t0)
|
||||
ori $t1, $t1, GRUB_CS5536_SMB_REG_CTRL1_STOP
|
||||
lui $t0, %hi(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_CTRL1 + VasEBoot_MACHINE_PCI_IO_BASE_2F)
|
||||
lb $t1, %lo(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_CTRL1 + VasEBoot_MACHINE_PCI_IO_BASE_2F) ($t0)
|
||||
ori $t1, $t1, VasEBoot_CS5536_SMB_REG_CTRL1_STOP
|
||||
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)
|
||||
lb $v0, %lo(GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_DATA + GRUB_MACHINE_PCI_IO_BASE_2F) ($t0)
|
||||
lui $t0, %hi(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_DATA + VasEBoot_MACHINE_PCI_IO_BASE_2F)
|
||||
lb $v0, %lo(VasEBoot_CS5536_LBAR_SMBUS + VasEBoot_CS5536_SMB_REG_DATA + VasEBoot_MACHINE_PCI_IO_BASE_2F) ($t0)
|
||||
jr $t3
|
||||
andi $v0, $v0, 0xff
|
||||
read_spd_fail:
|
||||
jr $t3
|
||||
ori $v0, $v0, 0x100
|
||||
|
||||
notification_string: .asciz "GRUB "
|
||||
notification_string: .asciz "VasEBoot "
|
||||
cs5536_found: .asciz "CS5536 at "
|
||||
sm_failed: .asciz "SM transaction failed.\n\r"
|
||||
unhandled_tlb_refill: .asciz "Unhandled TLB refill.\n\r"
|
||||
|
|
@ -552,13 +552,13 @@ gpio_dump_end:
|
|||
write_dumpreg:
|
||||
ld $t2, 0($t6)
|
||||
sd $t2, 0($t4)
|
||||
addiu $t4, $t4, GRUB_CPU_LOONGSON_DDR2_REG_STEP
|
||||
addiu $t4, $t4, VasEBoot_CPU_LOONGSON_DDR2_REG_STEP
|
||||
jr $ra
|
||||
addiu $t6, $t6, GRUB_CPU_LOONGSON_DDR2_REG_SIZE
|
||||
addiu $t6, $t6, VasEBoot_CPU_LOONGSON_DDR2_REG_SIZE
|
||||
|
||||
continue:
|
||||
lui $t4, %hi(GRUB_CPU_LOONGSON_DDR2_BASE)
|
||||
addiu $t4, $t4, %lo(GRUB_CPU_LOONGSON_DDR2_BASE)
|
||||
lui $t4, %hi(VasEBoot_CPU_LOONGSON_DDR2_BASE)
|
||||
addiu $t4, $t4, %lo(VasEBoot_CPU_LOONGSON_DDR2_BASE)
|
||||
lui $t6, %hi(regdump)
|
||||
|
||||
/* 0 */
|
||||
|
|
@ -566,20 +566,20 @@ continue:
|
|||
addiu $t6, $t6, %lo(regdump)
|
||||
|
||||
/* 1 */
|
||||
ori $a1, $a1, GRUB_SMB_RAM_START_ADDR
|
||||
ori $a1, $a1, VasEBoot_SMB_RAM_START_ADDR
|
||||
move $t8, $zero
|
||||
lui $t5, 0x0001
|
||||
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
|
||||
bne $v0, $t7, 1f
|
||||
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:
|
||||
dsll $t8, $t8, 32
|
||||
or $t5, $t5, $t8
|
||||
sd $t5, 0 ($t4)
|
||||
addiu $t4, $t4, GRUB_CPU_LOONGSON_DDR2_REG_STEP
|
||||
addiu $t4, $t4, VasEBoot_CPU_LOONGSON_DDR2_REG_STEP
|
||||
|
||||
/* 2 */
|
||||
bal write_dumpreg
|
||||
|
|
@ -597,7 +597,7 @@ continue:
|
|||
/* FIXME: figure termination resistance. */
|
||||
ori $t5, $zero, 0x2
|
||||
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. */
|
||||
xori $v0, $v0, 0xf
|
||||
andi $v0, $v0, 0x7
|
||||
|
|
@ -606,9 +606,9 @@ continue:
|
|||
|
||||
/* Find the fastest supported CAS latency. */
|
||||
bal read_spd
|
||||
ori $a0, $zero, GRUB_SMBUS_SPD_MEMORY_CAS_LATENCY_ADDR
|
||||
ori $t0, $zero, GRUB_SMBUS_SPD_MEMORY_CAS_LATENCY_MIN_VALUE
|
||||
ori $t1, $zero, (1 << GRUB_SMBUS_SPD_MEMORY_CAS_LATENCY_MIN_VALUE)
|
||||
ori $a0, $zero, VasEBoot_SMBUS_SPD_MEMORY_CAS_LATENCY_ADDR
|
||||
ori $t0, $zero, VasEBoot_SMBUS_SPD_MEMORY_CAS_LATENCY_MIN_VALUE
|
||||
ori $t1, $zero, (1 << VasEBoot_SMBUS_SPD_MEMORY_CAS_LATENCY_MIN_VALUE)
|
||||
2:
|
||||
and $t2, $t1, $v0
|
||||
bne $t2, $zero, 1f
|
||||
|
|
@ -624,7 +624,7 @@ continue:
|
|||
or $t5, $t5, $t0
|
||||
|
||||
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. */
|
||||
addiu $v0, $v0, 1
|
||||
xori $v0, $v0, 0xf
|
||||
|
|
@ -633,112 +633,112 @@ continue:
|
|||
or $t5, $t5, $v0
|
||||
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
|
||||
|
||||
1:
|
||||
ld $t2, 0($t6)
|
||||
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
|
||||
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)
|
||||
ld $t5, (%lo(GRUB_CPU_LOONGSON_DDR2_BASE) + 0x30) ($t4)
|
||||
lui $t4, %hi(VasEBoot_CPU_LOONGSON_DDR2_BASE)
|
||||
ld $t5, (%lo(VasEBoot_CPU_LOONGSON_DDR2_BASE) + 0x30) ($t4)
|
||||
ori $t0, $zero, 1
|
||||
dsll $t0, $t0, 40
|
||||
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. */
|
||||
lui $t0, %hi (GRUB_CPU_LOONGSON_CORECFG)
|
||||
ld $t1, %lo (GRUB_CPU_LOONGSON_CORECFG) ($t0)
|
||||
ori $t1, $t1, GRUB_CPU_LOONGSON_CORECFG_DISABLE_DDR2_SPACE
|
||||
sd $t1, %lo (GRUB_CPU_LOONGSON_CORECFG) ($t0)
|
||||
lui $t0, %hi (VasEBoot_CPU_LOONGSON_CORECFG)
|
||||
ld $t1, %lo (VasEBoot_CPU_LOONGSON_CORECFG) ($t0)
|
||||
ori $t1, $t1, VasEBoot_CPU_LOONGSON_CORECFG_DISABLE_DDR2_SPACE
|
||||
sd $t1, %lo (VasEBoot_CPU_LOONGSON_CORECFG) ($t0)
|
||||
|
||||
/* Enable cache. */
|
||||
mfc0 $t0, GRUB_CPU_LOONGSON_COP0_CACHE_CONFIG
|
||||
addiu $t1, $zero, ~GRUB_CPU_LOONGSON_CACHE_TYPE_MASK
|
||||
mfc0 $t0, VasEBoot_CPU_LOONGSON_COP0_CACHE_CONFIG
|
||||
addiu $t1, $zero, ~VasEBoot_CPU_LOONGSON_CACHE_TYPE_MASK
|
||||
and $t0, $t1, $t1
|
||||
/* Set line size to 32 bytes and disabled cache. */
|
||||
ori $t0, $t0, (GRUB_CPU_LOONGSON_COP0_CACHE_CONFIG_ILINESIZE \
|
||||
| GRUB_CPU_LOONGSON_COP0_CACHE_CONFIG_DLINESIZE \
|
||||
| GRUB_CPU_LOONGSON_CACHE_ACCELERATED)
|
||||
mtc0 $t0, GRUB_CPU_LOONGSON_COP0_CACHE_CONFIG
|
||||
ori $t0, $t0, (VasEBoot_CPU_LOONGSON_COP0_CACHE_CONFIG_ILINESIZE \
|
||||
| VasEBoot_CPU_LOONGSON_COP0_CACHE_CONFIG_DLINESIZE \
|
||||
| VasEBoot_CPU_LOONGSON_CACHE_ACCELERATED)
|
||||
mtc0 $t0, VasEBoot_CPU_LOONGSON_COP0_CACHE_CONFIG
|
||||
|
||||
/* Invalidate all I-cache entries. */
|
||||
srl $t1, $t0, GRUB_CPU_LOONGSON_COP0_CACHE_ISIZE_SHIFT
|
||||
andi $t1, $t1, GRUB_CPU_LOONGSON_COP0_CACHE_SIZE_MASK
|
||||
ori $t2, $zero, (1 << (GRUB_CPU_LOONGSON_COP0_CACHE_SIZE_OFFSET \
|
||||
- GRUB_CPU_LOONGSON_CACHE_LINE_SIZE_LOG_BIG \
|
||||
- GRUB_CPU_LOONGSON_I_CACHE_LOG_WAYS))
|
||||
srl $t1, $t0, VasEBoot_CPU_LOONGSON_COP0_CACHE_ISIZE_SHIFT
|
||||
andi $t1, $t1, VasEBoot_CPU_LOONGSON_COP0_CACHE_SIZE_MASK
|
||||
ori $t2, $zero, (1 << (VasEBoot_CPU_LOONGSON_COP0_CACHE_SIZE_OFFSET \
|
||||
- VasEBoot_CPU_LOONGSON_CACHE_LINE_SIZE_LOG_BIG \
|
||||
- VasEBoot_CPU_LOONGSON_I_CACHE_LOG_WAYS))
|
||||
sll $t1, $t2, $t1
|
||||
lui $t2, 0x8000
|
||||
|
||||
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
|
||||
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. */
|
||||
srl $t1, $t0, GRUB_CPU_LOONGSON_COP0_CACHE_DSIZE_SHIFT
|
||||
andi $t1, $t1, GRUB_CPU_LOONGSON_COP0_CACHE_SIZE_MASK
|
||||
ori $t2, $zero, (1 << (GRUB_CPU_LOONGSON_COP0_CACHE_SIZE_OFFSET \
|
||||
- GRUB_CPU_LOONGSON_CACHE_LINE_SIZE_LOG_BIG \
|
||||
- GRUB_CPU_LOONGSON_D_CACHE_LOG_WAYS))
|
||||
srl $t1, $t0, VasEBoot_CPU_LOONGSON_COP0_CACHE_DSIZE_SHIFT
|
||||
andi $t1, $t1, VasEBoot_CPU_LOONGSON_COP0_CACHE_SIZE_MASK
|
||||
ori $t2, $zero, (1 << (VasEBoot_CPU_LOONGSON_COP0_CACHE_SIZE_OFFSET \
|
||||
- VasEBoot_CPU_LOONGSON_CACHE_LINE_SIZE_LOG_BIG \
|
||||
- VasEBoot_CPU_LOONGSON_D_CACHE_LOG_WAYS))
|
||||
sll $t1, $t2, $t1
|
||||
lui $t2, 0x8000
|
||||
mtc0 $zero, GRUB_CPU_LOONGSON_COP0_CACHE_TAGLO
|
||||
mtc0 $zero, GRUB_CPU_LOONGSON_COP0_CACHE_TAGHI
|
||||
mtc0 $zero, VasEBoot_CPU_LOONGSON_COP0_CACHE_TAGLO
|
||||
mtc0 $zero, VasEBoot_CPU_LOONGSON_COP0_CACHE_TAGHI
|
||||
1:
|
||||
/* All four ways. */
|
||||
cache GRUB_CPU_LOONGSON_COP0_D_INDEX_TAG_STORE, 0($t2)
|
||||
cache GRUB_CPU_LOONGSON_COP0_D_INDEX_TAG_STORE, 1($t2)
|
||||
cache GRUB_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, 0($t2)
|
||||
cache VasEBoot_CPU_LOONGSON_COP0_D_INDEX_TAG_STORE, 1($t2)
|
||||
cache VasEBoot_CPU_LOONGSON_COP0_D_INDEX_TAG_STORE, 2($t2)
|
||||
cache VasEBoot_CPU_LOONGSON_COP0_D_INDEX_TAG_STORE, 3($t2)
|
||||
addiu $t1, $t1, -1
|
||||
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. */
|
||||
ori $t1, $zero, (1 << (GRUB_CPU_LOONGSON_SECONDARY_CACHE_LOG_SIZE \
|
||||
- GRUB_CPU_LOONGSON_CACHE_LINE_SIZE_LOG_BIG \
|
||||
- GRUB_CPU_LOONGSON_S_CACHE_LOG_WAYS))
|
||||
ori $t1, $zero, (1 << (VasEBoot_CPU_LOONGSON_SECONDARY_CACHE_LOG_SIZE \
|
||||
- VasEBoot_CPU_LOONGSON_CACHE_LINE_SIZE_LOG_BIG \
|
||||
- VasEBoot_CPU_LOONGSON_S_CACHE_LOG_WAYS))
|
||||
lui $t2, 0x8000
|
||||
mtc0 $zero, GRUB_CPU_LOONGSON_COP0_CACHE_TAGLO
|
||||
mtc0 $zero, GRUB_CPU_LOONGSON_COP0_CACHE_TAGHI
|
||||
mtc0 $zero, VasEBoot_CPU_LOONGSON_COP0_CACHE_TAGLO
|
||||
mtc0 $zero, VasEBoot_CPU_LOONGSON_COP0_CACHE_TAGHI
|
||||
1:
|
||||
/* All four ways. */
|
||||
cache GRUB_CPU_LOONGSON_COP0_S_INDEX_TAG_STORE, 0($t2)
|
||||
cache GRUB_CPU_LOONGSON_COP0_S_INDEX_TAG_STORE, 1($t2)
|
||||
cache GRUB_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, 0($t2)
|
||||
cache VasEBoot_CPU_LOONGSON_COP0_S_INDEX_TAG_STORE, 1($t2)
|
||||
cache VasEBoot_CPU_LOONGSON_COP0_S_INDEX_TAG_STORE, 2($t2)
|
||||
cache VasEBoot_CPU_LOONGSON_COP0_S_INDEX_TAG_STORE, 3($t2)
|
||||
addiu $t1, $t1, -1
|
||||
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. */
|
||||
mfc0 $t0, GRUB_CPU_LOONGSON_COP0_CACHE_CONFIG
|
||||
addiu $t1, $zero, ~GRUB_CPU_LOONGSON_CACHE_TYPE_MASK
|
||||
mfc0 $t0, VasEBoot_CPU_LOONGSON_COP0_CACHE_CONFIG
|
||||
addiu $t1, $zero, ~VasEBoot_CPU_LOONGSON_CACHE_TYPE_MASK
|
||||
and $t0, $t1, $t1
|
||||
ori $t0, $t0, GRUB_CPU_LOONGSON_CACHE_CACHED
|
||||
mtc0 $t0, GRUB_CPU_LOONGSON_COP0_CACHE_CONFIG
|
||||
ori $t0, $t0, VasEBoot_CPU_LOONGSON_CACHE_CACHED
|
||||
mtc0 $t0, VasEBoot_CPU_LOONGSON_COP0_CACHE_CONFIG
|
||||
|
||||
lui $a0, %hi(caches_enabled)
|
||||
bal message
|
||||
addiu $a0, $a0, %lo(caches_enabled)
|
||||
|
||||
/* Set ROM delay cycles to 1. */
|
||||
lui $t0, %hi(GRUB_CPU_LOONGSON_LIOCFG)
|
||||
lw $t1, %lo(GRUB_CPU_LOONGSON_LIOCFG) ($t0)
|
||||
addiu $t2, $zero, ~(GRUB_CPU_LOONGSON_ROM_DELAY_MASK \
|
||||
<< GRUB_CPU_LOONGSON_ROM_DELAY_OFFSET)
|
||||
lui $t0, %hi(VasEBoot_CPU_LOONGSON_LIOCFG)
|
||||
lw $t1, %lo(VasEBoot_CPU_LOONGSON_LIOCFG) ($t0)
|
||||
addiu $t2, $zero, ~(VasEBoot_CPU_LOONGSON_ROM_DELAY_MASK \
|
||||
<< VasEBoot_CPU_LOONGSON_ROM_DELAY_OFFSET)
|
||||
and $t1, $t1, $t2
|
||||
ori $t1, $t1, (1 << GRUB_CPU_LOONGSON_ROM_DELAY_OFFSET)
|
||||
sw $t1, %lo(GRUB_CPU_LOONGSON_LIOCFG) ($t0)
|
||||
ori $t1, $t1, (1 << VasEBoot_CPU_LOONGSON_ROM_DELAY_OFFSET)
|
||||
sw $t1, %lo(VasEBoot_CPU_LOONGSON_LIOCFG) ($t0)
|
||||
|
||||
addiu $a0, $zero, -1
|
||||
addiu $a1, $zero, -1
|
||||
|
|
@ -748,9 +748,9 @@ continue:
|
|||
addiu $t0, $t0, %lo(cached_continue - 0x20000000)
|
||||
jr $t0
|
||||
#ifdef FULOONG2F
|
||||
addiu $a2, $zero, -(1 + GRUB_ARCH_MACHINE_FULOONG2F)
|
||||
addiu $a2, $zero, -(1 + VasEBoot_ARCH_MACHINE_FULOONG2F)
|
||||
#else
|
||||
addiu $a2, $zero, -(1 + GRUB_ARCH_MACHINE_YEELOONG)
|
||||
addiu $a2, $zero, -(1 + VasEBoot_ARCH_MACHINE_YEELOONG)
|
||||
#endif
|
||||
|
||||
cached_continue:
|
||||
|
|
|
|||
|
|
@ -1,28 +1,28 @@
|
|||
/* startup.S - Startup code for the MIPS. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/symbol.h>
|
||||
#include <grub/offsets.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#include <grub/machine/kernel.h>
|
||||
#include <grub/offsets.h>
|
||||
#include <grub/mips/asm.h>
|
||||
#include <VasEBoot/symbol.h>
|
||||
#include <VasEBoot/offsets.h>
|
||||
#include <VasEBoot/machine/memory.h>
|
||||
#include <VasEBoot/machine/kernel.h>
|
||||
#include <VasEBoot/offsets.h>
|
||||
#include <VasEBoot/mips/asm.h>
|
||||
|
||||
#define BASE_ADDR 8
|
||||
|
||||
|
|
@ -40,13 +40,13 @@ start:
|
|||
bal codestart
|
||||
nop
|
||||
base:
|
||||
.org GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE
|
||||
.org VasEBoot_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE
|
||||
compressed_size:
|
||||
.long 0
|
||||
.org GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE
|
||||
.org VasEBoot_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE
|
||||
uncompressed_size:
|
||||
.long 0
|
||||
.org GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_ADDR
|
||||
.org VasEBoot_DECOMPRESSOR_MACHINE_UNCOMPRESSED_ADDR
|
||||
uncompressed_addr:
|
||||
.long 0
|
||||
codestart:
|
||||
|
|
@ -55,7 +55,7 @@ codestart:
|
|||
|
||||
/* Parse arguments. Has to be done before relocation.
|
||||
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)
|
||||
lw $t1, %lo (((16 << 20) - 264 + 4) | 0x80000000) ($t0)
|
||||
|
||||
|
|
@ -74,7 +74,7 @@ codestart:
|
|||
2:
|
||||
#endif
|
||||
|
||||
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||
#ifdef VasEBoot_MACHINE_MIPS_LOONGSON
|
||||
move $s2, $zero
|
||||
move $s3, $zero
|
||||
move $s4, $zero
|
||||
|
|
@ -110,8 +110,8 @@ argcont:
|
|||
DO_PARSE (cpuclockstr, $s3)
|
||||
DO_PARSE (memsizestr, $s4)
|
||||
DO_PARSE (highmemsizestr, $s5)
|
||||
DO_CHECKT1 (pmon_yeeloong_verstr, GRUB_ARCH_MACHINE_YEELOONG)
|
||||
DO_CHECKT1 (pmon_fuloong2f_verstr, GRUB_ARCH_MACHINE_FULOONG2F)
|
||||
DO_CHECKT1 (pmon_yeeloong_verstr, VasEBoot_ARCH_MACHINE_YEELOONG)
|
||||
DO_CHECKT1 (pmon_fuloong2f_verstr, VasEBoot_ARCH_MACHINE_FULOONG2F)
|
||||
2:
|
||||
b argcont
|
||||
addiu $t0, $t0, 4
|
||||
|
|
@ -119,32 +119,32 @@ parsestr:
|
|||
move $v0, $zero
|
||||
move $t3, $t1
|
||||
3:
|
||||
lb GRUB_ASM_T4, 0($t2)
|
||||
lb GRUB_ASM_T5, 0($t3)
|
||||
lb VasEBoot_ASM_T4, 0($t2)
|
||||
lb VasEBoot_ASM_T5, 0($t3)
|
||||
addiu $t2, $t2, 1
|
||||
addiu $t3, $t3, 1
|
||||
beq GRUB_ASM_T5, $zero, 1f
|
||||
beq VasEBoot_ASM_T5, $zero, 1f
|
||||
nop
|
||||
beq GRUB_ASM_T5, GRUB_ASM_T4, 3b
|
||||
beq VasEBoot_ASM_T5, VasEBoot_ASM_T4, 3b
|
||||
nop
|
||||
bne GRUB_ASM_T4, $zero, 1f
|
||||
bne VasEBoot_ASM_T4, $zero, 1f
|
||||
nop
|
||||
|
||||
addiu $t3, $t3, 0xffff
|
||||
digcont:
|
||||
lb GRUB_ASM_T5, 0($t3)
|
||||
lb VasEBoot_ASM_T5, 0($t3)
|
||||
/* Substract '0' from digit. */
|
||||
addiu GRUB_ASM_T5, GRUB_ASM_T5, 0xffd0
|
||||
bltz GRUB_ASM_T5, 1f
|
||||
addiu VasEBoot_ASM_T5, VasEBoot_ASM_T5, 0xffd0
|
||||
bltz VasEBoot_ASM_T5, 1f
|
||||
nop
|
||||
addiu GRUB_ASM_T4, GRUB_ASM_T5, 0xfff7
|
||||
bgtz GRUB_ASM_T4, 1f
|
||||
addiu VasEBoot_ASM_T4, VasEBoot_ASM_T5, 0xfff7
|
||||
bgtz VasEBoot_ASM_T4, 1f
|
||||
nop
|
||||
/* Multiply $v0 by 10 with bitshifts. */
|
||||
sll $v0, $v0, 1
|
||||
sll GRUB_ASM_T4, $v0, 2
|
||||
addu $v0, $v0, GRUB_ASM_T4
|
||||
addu $v0, $v0, GRUB_ASM_T5
|
||||
sll VasEBoot_ASM_T4, $v0, 2
|
||||
addu $v0, $v0, VasEBoot_ASM_T4
|
||||
addu $v0, $v0, VasEBoot_ASM_T5
|
||||
addiu $t3, $t3, 1
|
||||
b digcont
|
||||
nop
|
||||
|
|
@ -173,20 +173,20 @@ argdone:
|
|||
addiu $t7, $s0, (str - base);\
|
||||
bal do_check ;\
|
||||
li $t2, val
|
||||
DO_CHECKA1 (machtype_yeeloong_str1, GRUB_ARCH_MACHINE_YEELOONG)
|
||||
DO_CHECKA1 (machtype_yeeloong_str2, GRUB_ARCH_MACHINE_YEELOONG)
|
||||
DO_CHECKA1 (pmon_yeeloong_str, GRUB_ARCH_MACHINE_YEELOONG)
|
||||
DO_CHECKA1 (machtype_fuloong2f_str, GRUB_ARCH_MACHINE_FULOONG2F)
|
||||
DO_CHECKA1 (machtype_fuloong2e_str, GRUB_ARCH_MACHINE_FULOONG2E)
|
||||
DO_CHECKA1 (pmon_fuloong2f_str, GRUB_ARCH_MACHINE_FULOONG2F)
|
||||
DO_CHECKA1 (machtype_yeeloong_str1, VasEBoot_ARCH_MACHINE_YEELOONG)
|
||||
DO_CHECKA1 (machtype_yeeloong_str2, VasEBoot_ARCH_MACHINE_YEELOONG)
|
||||
DO_CHECKA1 (pmon_yeeloong_str, VasEBoot_ARCH_MACHINE_YEELOONG)
|
||||
DO_CHECKA1 (machtype_fuloong2f_str, VasEBoot_ARCH_MACHINE_FULOONG2F)
|
||||
DO_CHECKA1 (machtype_fuloong2e_str, VasEBoot_ARCH_MACHINE_FULOONG2E)
|
||||
DO_CHECKA1 (pmon_fuloong2f_str, VasEBoot_ARCH_MACHINE_FULOONG2F)
|
||||
addiu $a0, $a0, -1
|
||||
b argdone
|
||||
addiu $a1, $a1, 4
|
||||
do_check:
|
||||
lb GRUB_ASM_T4, 0($t7)
|
||||
beq GRUB_ASM_T4, $zero, 1f
|
||||
lb VasEBoot_ASM_T4, 0($t7)
|
||||
beq VasEBoot_ASM_T4, $zero, 1f
|
||||
lb $t3, 0($t6)
|
||||
bne $t3, GRUB_ASM_T4, 2f
|
||||
bne $t3, VasEBoot_ASM_T4, 2f
|
||||
addiu $t6, $t6, 1
|
||||
b do_check
|
||||
addiu $t7, $t7, 1
|
||||
|
|
@ -199,7 +199,7 @@ argfw:
|
|||
not $s7, $a2
|
||||
cmdlinedone:
|
||||
#endif
|
||||
#ifdef GRUB_MACHINE_ARC
|
||||
#ifdef VasEBoot_MACHINE_ARC
|
||||
lui $t0, %hi(_start - 256)
|
||||
addiu $t0, $t0, %lo(_start - 256)
|
||||
addiu $t3, $t0, 255
|
||||
|
|
@ -223,8 +223,8 @@ cmdlinedone:
|
|||
|
||||
1:
|
||||
beq $t1, $t3, 2f
|
||||
lb GRUB_ASM_T4, 0($t2)
|
||||
sb GRUB_ASM_T4, 0($t1)
|
||||
lb VasEBoot_ASM_T4, 0($t2)
|
||||
sb VasEBoot_ASM_T4, 0($t1)
|
||||
addiu $t1, $t1, 1
|
||||
b 1b
|
||||
addiu $t2, $t2, 1
|
||||
|
|
@ -258,9 +258,9 @@ cmdlinedone:
|
|||
subu $a0, $a0, $t0
|
||||
addu $a0, $a0, $s0
|
||||
|
||||
lw $a1, (GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_ADDR - BASE_ADDR)($s0)
|
||||
lw $a2, (GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE - BASE_ADDR)($s0)
|
||||
lw $a3, (GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE - BASE_ADDR)($s0)
|
||||
lw $a1, (VasEBoot_DECOMPRESSOR_MACHINE_UNCOMPRESSED_ADDR - BASE_ADDR)($s0)
|
||||
lw $a2, (VasEBoot_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE - BASE_ADDR)($s0)
|
||||
lw $a3, (VasEBoot_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE - BASE_ADDR)($s0)
|
||||
move $s1, $a1
|
||||
|
||||
/* $a0 contains source compressed address, $a1 is destination,
|
||||
|
|
@ -268,10 +268,10 @@ cmdlinedone:
|
|||
*/
|
||||
move $s6, $a3
|
||||
|
||||
lui $t9, %hi(EXT_C(grub_decompress_core))
|
||||
addiu $t9, $t9, %lo(EXT_C(grub_decompress_core))
|
||||
lui $t9, %hi(EXT_C(VasEBoot_decompress_core))
|
||||
addiu $t9, $t9, %lo(EXT_C(VasEBoot_decompress_core))
|
||||
|
||||
#ifdef GRUB_MACHINE_ARC
|
||||
#ifdef VasEBoot_MACHINE_ARC
|
||||
lui $sp, %hi(_start - 512)
|
||||
jalr $t9
|
||||
addiu $sp, $sp, %lo(_start - 512)
|
||||
|
|
@ -285,8 +285,8 @@ cmdlinedone:
|
|||
|
||||
#include "../../kern/mips/cache_flush.S"
|
||||
|
||||
lui $t1, %hi(GRUB_MACHINE_LINK_ADDR)
|
||||
addiu $t1, %lo(GRUB_MACHINE_LINK_ADDR)
|
||||
lui $t1, %hi(VasEBoot_MACHINE_LINK_ADDR)
|
||||
addiu $t1, %lo(VasEBoot_MACHINE_LINK_ADDR)
|
||||
|
||||
jr $t1
|
||||
nop
|
||||
|
|
|
|||
|
|
@ -167,6 +167,6 @@ FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
|||
FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
|
||||
</OS-BADGE-ICONS>
|
||||
<BOOT-SCRIPT>
|
||||
boot &device;:&partition;,\System\Library\CoreServices\grub.elf
|
||||
boot &device;:&partition;,\System\Library\CoreServices\VasEBoot.elf
|
||||
</BOOT-SCRIPT>
|
||||
</CHRP-BOOT>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<chrp-boot>
|
||||
<description>@PACKAGE@ @VERSION@</description>
|
||||
<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>
|
||||
<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
|
||||
|
|
|
|||
|
|
@ -1,23 +1,23 @@
|
|||
/* -*-Asm-*- */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/machine/boot.h>
|
||||
#include <VasEBoot/machine/boot.h>
|
||||
|
||||
.text
|
||||
.align 4
|
||||
|
|
@ -30,32 +30,32 @@ pic_base:
|
|||
|
||||
#ifndef CDBOOT
|
||||
/* The offsets to these locations are defined by the
|
||||
* GRUB_BOOT_MACHINE_foo macros in include/grub/sparc/ieee1275/boot.h,
|
||||
* and grub-setup uses this to patch these next three values as needed.
|
||||
* VasEBoot_BOOT_MACHINE_foo macros in include/VasEBoot/sparc/ieee1275/boot.h,
|
||||
* 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
|
||||
* rest of the GRUB kernel image resides. kernel_sector will be set to
|
||||
* the location of the first block of the GRUB kernel, and
|
||||
* rest of the VasEBoot kernel image resides. kernel_sector will be set to
|
||||
* the location of the first block of the VasEBoot kernel, and
|
||||
* 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
|
||||
* 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:
|
||||
.org GRUB_BOOT_MACHINE_KERNEL_BYTE
|
||||
.org VasEBoot_BOOT_MACHINE_KERNEL_BYTE
|
||||
boot_path_end:
|
||||
kernel_byte: .xword (2 << 9)
|
||||
kernel_address: .word GRUB_BOOT_MACHINE_KERNEL_ADDR
|
||||
kernel_address: .word VasEBoot_BOOT_MACHINE_KERNEL_ADDR
|
||||
#else
|
||||
#define boot_path (_start + 512 + SCRATCH_PAD_BOOT_SIZE)
|
||||
#define boot_path_end (_start + 1024)
|
||||
#include <grub/offsets.h>
|
||||
#include <VasEBoot/offsets.h>
|
||||
|
||||
.org 8
|
||||
kernel_byte: .xword (2 << 9)
|
||||
kernel_size: .word 512
|
||||
kernel_address: .word GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS
|
||||
kernel_address: .word VasEBoot_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS
|
||||
#endif
|
||||
|
||||
prom_finddev_name: .asciz "finddevice"
|
||||
|
|
@ -68,8 +68,8 @@ prom_open_name: .asciz "open"
|
|||
prom_seek_name: .asciz "seek"
|
||||
prom_read_name: .asciz "read"
|
||||
prom_exit_name: .asciz "exit"
|
||||
grub_name: .asciz "GRUB "
|
||||
#define GRUB_NAME_LEN 5
|
||||
VasEBoot_name: .asciz "VasEBoot "
|
||||
#define VasEBoot_NAME_LEN 5
|
||||
|
||||
.align 4
|
||||
|
||||
|
|
@ -167,10 +167,10 @@ boot_continue:
|
|||
lduw [%l1 + 256], STDOUT_NODE_REG
|
||||
brz,pn STDOUT_NODE_REG, prom_error
|
||||
|
||||
/* write(stdout_node, "GRUB ", strlen("GRUB ")) */
|
||||
GET_ABS(grub_name, %o2)
|
||||
/* write(stdout_node, "VasEBoot ", strlen("VasEBoot ")) */
|
||||
GET_ABS(VasEBoot_name, %o2)
|
||||
call console_write
|
||||
mov GRUB_NAME_LEN, %o3
|
||||
mov VasEBoot_NAME_LEN, %o3
|
||||
|
||||
GET_ABS(boot_path, %o3)
|
||||
#ifndef CDBOOT
|
||||
|
|
@ -186,7 +186,7 @@ boot_continue:
|
|||
bootpath_known:
|
||||
|
||||
/* 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)
|
||||
*/
|
||||
|
|
@ -224,7 +224,7 @@ bootpath_known:
|
|||
#else
|
||||
nop
|
||||
#endif
|
||||
.org GRUB_BOOT_MACHINE_CODE_END
|
||||
.org VasEBoot_BOOT_MACHINE_CODE_END
|
||||
|
||||
/* the last 4 bytes in the sector 0 contain the signature */
|
||||
.word GRUB_BOOT_MACHINE_SIGNATURE
|
||||
.word VasEBoot_BOOT_MACHINE_SIGNATURE
|
||||
|
|
|
|||
|
|
@ -1,24 +1,24 @@
|
|||
/* -*-Asm-*- */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/machine/boot.h>
|
||||
#include <grub/offsets.h>
|
||||
#include <VasEBoot/machine/boot.h>
|
||||
#include <VasEBoot/offsets.h>
|
||||
|
||||
.text
|
||||
.align 4
|
||||
|
|
@ -87,8 +87,8 @@ after_info_block:
|
|||
call console_write
|
||||
mov NOTIFICATION_STRING_LEN, %o3
|
||||
|
||||
GET_ABS(firstlist - GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE, %l2)
|
||||
set GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS, %l3
|
||||
GET_ABS(firstlist - VasEBoot_BOOT_SPARC64_IEEE1275_LIST_SIZE, %l2)
|
||||
set VasEBoot_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS, %l3
|
||||
bootloop:
|
||||
lduw [%l2 + 0x08], %o0
|
||||
brz %o0, bootit
|
||||
|
|
@ -115,7 +115,7 @@ bootloop:
|
|||
mov NOTIFICATION_STEP_LEN, %o3
|
||||
|
||||
ba bootloop
|
||||
sub %l2, GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE, %l2
|
||||
sub %l2, VasEBoot_BOOT_SPARC64_IEEE1275_LIST_SIZE, %l2
|
||||
|
||||
bootit:
|
||||
GET_ABS(prom_close_name, %o0)
|
||||
|
|
@ -127,8 +127,8 @@ bootit:
|
|||
GET_ABS(notification_done, %o2)
|
||||
call console_write
|
||||
mov NOTIFICATION_DONE_LEN, %o3
|
||||
sethi %hi(GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS), %o2
|
||||
jmpl %o2 + %lo(GRUB_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS), %o7
|
||||
sethi %hi(VasEBoot_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS), %o2
|
||||
jmpl %o2 + %lo(VasEBoot_BOOT_SPARC64_IEEE1275_IMAGE_ADDRESS), %o7
|
||||
mov CIF_REG, %o4
|
||||
1: ba,a 1b
|
||||
|
||||
|
|
@ -136,7 +136,7 @@ lastlist:
|
|||
.word 0
|
||||
.word 0
|
||||
|
||||
.org (0x200 - GRUB_BOOT_SPARC64_IEEE1275_LIST_SIZE)
|
||||
.org (0x200 - VasEBoot_BOOT_SPARC64_IEEE1275_LIST_SIZE)
|
||||
blocklist_default_start:
|
||||
.word 0
|
||||
.word 2
|
||||
|
|
|
|||
|
|
@ -1,90 +1,90 @@
|
|||
/* bonito.c - PCI bonito interface. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/pci.h>
|
||||
#include <grub/misc.h>
|
||||
#include <VasEBoot/pci.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
|
||||
static grub_uint32_t base_win[GRUB_MACHINE_PCI_NUM_WIN];
|
||||
static const grub_size_t sizes_win[GRUB_MACHINE_PCI_NUM_WIN] =
|
||||
{GRUB_MACHINE_PCI_WIN1_SIZE, GRUB_MACHINE_PCI_WIN_SIZE,
|
||||
GRUB_MACHINE_PCI_WIN_SIZE};
|
||||
static VasEBoot_uint32_t base_win[VasEBoot_MACHINE_PCI_NUM_WIN];
|
||||
static const VasEBoot_size_t sizes_win[VasEBoot_MACHINE_PCI_NUM_WIN] =
|
||||
{VasEBoot_MACHINE_PCI_WIN1_SIZE, VasEBoot_MACHINE_PCI_WIN_SIZE,
|
||||
VasEBoot_MACHINE_PCI_WIN_SIZE};
|
||||
/* Usage counters. */
|
||||
static int usage_win[GRUB_MACHINE_PCI_NUM_WIN];
|
||||
static grub_addr_t addr_win[GRUB_MACHINE_PCI_NUM_WIN] =
|
||||
{GRUB_MACHINE_PCI_WIN1_ADDR, GRUB_MACHINE_PCI_WIN2_ADDR,
|
||||
GRUB_MACHINE_PCI_WIN3_ADDR};
|
||||
static int usage_win[VasEBoot_MACHINE_PCI_NUM_WIN];
|
||||
static VasEBoot_addr_t addr_win[VasEBoot_MACHINE_PCI_NUM_WIN] =
|
||||
{VasEBoot_MACHINE_PCI_WIN1_ADDR, VasEBoot_MACHINE_PCI_WIN2_ADDR,
|
||||
VasEBoot_MACHINE_PCI_WIN3_ADDR};
|
||||
|
||||
grub_bonito_type_t grub_bonito_type;
|
||||
VasEBoot_bonito_type_t VasEBoot_bonito_type;
|
||||
|
||||
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);
|
||||
return (volatile void *) (GRUB_MACHINE_PCI_CONFSPACE_2F
|
||||
VasEBoot_MACHINE_PCI_CONF_CTRL_REG_2F = 1 << ((addr >> 11) & 0xf);
|
||||
return (volatile void *) (VasEBoot_MACHINE_PCI_CONFSPACE_2F
|
||||
| (addr & 0x07ff));
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
if (addr >> 16)
|
||||
return (volatile void *) (GRUB_MACHINE_PCI_CONFSPACE_3A_EXT | addr);
|
||||
return (volatile void *) (VasEBoot_MACHINE_PCI_CONFSPACE_3A_EXT | addr);
|
||||
else
|
||||
return (volatile void *) (GRUB_MACHINE_PCI_CONFSPACE_3A | addr);
|
||||
return (volatile void *) (VasEBoot_MACHINE_PCI_CONFSPACE_3A | addr);
|
||||
}
|
||||
}
|
||||
|
||||
grub_uint32_t
|
||||
grub_pci_read (grub_pci_address_t addr)
|
||||
VasEBoot_uint32_t
|
||||
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
|
||||
grub_pci_read_word (grub_pci_address_t addr)
|
||||
VasEBoot_uint16_t
|
||||
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
|
||||
grub_pci_read_byte (grub_pci_address_t addr)
|
||||
VasEBoot_uint8_t
|
||||
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
|
||||
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
|
||||
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
|
||||
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)
|
||||
{
|
||||
int i;
|
||||
grub_uint32_t reg = 0;
|
||||
for (i = 0; i < GRUB_MACHINE_PCI_NUM_WIN; i++)
|
||||
reg |= (((base_win[i] >> GRUB_MACHINE_PCI_WIN_SHIFT)
|
||||
& GRUB_MACHINE_PCI_WIN_MASK)
|
||||
<< (i * GRUB_MACHINE_PCI_WIN_MASK_SIZE));
|
||||
GRUB_MACHINE_PCI_IO_CTRL_REG_2F = reg;
|
||||
VasEBoot_uint32_t reg = 0;
|
||||
for (i = 0; i < VasEBoot_MACHINE_PCI_NUM_WIN; i++)
|
||||
reg |= (((base_win[i] >> VasEBoot_MACHINE_PCI_WIN_SHIFT)
|
||||
& VasEBoot_MACHINE_PCI_WIN_MASK)
|
||||
<< (i * VasEBoot_MACHINE_PCI_WIN_MASK_SIZE));
|
||||
VasEBoot_MACHINE_PCI_IO_CTRL_REG_2F = reg;
|
||||
}
|
||||
|
||||
volatile void *
|
||||
grub_pci_device_map_range (grub_pci_device_t dev __attribute__ ((unused)),
|
||||
grub_addr_t base, grub_size_t size)
|
||||
VasEBoot_pci_device_map_range (VasEBoot_pci_device_t dev __attribute__ ((unused)),
|
||||
VasEBoot_addr_t base, VasEBoot_size_t size)
|
||||
{
|
||||
if (grub_bonito_type == GRUB_BONITO_2F)
|
||||
if (VasEBoot_bonito_type == VasEBoot_BONITO_2F)
|
||||
{
|
||||
int i;
|
||||
grub_addr_t newbase;
|
||||
VasEBoot_addr_t newbase;
|
||||
|
||||
/* 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
|
||||
&& base_win[i] + sizes_win[i] > base + size)
|
||||
{
|
||||
usage_win[i]++;
|
||||
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. */
|
||||
newbase = base & ~GRUB_MACHINE_PCI_WIN_OFFSET_MASK;
|
||||
for (i = 0; i < GRUB_MACHINE_PCI_NUM_WIN; i++)
|
||||
newbase = base & ~VasEBoot_MACHINE_PCI_WIN_OFFSET_MASK;
|
||||
for (i = 0; i < VasEBoot_MACHINE_PCI_NUM_WIN; i++)
|
||||
if (!usage_win[i] && newbase <= base
|
||||
&& 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;
|
||||
write_bases_2f ();
|
||||
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
|
||||
{
|
||||
|
|
@ -142,35 +142,35 @@ grub_pci_device_map_range (grub_pci_device_t dev __attribute__ ((unused)),
|
|||
&& base + size <= 0x1f000000)
|
||||
region = 2;
|
||||
if (region == 0)
|
||||
grub_fatal ("Attempt to map out of regions");
|
||||
VasEBoot_fatal ("Attempt to map out of regions");
|
||||
return (void *) (0xa0000000 | base);
|
||||
}
|
||||
}
|
||||
|
||||
void *
|
||||
grub_pci_device_map_range_cached (grub_pci_device_t dev,
|
||||
grub_addr_t base, grub_size_t size)
|
||||
VasEBoot_pci_device_map_range_cached (VasEBoot_pci_device_t dev,
|
||||
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);
|
||||
}
|
||||
|
||||
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,
|
||||
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;
|
||||
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]
|
||||
== (((grub_addr_t) mem | 0x20000000)
|
||||
& ~GRUB_MACHINE_PCI_WIN_OFFSET_MASK))
|
||||
== (((VasEBoot_addr_t) mem | 0x20000000)
|
||||
& ~VasEBoot_MACHINE_PCI_WIN_OFFSET_MASK))
|
||||
{
|
||||
usage_win[i]--;
|
||||
return;
|
||||
}
|
||||
grub_fatal ("Tried to unmap not mapped region");
|
||||
VasEBoot_fatal ("Tried to unmap not mapped region");
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,48 +1,48 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/cs5536.h>
|
||||
#include <grub/pci.h>
|
||||
#include <grub/time.h>
|
||||
#include <grub/ata.h>
|
||||
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||
#include <grub/machine/kernel.h>
|
||||
#include <VasEBoot/types.h>
|
||||
#include <VasEBoot/cs5536.h>
|
||||
#include <VasEBoot/pci.h>
|
||||
#include <VasEBoot/time.h>
|
||||
#include <VasEBoot/ata.h>
|
||||
#ifdef VasEBoot_MACHINE_MIPS_LOONGSON
|
||||
#include <VasEBoot/machine/kernel.h>
|
||||
#endif
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
VasEBoot_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
/* Context for grub_cs5536_find. */
|
||||
struct grub_cs5536_find_ctx
|
||||
/* Context for VasEBoot_cs5536_find. */
|
||||
struct VasEBoot_cs5536_find_ctx
|
||||
{
|
||||
grub_pci_device_t *devp;
|
||||
VasEBoot_pci_device_t *devp;
|
||||
int found;
|
||||
};
|
||||
|
||||
/* Helper for grub_cs5536_find. */
|
||||
/* Helper for VasEBoot_cs5536_find. */
|
||||
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->found = 1;
|
||||
|
|
@ -52,330 +52,330 @@ grub_cs5536_find_iter (grub_pci_device_t dev, grub_pci_id_t pciid, void *data)
|
|||
}
|
||||
|
||||
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,
|
||||
.found = 0
|
||||
};
|
||||
|
||||
grub_pci_iterate (grub_cs5536_find_iter, &ctx);
|
||||
VasEBoot_pci_iterate (VasEBoot_cs5536_find_iter, &ctx);
|
||||
|
||||
return ctx.found;
|
||||
}
|
||||
|
||||
grub_uint64_t
|
||||
grub_cs5536_read_msr (grub_pci_device_t dev, grub_uint32_t addr)
|
||||
VasEBoot_uint64_t
|
||||
VasEBoot_cs5536_read_msr (VasEBoot_pci_device_t dev, VasEBoot_uint32_t addr)
|
||||
{
|
||||
grub_uint64_t ret = 0;
|
||||
grub_pci_write (grub_pci_make_address (dev, GRUB_CS5536_MSR_MAILBOX_ADDR),
|
||||
VasEBoot_uint64_t ret = 0;
|
||||
VasEBoot_pci_write (VasEBoot_pci_make_address (dev, VasEBoot_CS5536_MSR_MAILBOX_ADDR),
|
||||
addr);
|
||||
ret = (grub_uint64_t)
|
||||
grub_pci_read (grub_pci_make_address (dev, GRUB_CS5536_MSR_MAILBOX_DATA0));
|
||||
ret |= (((grub_uint64_t)
|
||||
grub_pci_read (grub_pci_make_address (dev,
|
||||
GRUB_CS5536_MSR_MAILBOX_DATA1)))
|
||||
ret = (VasEBoot_uint64_t)
|
||||
VasEBoot_pci_read (VasEBoot_pci_make_address (dev, VasEBoot_CS5536_MSR_MAILBOX_DATA0));
|
||||
ret |= (((VasEBoot_uint64_t)
|
||||
VasEBoot_pci_read (VasEBoot_pci_make_address (dev,
|
||||
VasEBoot_CS5536_MSR_MAILBOX_DATA1)))
|
||||
<< 32);
|
||||
return ret;
|
||||
}
|
||||
|
||||
void
|
||||
grub_cs5536_write_msr (grub_pci_device_t dev, grub_uint32_t addr,
|
||||
grub_uint64_t val)
|
||||
VasEBoot_cs5536_write_msr (VasEBoot_pci_device_t dev, VasEBoot_uint32_t addr,
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_cs5536_smbus_wait (grub_port_t smbbase)
|
||||
VasEBoot_err_t
|
||||
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)
|
||||
{
|
||||
grub_uint8_t status;
|
||||
status = grub_inb (smbbase + GRUB_CS5536_SMB_REG_STATUS);
|
||||
if (status & GRUB_CS5536_SMB_REG_STATUS_SDAST)
|
||||
return GRUB_ERR_NONE;
|
||||
if (status & GRUB_CS5536_SMB_REG_STATUS_BER)
|
||||
return grub_error (GRUB_ERR_IO, "SM bus error");
|
||||
if (status & GRUB_CS5536_SMB_REG_STATUS_NACK)
|
||||
return grub_error (GRUB_ERR_IO, "NACK received");
|
||||
if (grub_get_time_ms () > start + 40)
|
||||
return grub_error (GRUB_ERR_IO, "SM stalled");
|
||||
VasEBoot_uint8_t status;
|
||||
status = VasEBoot_inb (smbbase + VasEBoot_CS5536_SMB_REG_STATUS);
|
||||
if (status & VasEBoot_CS5536_SMB_REG_STATUS_SDAST)
|
||||
return VasEBoot_ERR_NONE;
|
||||
if (status & VasEBoot_CS5536_SMB_REG_STATUS_BER)
|
||||
return VasEBoot_error (VasEBoot_ERR_IO, "SM bus error");
|
||||
if (status & VasEBoot_CS5536_SMB_REG_STATUS_NACK)
|
||||
return VasEBoot_error (VasEBoot_ERR_IO, "NACK received");
|
||||
if (VasEBoot_get_time_ms () > start + 40)
|
||||
return VasEBoot_error (VasEBoot_ERR_IO, "SM stalled");
|
||||
}
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_cs5536_read_spd_byte (grub_port_t smbbase, grub_uint8_t dev,
|
||||
grub_uint8_t addr, grub_uint8_t *res)
|
||||
VasEBoot_err_t
|
||||
VasEBoot_cs5536_read_spd_byte (VasEBoot_port_t smbbase, VasEBoot_uint8_t dev,
|
||||
VasEBoot_uint8_t addr, VasEBoot_uint8_t *res)
|
||||
{
|
||||
grub_err_t err;
|
||||
VasEBoot_err_t err;
|
||||
|
||||
/* Send START. */
|
||||
grub_outb (grub_inb (smbbase + GRUB_CS5536_SMB_REG_CTRL1)
|
||||
| GRUB_CS5536_SMB_REG_CTRL1_START,
|
||||
smbbase + GRUB_CS5536_SMB_REG_CTRL1);
|
||||
VasEBoot_outb (VasEBoot_inb (smbbase + VasEBoot_CS5536_SMB_REG_CTRL1)
|
||||
| VasEBoot_CS5536_SMB_REG_CTRL1_START,
|
||||
smbbase + VasEBoot_CS5536_SMB_REG_CTRL1);
|
||||
|
||||
/* Send device address. */
|
||||
err = grub_cs5536_smbus_wait (smbbase);
|
||||
err = VasEBoot_cs5536_smbus_wait (smbbase);
|
||||
if (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. */
|
||||
err = grub_cs5536_smbus_wait (smbbase);
|
||||
err = VasEBoot_cs5536_smbus_wait (smbbase);
|
||||
if (err)
|
||||
return err;
|
||||
grub_outb (grub_inb (smbbase + GRUB_CS5536_SMB_REG_CTRL1)
|
||||
| GRUB_CS5536_SMB_REG_CTRL1_ACK,
|
||||
smbbase + GRUB_CS5536_SMB_REG_CTRL1);
|
||||
VasEBoot_outb (VasEBoot_inb (smbbase + VasEBoot_CS5536_SMB_REG_CTRL1)
|
||||
| VasEBoot_CS5536_SMB_REG_CTRL1_ACK,
|
||||
smbbase + VasEBoot_CS5536_SMB_REG_CTRL1);
|
||||
|
||||
/* Send byte address. */
|
||||
grub_outb (addr, smbbase + GRUB_CS5536_SMB_REG_DATA);
|
||||
VasEBoot_outb (addr, smbbase + VasEBoot_CS5536_SMB_REG_DATA);
|
||||
|
||||
/* Send START. */
|
||||
err = grub_cs5536_smbus_wait (smbbase);
|
||||
err = VasEBoot_cs5536_smbus_wait (smbbase);
|
||||
if (err)
|
||||
return err;
|
||||
grub_outb (grub_inb (smbbase + GRUB_CS5536_SMB_REG_CTRL1)
|
||||
| GRUB_CS5536_SMB_REG_CTRL1_START,
|
||||
smbbase + GRUB_CS5536_SMB_REG_CTRL1);
|
||||
VasEBoot_outb (VasEBoot_inb (smbbase + VasEBoot_CS5536_SMB_REG_CTRL1)
|
||||
| VasEBoot_CS5536_SMB_REG_CTRL1_START,
|
||||
smbbase + VasEBoot_CS5536_SMB_REG_CTRL1);
|
||||
|
||||
/* Send device address. */
|
||||
err = grub_cs5536_smbus_wait (smbbase);
|
||||
err = VasEBoot_cs5536_smbus_wait (smbbase);
|
||||
if (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. */
|
||||
err = grub_cs5536_smbus_wait (smbbase);
|
||||
err = VasEBoot_cs5536_smbus_wait (smbbase);
|
||||
if (err)
|
||||
return err;
|
||||
grub_outb (grub_inb (smbbase + GRUB_CS5536_SMB_REG_CTRL1)
|
||||
| GRUB_CS5536_SMB_REG_CTRL1_STOP,
|
||||
smbbase + GRUB_CS5536_SMB_REG_CTRL1);
|
||||
VasEBoot_outb (VasEBoot_inb (smbbase + VasEBoot_CS5536_SMB_REG_CTRL1)
|
||||
| VasEBoot_CS5536_SMB_REG_CTRL1_STOP,
|
||||
smbbase + VasEBoot_CS5536_SMB_REG_CTRL1);
|
||||
|
||||
err = grub_cs5536_smbus_wait (smbbase);
|
||||
err = VasEBoot_cs5536_smbus_wait (smbbase);
|
||||
if (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
|
||||
grub_cs5536_init_smbus (grub_pci_device_t dev, grub_uint16_t divisor,
|
||||
grub_port_t *smbbase)
|
||||
VasEBoot_err_t
|
||||
VasEBoot_cs5536_init_smbus (VasEBoot_pci_device_t dev, VasEBoot_uint16_t divisor,
|
||||
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 */
|
||||
if (!(smbbar & GRUB_CS5536_LBAR_ENABLE))
|
||||
return grub_error(GRUB_ERR_IO, "SMB controller not enabled\n");
|
||||
*smbbase = (smbbar & GRUB_CS5536_LBAR_ADDR_MASK) + GRUB_MACHINE_PCI_IO_BASE;
|
||||
if (!(smbbar & VasEBoot_CS5536_LBAR_ENABLE))
|
||||
return VasEBoot_error(VasEBoot_ERR_IO, "SMB controller not enabled\n");
|
||||
*smbbase = (smbbar & VasEBoot_CS5536_LBAR_ADDR_MASK) + VasEBoot_MACHINE_PCI_IO_BASE;
|
||||
|
||||
if (divisor < 8)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid divisor");
|
||||
return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, "invalid divisor");
|
||||
|
||||
/* Disable SMB. */
|
||||
grub_outb (0, *smbbase + GRUB_CS5536_SMB_REG_CTRL2);
|
||||
VasEBoot_outb (0, *smbbase + VasEBoot_CS5536_SMB_REG_CTRL2);
|
||||
|
||||
/* Disable interrupts. */
|
||||
grub_outb (0, *smbbase + GRUB_CS5536_SMB_REG_CTRL1);
|
||||
VasEBoot_outb (0, *smbbase + VasEBoot_CS5536_SMB_REG_CTRL1);
|
||||
|
||||
/* Set as master. */
|
||||
grub_outb (GRUB_CS5536_SMB_REG_ADDR_MASTER,
|
||||
*smbbase + GRUB_CS5536_SMB_REG_ADDR);
|
||||
VasEBoot_outb (VasEBoot_CS5536_SMB_REG_ADDR_MASTER,
|
||||
*smbbase + VasEBoot_CS5536_SMB_REG_ADDR);
|
||||
|
||||
/* Launch. */
|
||||
grub_outb (((divisor >> 7) & 0xff), *smbbase + GRUB_CS5536_SMB_REG_CTRL3);
|
||||
grub_outb (((divisor << 1) & 0xfe) | GRUB_CS5536_SMB_REG_CTRL2_ENABLE,
|
||||
*smbbase + GRUB_CS5536_SMB_REG_CTRL2);
|
||||
VasEBoot_outb (((divisor >> 7) & 0xff), *smbbase + VasEBoot_CS5536_SMB_REG_CTRL3);
|
||||
VasEBoot_outb (((divisor << 1) & 0xfe) | VasEBoot_CS5536_SMB_REG_CTRL2_ENABLE,
|
||||
*smbbase + VasEBoot_CS5536_SMB_REG_CTRL2);
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
return VasEBoot_ERR_NONE;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_cs5536_read_spd (grub_port_t smbbase, grub_uint8_t dev,
|
||||
struct grub_smbus_spd *res)
|
||||
VasEBoot_err_t
|
||||
VasEBoot_cs5536_read_spd (VasEBoot_port_t smbbase, VasEBoot_uint8_t dev,
|
||||
struct VasEBoot_smbus_spd *res)
|
||||
{
|
||||
grub_err_t err;
|
||||
grub_size_t size;
|
||||
grub_uint8_t b;
|
||||
grub_size_t ptr;
|
||||
VasEBoot_err_t err;
|
||||
VasEBoot_size_t size;
|
||||
VasEBoot_uint8_t b;
|
||||
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)
|
||||
return err;
|
||||
if (b == 0)
|
||||
return grub_error (GRUB_ERR_IO, "no SPD found");
|
||||
return VasEBoot_error (VasEBoot_ERR_IO, "no SPD found");
|
||||
size = b;
|
||||
|
||||
((grub_uint8_t *) res)[0] = b;
|
||||
((VasEBoot_uint8_t *) res)[0] = b;
|
||||
for (ptr = 1; ptr < size; ptr++)
|
||||
{
|
||||
err = grub_cs5536_read_spd_byte (smbbase, dev, ptr,
|
||||
&((grub_uint8_t *) res)[ptr]);
|
||||
err = VasEBoot_cs5536_read_spd_byte (smbbase, dev, ptr,
|
||||
&((VasEBoot_uint8_t *) res)[ptr]);
|
||||
if (err)
|
||||
return err;
|
||||
}
|
||||
return GRUB_ERR_NONE;
|
||||
return VasEBoot_ERR_NONE;
|
||||
}
|
||||
|
||||
static inline void
|
||||
set_io_space (grub_pci_device_t dev, int num, grub_uint16_t start,
|
||||
grub_uint16_t len)
|
||||
set_io_space (VasEBoot_pci_device_t dev, int num, VasEBoot_uint16_t start,
|
||||
VasEBoot_uint16_t len)
|
||||
{
|
||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_GL_REGIONS_START + num,
|
||||
((((grub_uint64_t) start + len - 4)
|
||||
<< GRUB_CS5536_MSR_GL_REGION_IO_TOP_SHIFT)
|
||||
& GRUB_CS5536_MSR_GL_REGION_TOP_MASK)
|
||||
| (((grub_uint64_t) start
|
||||
<< GRUB_CS5536_MSR_GL_REGION_IO_BASE_SHIFT)
|
||||
& GRUB_CS5536_MSR_GL_REGION_BASE_MASK)
|
||||
| GRUB_CS5536_MSR_GL_REGION_IO
|
||||
| GRUB_CS5536_MSR_GL_REGION_ENABLE);
|
||||
VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_GL_REGIONS_START + num,
|
||||
((((VasEBoot_uint64_t) start + len - 4)
|
||||
<< VasEBoot_CS5536_MSR_GL_REGION_IO_TOP_SHIFT)
|
||||
& VasEBoot_CS5536_MSR_GL_REGION_TOP_MASK)
|
||||
| (((VasEBoot_uint64_t) start
|
||||
<< VasEBoot_CS5536_MSR_GL_REGION_IO_BASE_SHIFT)
|
||||
& VasEBoot_CS5536_MSR_GL_REGION_BASE_MASK)
|
||||
| VasEBoot_CS5536_MSR_GL_REGION_IO
|
||||
| VasEBoot_CS5536_MSR_GL_REGION_ENABLE);
|
||||
}
|
||||
|
||||
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,
|
||||
((grub_uint64_t) dest << GRUB_CS5536_IOD_DEST_SHIFT)
|
||||
| (((grub_uint64_t) start & GRUB_CS5536_IOD_ADDR_MASK)
|
||||
<< GRUB_CS5536_IOD_BASE_SHIFT)
|
||||
| ((mask & GRUB_CS5536_IOD_ADDR_MASK)
|
||||
<< GRUB_CS5536_IOD_MASK_SHIFT));
|
||||
VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_GL_IOD_START + num,
|
||||
((VasEBoot_uint64_t) dest << VasEBoot_CS5536_IOD_DEST_SHIFT)
|
||||
| (((VasEBoot_uint64_t) start & VasEBoot_CS5536_IOD_ADDR_MASK)
|
||||
<< VasEBoot_CS5536_IOD_BASE_SHIFT)
|
||||
| ((mask & VasEBoot_CS5536_IOD_ADDR_MASK)
|
||||
<< VasEBoot_CS5536_IOD_MASK_SHIFT));
|
||||
}
|
||||
|
||||
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,
|
||||
(((grub_uint64_t) dest) << GRUB_CS5536_P2D_DEST_SHIFT)
|
||||
| ((grub_uint64_t) (start >> GRUB_CS5536_P2D_LOG_ALIGN)
|
||||
<< GRUB_CS5536_P2D_BASE_SHIFT)
|
||||
| (((1 << (32 - GRUB_CS5536_P2D_LOG_ALIGN)) - 1)
|
||||
<< GRUB_CS5536_P2D_MASK_SHIFT));
|
||||
VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_GL_P2D_START + num,
|
||||
(((VasEBoot_uint64_t) dest) << VasEBoot_CS5536_P2D_DEST_SHIFT)
|
||||
| ((VasEBoot_uint64_t) (start >> VasEBoot_CS5536_P2D_LOG_ALIGN)
|
||||
<< VasEBoot_CS5536_P2D_BASE_SHIFT)
|
||||
| (((1 << (32 - VasEBoot_CS5536_P2D_LOG_ALIGN)) - 1)
|
||||
<< VasEBoot_CS5536_P2D_MASK_SHIFT));
|
||||
}
|
||||
|
||||
void
|
||||
grub_cs5536_init_geode (grub_pci_device_t dev)
|
||||
VasEBoot_cs5536_init_geode (VasEBoot_pci_device_t dev)
|
||||
{
|
||||
/* Enable more BARs. */
|
||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_IRQ_MAP_BAR,
|
||||
GRUB_CS5536_LBAR_TURN_ON | GRUB_CS5536_LBAR_IRQ_MAP);
|
||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_MFGPT_BAR,
|
||||
GRUB_CS5536_LBAR_TURN_ON | GRUB_CS5536_LBAR_MFGPT);
|
||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_ACPI_BAR,
|
||||
GRUB_CS5536_LBAR_TURN_ON | GRUB_CS5536_LBAR_ACPI);
|
||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_PM_BAR,
|
||||
GRUB_CS5536_LBAR_TURN_ON | GRUB_CS5536_LBAR_PM);
|
||||
VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_IRQ_MAP_BAR,
|
||||
VasEBoot_CS5536_LBAR_TURN_ON | VasEBoot_CS5536_LBAR_IRQ_MAP);
|
||||
VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_MFGPT_BAR,
|
||||
VasEBoot_CS5536_LBAR_TURN_ON | VasEBoot_CS5536_LBAR_MFGPT);
|
||||
VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_ACPI_BAR,
|
||||
VasEBoot_CS5536_LBAR_TURN_ON | VasEBoot_CS5536_LBAR_ACPI);
|
||||
VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_PM_BAR,
|
||||
VasEBoot_CS5536_LBAR_TURN_ON | VasEBoot_CS5536_LBAR_PM);
|
||||
|
||||
/* Setup DIVIL. */
|
||||
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||
switch (grub_arch_machine)
|
||||
#ifdef VasEBoot_MACHINE_MIPS_LOONGSON
|
||||
switch (VasEBoot_arch_machine)
|
||||
{
|
||||
case GRUB_ARCH_MACHINE_YEELOONG:
|
||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_DIVIL_LEG_IO,
|
||||
GRUB_CS5536_MSR_DIVIL_LEG_IO_MODE_X86
|
||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_F_REMAP
|
||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE0
|
||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE1);
|
||||
case VasEBoot_ARCH_MACHINE_YEELOONG:
|
||||
VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_DIVIL_LEG_IO,
|
||||
VasEBoot_CS5536_MSR_DIVIL_LEG_IO_MODE_X86
|
||||
| VasEBoot_CS5536_MSR_DIVIL_LEG_IO_F_REMAP
|
||||
| VasEBoot_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE0
|
||||
| VasEBoot_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE1);
|
||||
break;
|
||||
case GRUB_ARCH_MACHINE_FULOONG2F:
|
||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_DIVIL_LEG_IO,
|
||||
GRUB_CS5536_MSR_DIVIL_LEG_IO_UART2_COM3
|
||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_UART1_COM1
|
||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_MODE_X86
|
||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_F_REMAP
|
||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE0
|
||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE1);
|
||||
case VasEBoot_ARCH_MACHINE_FULOONG2F:
|
||||
VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_DIVIL_LEG_IO,
|
||||
VasEBoot_CS5536_MSR_DIVIL_LEG_IO_UART2_COM3
|
||||
| VasEBoot_CS5536_MSR_DIVIL_LEG_IO_UART1_COM1
|
||||
| VasEBoot_CS5536_MSR_DIVIL_LEG_IO_MODE_X86
|
||||
| VasEBoot_CS5536_MSR_DIVIL_LEG_IO_F_REMAP
|
||||
| VasEBoot_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE0
|
||||
| VasEBoot_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE1);
|
||||
break;
|
||||
}
|
||||
#endif
|
||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_DIVIL_IRQ_MAPPER_PRIMARY_MASK,
|
||||
(~GRUB_CS5536_DIVIL_LPC_INTERRUPTS) & 0xffff);
|
||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_DIVIL_IRQ_MAPPER_LPC_MASK,
|
||||
GRUB_CS5536_DIVIL_LPC_INTERRUPTS);
|
||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_DIVIL_LPC_SERIAL_IRQ_CONTROL,
|
||||
GRUB_CS5536_MSR_DIVIL_LPC_SERIAL_IRQ_CONTROL_ENABLE);
|
||||
VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_DIVIL_IRQ_MAPPER_PRIMARY_MASK,
|
||||
(~VasEBoot_CS5536_DIVIL_LPC_INTERRUPTS) & 0xffff);
|
||||
VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_DIVIL_IRQ_MAPPER_LPC_MASK,
|
||||
VasEBoot_CS5536_DIVIL_LPC_INTERRUPTS);
|
||||
VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_DIVIL_LPC_SERIAL_IRQ_CONTROL,
|
||||
VasEBoot_CS5536_MSR_DIVIL_LPC_SERIAL_IRQ_CONTROL_ENABLE);
|
||||
|
||||
/* Initialise USB controller. */
|
||||
/* FIXME: assign adresses dynamically. */
|
||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_USB_OHCI_BASE,
|
||||
GRUB_CS5536_MSR_USB_BASE_BUS_MASTER
|
||||
| GRUB_CS5536_MSR_USB_BASE_MEMORY_ENABLE
|
||||
VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_USB_OHCI_BASE,
|
||||
VasEBoot_CS5536_MSR_USB_BASE_BUS_MASTER
|
||||
| VasEBoot_CS5536_MSR_USB_BASE_MEMORY_ENABLE
|
||||
| 0x05024000);
|
||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_USB_EHCI_BASE,
|
||||
GRUB_CS5536_MSR_USB_BASE_BUS_MASTER
|
||||
| GRUB_CS5536_MSR_USB_BASE_MEMORY_ENABLE
|
||||
| (0x20ULL << GRUB_CS5536_MSR_USB_EHCI_BASE_FLDJ_SHIFT)
|
||||
VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_USB_EHCI_BASE,
|
||||
VasEBoot_CS5536_MSR_USB_BASE_BUS_MASTER
|
||||
| VasEBoot_CS5536_MSR_USB_BASE_MEMORY_ENABLE
|
||||
| (0x20ULL << VasEBoot_CS5536_MSR_USB_EHCI_BASE_FLDJ_SHIFT)
|
||||
| 0x05023000);
|
||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_USB_CONTROLLER_BASE,
|
||||
GRUB_CS5536_MSR_USB_BASE_BUS_MASTER
|
||||
| GRUB_CS5536_MSR_USB_BASE_MEMORY_ENABLE | 0x05020000);
|
||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_USB_OPTION_CONTROLLER_BASE,
|
||||
GRUB_CS5536_MSR_USB_BASE_MEMORY_ENABLE | 0x05022000);
|
||||
set_p2d (dev, 0, GRUB_CS5536_DESTINATION_USB, 0x05020000);
|
||||
set_p2d (dev, 1, GRUB_CS5536_DESTINATION_USB, 0x05022000);
|
||||
set_p2d (dev, 5, GRUB_CS5536_DESTINATION_USB, 0x05024000);
|
||||
set_p2d (dev, 6, GRUB_CS5536_DESTINATION_USB, 0x05023000);
|
||||
VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_USB_CONTROLLER_BASE,
|
||||
VasEBoot_CS5536_MSR_USB_BASE_BUS_MASTER
|
||||
| VasEBoot_CS5536_MSR_USB_BASE_MEMORY_ENABLE | 0x05020000);
|
||||
VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_USB_OPTION_CONTROLLER_BASE,
|
||||
VasEBoot_CS5536_MSR_USB_BASE_MEMORY_ENABLE | 0x05022000);
|
||||
set_p2d (dev, 0, VasEBoot_CS5536_DESTINATION_USB, 0x05020000);
|
||||
set_p2d (dev, 1, VasEBoot_CS5536_DESTINATION_USB, 0x05022000);
|
||||
set_p2d (dev, 5, VasEBoot_CS5536_DESTINATION_USB, 0x05024000);
|
||||
set_p2d (dev, 6, VasEBoot_CS5536_DESTINATION_USB, 0x05023000);
|
||||
|
||||
{
|
||||
volatile grub_uint32_t *oc;
|
||||
oc = grub_pci_device_map_range (dev, 0x05022000,
|
||||
GRUB_CS5536_USB_OPTION_REGS_SIZE);
|
||||
volatile VasEBoot_uint32_t *oc;
|
||||
oc = VasEBoot_pci_device_map_range (dev, 0x05022000,
|
||||
VasEBoot_CS5536_USB_OPTION_REGS_SIZE);
|
||||
|
||||
oc[GRUB_CS5536_USB_OPTION_REG_UOCMUX] =
|
||||
(oc[GRUB_CS5536_USB_OPTION_REG_UOCMUX]
|
||||
& ~GRUB_CS5536_USB_OPTION_REG_UOCMUX_PMUX_MASK)
|
||||
| GRUB_CS5536_USB_OPTION_REG_UOCMUX_PMUX_HC;
|
||||
grub_pci_device_unmap_range (dev, oc, GRUB_CS5536_USB_OPTION_REGS_SIZE);
|
||||
oc[VasEBoot_CS5536_USB_OPTION_REG_UOCMUX] =
|
||||
(oc[VasEBoot_CS5536_USB_OPTION_REG_UOCMUX]
|
||||
& ~VasEBoot_CS5536_USB_OPTION_REG_UOCMUX_PMUX_MASK)
|
||||
| VasEBoot_CS5536_USB_OPTION_REG_UOCMUX_PMUX_HC;
|
||||
VasEBoot_pci_device_unmap_range (dev, oc, VasEBoot_CS5536_USB_OPTION_REGS_SIZE);
|
||||
}
|
||||
|
||||
/* Setup IDE controller. */
|
||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_IDE_IO_BAR,
|
||||
GRUB_CS5536_LBAR_IDE
|
||||
| GRUB_CS5536_MSR_IDE_IO_BAR_UNITS);
|
||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_IDE_CFG,
|
||||
GRUB_CS5536_MSR_IDE_CFG_CHANNEL_ENABLE);
|
||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_IDE_TIMING,
|
||||
(GRUB_CS5536_MSR_IDE_TIMING_PIO0
|
||||
<< GRUB_CS5536_MSR_IDE_TIMING_DRIVE0_SHIFT)
|
||||
| (GRUB_CS5536_MSR_IDE_TIMING_PIO0
|
||||
<< GRUB_CS5536_MSR_IDE_TIMING_DRIVE1_SHIFT));
|
||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_IDE_CAS_TIMING,
|
||||
(GRUB_CS5536_MSR_IDE_CAS_TIMING_CMD_PIO0
|
||||
<< GRUB_CS5536_MSR_IDE_CAS_TIMING_CMD_SHIFT)
|
||||
| (GRUB_CS5536_MSR_IDE_CAS_TIMING_PIO0
|
||||
<< GRUB_CS5536_MSR_IDE_CAS_TIMING_DRIVE0_SHIFT)
|
||||
| (GRUB_CS5536_MSR_IDE_CAS_TIMING_PIO0
|
||||
<< GRUB_CS5536_MSR_IDE_CAS_TIMING_DRIVE1_SHIFT));
|
||||
VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_IDE_IO_BAR,
|
||||
VasEBoot_CS5536_LBAR_IDE
|
||||
| VasEBoot_CS5536_MSR_IDE_IO_BAR_UNITS);
|
||||
VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_IDE_CFG,
|
||||
VasEBoot_CS5536_MSR_IDE_CFG_CHANNEL_ENABLE);
|
||||
VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_IDE_TIMING,
|
||||
(VasEBoot_CS5536_MSR_IDE_TIMING_PIO0
|
||||
<< VasEBoot_CS5536_MSR_IDE_TIMING_DRIVE0_SHIFT)
|
||||
| (VasEBoot_CS5536_MSR_IDE_TIMING_PIO0
|
||||
<< VasEBoot_CS5536_MSR_IDE_TIMING_DRIVE1_SHIFT));
|
||||
VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_IDE_CAS_TIMING,
|
||||
(VasEBoot_CS5536_MSR_IDE_CAS_TIMING_CMD_PIO0
|
||||
<< VasEBoot_CS5536_MSR_IDE_CAS_TIMING_CMD_SHIFT)
|
||||
| (VasEBoot_CS5536_MSR_IDE_CAS_TIMING_PIO0
|
||||
<< VasEBoot_CS5536_MSR_IDE_CAS_TIMING_DRIVE0_SHIFT)
|
||||
| (VasEBoot_CS5536_MSR_IDE_CAS_TIMING_PIO0
|
||||
<< VasEBoot_CS5536_MSR_IDE_CAS_TIMING_DRIVE1_SHIFT));
|
||||
|
||||
/* Setup Geodelink PCI. */
|
||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_GL_PCI_CTRL,
|
||||
(4ULL << GRUB_CS5536_MSR_GL_PCI_CTRL_OUT_THR_SHIFT)
|
||||
| (4ULL << GRUB_CS5536_MSR_GL_PCI_CTRL_IN_THR_SHIFT)
|
||||
| (8ULL << GRUB_CS5536_MSR_GL_PCI_CTRL_LATENCY_SHIFT)
|
||||
| GRUB_CS5536_MSR_GL_PCI_CTRL_IO_ENABLE
|
||||
| GRUB_CS5536_MSR_GL_PCI_CTRL_MEMORY_ENABLE);
|
||||
VasEBoot_cs5536_write_msr (dev, VasEBoot_CS5536_MSR_GL_PCI_CTRL,
|
||||
(4ULL << VasEBoot_CS5536_MSR_GL_PCI_CTRL_OUT_THR_SHIFT)
|
||||
| (4ULL << VasEBoot_CS5536_MSR_GL_PCI_CTRL_IN_THR_SHIFT)
|
||||
| (8ULL << VasEBoot_CS5536_MSR_GL_PCI_CTRL_LATENCY_SHIFT)
|
||||
| VasEBoot_CS5536_MSR_GL_PCI_CTRL_IO_ENABLE
|
||||
| VasEBoot_CS5536_MSR_GL_PCI_CTRL_MEMORY_ENABLE);
|
||||
|
||||
/* Setup windows. */
|
||||
set_io_space (dev, 0, GRUB_CS5536_LBAR_SMBUS, GRUB_CS5536_SMBUS_REGS_SIZE);
|
||||
set_io_space (dev, 1, GRUB_CS5536_LBAR_GPIO, GRUB_CS5536_GPIO_REGS_SIZE);
|
||||
set_io_space (dev, 2, GRUB_CS5536_LBAR_MFGPT, GRUB_CS5536_MFGPT_REGS_SIZE);
|
||||
set_io_space (dev, 3, GRUB_CS5536_LBAR_IRQ_MAP, GRUB_CS5536_IRQ_MAP_REGS_SIZE);
|
||||
set_io_space (dev, 4, GRUB_CS5536_LBAR_PM, GRUB_CS5536_PM_REGS_SIZE);
|
||||
set_io_space (dev, 5, GRUB_CS5536_LBAR_ACPI, GRUB_CS5536_ACPI_REGS_SIZE);
|
||||
set_iod (dev, 0, GRUB_CS5536_DESTINATION_IDE, GRUB_ATA_CH0_PORT1, 0xffff8);
|
||||
set_iod (dev, 1, GRUB_CS5536_DESTINATION_ACC, GRUB_CS5536_LBAR_ACC, 0xfff80);
|
||||
set_iod (dev, 2, GRUB_CS5536_DESTINATION_IDE, GRUB_CS5536_LBAR_IDE, 0xffff0);
|
||||
set_io_space (dev, 0, VasEBoot_CS5536_LBAR_SMBUS, VasEBoot_CS5536_SMBUS_REGS_SIZE);
|
||||
set_io_space (dev, 1, VasEBoot_CS5536_LBAR_GPIO, VasEBoot_CS5536_GPIO_REGS_SIZE);
|
||||
set_io_space (dev, 2, VasEBoot_CS5536_LBAR_MFGPT, VasEBoot_CS5536_MFGPT_REGS_SIZE);
|
||||
set_io_space (dev, 3, VasEBoot_CS5536_LBAR_IRQ_MAP, VasEBoot_CS5536_IRQ_MAP_REGS_SIZE);
|
||||
set_io_space (dev, 4, VasEBoot_CS5536_LBAR_PM, VasEBoot_CS5536_PM_REGS_SIZE);
|
||||
set_io_space (dev, 5, VasEBoot_CS5536_LBAR_ACPI, VasEBoot_CS5536_ACPI_REGS_SIZE);
|
||||
set_iod (dev, 0, VasEBoot_CS5536_DESTINATION_IDE, VasEBoot_ATA_CH0_PORT1, 0xffff8);
|
||||
set_iod (dev, 1, VasEBoot_CS5536_DESTINATION_ACC, VasEBoot_CS5536_LBAR_ACC, 0xfff80);
|
||||
set_iod (dev, 2, VasEBoot_CS5536_DESTINATION_IDE, VasEBoot_CS5536_LBAR_IDE, 0xffff0);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,38 +1,38 @@
|
|||
/* pci.c - Generic PCI interfaces. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/pci.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/emu/misc.h>
|
||||
#include <grub/util/misc.h>
|
||||
#include <VasEBoot/pci.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/emu/misc.h>
|
||||
#include <VasEBoot/util/misc.h>
|
||||
|
||||
grub_pci_address_t
|
||||
grub_pci_make_address (grub_pci_device_t dev, int reg)
|
||||
VasEBoot_pci_address_t
|
||||
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.pos = reg;
|
||||
return ret;
|
||||
}
|
||||
|
||||
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_slot_match slot;
|
||||
|
|
@ -48,31 +48,31 @@ grub_pci_iterate (grub_pci_iteratefunc_t hook, void *hook_data)
|
|||
}
|
||||
|
||||
void *
|
||||
grub_pci_device_map_range (grub_pci_device_t dev, grub_addr_t base,
|
||||
grub_size_t size)
|
||||
VasEBoot_pci_device_map_range (VasEBoot_pci_device_t dev, VasEBoot_addr_t base,
|
||||
VasEBoot_size_t size)
|
||||
{
|
||||
void *addr;
|
||||
int err;
|
||||
err = pci_device_map_range (dev, base, size, PCI_DEV_MAP_FLAG_WRITABLE, &addr);
|
||||
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);
|
||||
return addr;
|
||||
}
|
||||
|
||||
void
|
||||
grub_pci_device_unmap_range (grub_pci_device_t dev, void *mem,
|
||||
grub_size_t size)
|
||||
VasEBoot_pci_device_unmap_range (VasEBoot_pci_device_t dev, void *mem,
|
||||
VasEBoot_size_t size)
|
||||
{
|
||||
pci_device_unmap_range (dev, mem, size);
|
||||
}
|
||||
|
||||
GRUB_MOD_INIT (emupci)
|
||||
VasEBoot_MOD_INIT (emupci)
|
||||
{
|
||||
pci_system_init ();
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI (emupci)
|
||||
VasEBoot_MOD_FINI (emupci)
|
||||
{
|
||||
pci_system_cleanup ();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,42 +1,42 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/pci.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/ieee1275/ieee1275.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/pci.h>
|
||||
#include <VasEBoot/mm.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/ieee1275/ieee1275.h>
|
||||
|
||||
volatile void *
|
||||
grub_pci_device_map_range (grub_pci_device_t dev __attribute__ ((unused)),
|
||||
grub_addr_t base,
|
||||
grub_size_t size)
|
||||
VasEBoot_pci_device_map_range (VasEBoot_pci_device_t dev __attribute__ ((unused)),
|
||||
VasEBoot_addr_t base,
|
||||
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;
|
||||
if (grub_ieee1275_map (base, base, size, 7))
|
||||
grub_fatal ("couldn't map 0x%lx", base);
|
||||
if (VasEBoot_ieee1275_map (base, base, size, 7))
|
||||
VasEBoot_fatal ("couldn't map 0x%lx", base);
|
||||
return (volatile void *) base;
|
||||
}
|
||||
|
||||
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)),
|
||||
grub_size_t size __attribute__ ((unused)))
|
||||
VasEBoot_size_t size __attribute__ ((unused)))
|
||||
{
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,118 +1,118 @@
|
|||
/* pci.c - Generic PCI interfaces. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/pci.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/mm_private.h>
|
||||
#include <grub/cache.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/pci.h>
|
||||
#include <VasEBoot/mm.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/mm_private.h>
|
||||
#include <VasEBoot/cache.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
VasEBoot_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
/* FIXME: correctly support 64-bit architectures. */
|
||||
/* #if GRUB_TARGET_SIZEOF_VOID_P == 4 */
|
||||
struct grub_pci_dma_chunk *
|
||||
grub_memalign_dma32 (grub_size_t align, grub_size_t size)
|
||||
/* #if VasEBoot_TARGET_SIZEOF_VOID_P == 4 */
|
||||
struct VasEBoot_pci_dma_chunk *
|
||||
VasEBoot_memalign_dma32 (VasEBoot_size_t align, VasEBoot_size_t size)
|
||||
{
|
||||
void *ret;
|
||||
if (align < 64)
|
||||
align = 64;
|
||||
size = ALIGN_UP (size, align);
|
||||
ret = grub_memalign (align, size);
|
||||
#if GRUB_CPU_SIZEOF_VOID_P == 8
|
||||
if ((grub_addr_t) ret >> 32)
|
||||
ret = VasEBoot_memalign (align, size);
|
||||
#if VasEBoot_CPU_SIZEOF_VOID_P == 8
|
||||
if ((VasEBoot_addr_t) ret >> 32)
|
||||
{
|
||||
/* Shouldn't happend since the only platform in this case is
|
||||
x86_64-efi and it skips any regions > 4GiB because
|
||||
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;
|
||||
}
|
||||
#endif
|
||||
if (!ret)
|
||||
return 0;
|
||||
grub_arch_sync_dma_caches (ret, size);
|
||||
VasEBoot_arch_sync_dma_caches (ret, size);
|
||||
return ret;
|
||||
}
|
||||
|
||||
/* FIXME: evil. */
|
||||
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;
|
||||
grub_arch_sync_dma_caches (ch, size);
|
||||
grub_free (ch);
|
||||
VasEBoot_size_t size = (((struct VasEBoot_mm_header *) ch) - 1)->size * VasEBoot_MM_ALIGN;
|
||||
VasEBoot_arch_sync_dma_caches (ch, size);
|
||||
VasEBoot_free (ch);
|
||||
}
|
||||
/* #endif */
|
||||
|
||||
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||
#ifdef VasEBoot_MACHINE_MIPS_LOONGSON
|
||||
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
|
||||
grub_dma_get_phys (struct grub_pci_dma_chunk *ch)
|
||||
VasEBoot_uint32_t
|
||||
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
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
grub_uint32_t
|
||||
grub_dma_get_phys (struct grub_pci_dma_chunk *ch)
|
||||
VasEBoot_uint32_t
|
||||
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
|
||||
|
||||
grub_pci_address_t
|
||||
grub_pci_make_address (grub_pci_device_t dev, int reg)
|
||||
VasEBoot_pci_address_t
|
||||
VasEBoot_pci_make_address (VasEBoot_pci_device_t dev, int reg)
|
||||
{
|
||||
return (1 << 31) | (dev.bus << 16) | (dev.device << 11)
|
||||
| (dev.function << 8) | reg;
|
||||
}
|
||||
|
||||
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;
|
||||
grub_pci_address_t addr;
|
||||
grub_pci_id_t id;
|
||||
grub_uint32_t hdr;
|
||||
VasEBoot_pci_device_t dev;
|
||||
VasEBoot_pci_address_t addr;
|
||||
VasEBoot_pci_id_t id;
|
||||
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++)
|
||||
{
|
||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_PCI_ID);
|
||||
id = grub_pci_read (addr);
|
||||
addr = VasEBoot_pci_make_address (dev, VasEBoot_PCI_REG_PCI_ID);
|
||||
id = VasEBoot_pci_read (addr);
|
||||
|
||||
/* Check if there is a device present. */
|
||||
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 */
|
||||
if (dev.function == 0)
|
||||
{
|
||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_CACHELINE);
|
||||
hdr = grub_pci_read (addr);
|
||||
addr = VasEBoot_pci_make_address (dev, VasEBoot_PCI_REG_CACHELINE);
|
||||
hdr = VasEBoot_pci_read (addr);
|
||||
if (!(hdr & 0x800000))
|
||||
break;
|
||||
}
|
||||
|
|
@ -141,26 +141,26 @@ grub_pci_iterate (grub_pci_iteratefunc_t hook, void *hook_data)
|
|||
}
|
||||
}
|
||||
|
||||
grub_uint8_t
|
||||
grub_pci_find_capability (grub_pci_device_t dev, grub_uint8_t cap)
|
||||
VasEBoot_uint8_t
|
||||
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;
|
||||
|
||||
while (ttl--)
|
||||
{
|
||||
grub_uint8_t id;
|
||||
grub_pci_address_t addr;
|
||||
VasEBoot_uint8_t id;
|
||||
VasEBoot_pci_address_t addr;
|
||||
|
||||
addr = grub_pci_make_address (dev, pos);
|
||||
pos = grub_pci_read_byte (addr);
|
||||
addr = VasEBoot_pci_make_address (dev, pos);
|
||||
pos = VasEBoot_pci_read_byte (addr);
|
||||
if (pos < 0x40)
|
||||
break;
|
||||
|
||||
pos &= ~3;
|
||||
|
||||
addr = grub_pci_make_address (dev, pos);
|
||||
id = grub_pci_read_byte (addr);
|
||||
addr = VasEBoot_pci_make_address (dev, pos);
|
||||
id = VasEBoot_pci_read_byte (addr);
|
||||
|
||||
if (id == 0xff)
|
||||
break;
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
|
|
@ -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.
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/serial.h>
|
||||
#include <grub/usbserial.h>
|
||||
#include <grub/dl.h>
|
||||
#include <VasEBoot/serial.h>
|
||||
#include <VasEBoot/usbserial.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
VasEBoot_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
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].attached = 0;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
grub_serial_unregister (port);
|
||||
VasEBoot_serial_unregister (port);
|
||||
}
|
||||
|
||||
static int usbnum = 0;
|
||||
|
||||
int
|
||||
grub_usbserial_attach (grub_usb_device_t usbdev, int configno, int interfno,
|
||||
struct grub_serial_driver *driver, int in_endp,
|
||||
VasEBoot_usbserial_attach (VasEBoot_usb_device_t usbdev, int configno, int interfno,
|
||||
struct VasEBoot_serial_driver *driver, int in_endp,
|
||||
int out_endp)
|
||||
{
|
||||
struct grub_serial_port *port;
|
||||
struct VasEBoot_serial_port *port;
|
||||
int j;
|
||||
struct grub_usb_desc_if *interf;
|
||||
grub_usb_err_t err = GRUB_USB_ERR_NONE;
|
||||
struct VasEBoot_usb_desc_if *interf;
|
||||
VasEBoot_usb_err_t err = VasEBoot_USB_ERR_NONE;
|
||||
|
||||
interf = usbdev->config[configno].interf[interfno].descif;
|
||||
|
||||
port = grub_zalloc (sizeof (*port));
|
||||
port = VasEBoot_zalloc (sizeof (*port));
|
||||
if (!port)
|
||||
{
|
||||
grub_print_error ();
|
||||
VasEBoot_print_error ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
port->name = grub_xasprintf ("usb%d", usbnum++);
|
||||
port->name = VasEBoot_xasprintf ("usb%d", usbnum++);
|
||||
if (!port->name)
|
||||
{
|
||||
grub_free (port);
|
||||
grub_print_error ();
|
||||
VasEBoot_free (port);
|
||||
VasEBoot_print_error ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -71,18 +71,18 @@ grub_usbserial_attach (grub_usb_device_t usbdev, int configno, int interfno,
|
|||
port->driver = driver;
|
||||
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];
|
||||
|
||||
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))
|
||||
{
|
||||
/* Bulk IN endpoint. */
|
||||
port->in_endp = endp;
|
||||
}
|
||||
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))
|
||||
{
|
||||
/* Bulk OUT endpoint. */
|
||||
|
|
@ -92,23 +92,23 @@ grub_usbserial_attach (grub_usb_device_t usbdev, int configno, int interfno,
|
|||
|
||||
/* Configure device */
|
||||
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)
|
||||
{
|
||||
grub_free (port->name);
|
||||
grub_free (port);
|
||||
VasEBoot_free (port->name);
|
||||
VasEBoot_free (port);
|
||||
return 0;
|
||||
}
|
||||
|
||||
port->configno = configno;
|
||||
port->interfno = interfno;
|
||||
|
||||
grub_serial_config_defaults (port);
|
||||
grub_serial_register (port);
|
||||
VasEBoot_serial_config_defaults (port);
|
||||
VasEBoot_serial_register (port);
|
||||
|
||||
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;
|
||||
|
||||
|
|
@ -116,18 +116,18 @@ grub_usbserial_attach (grub_usb_device_t usbdev, int configno, int interfno,
|
|||
}
|
||||
|
||||
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;
|
||||
grub_size_t actual;
|
||||
VasEBoot_usb_err_t err;
|
||||
VasEBoot_size_t actual;
|
||||
|
||||
if (port->bufstart < port->bufend)
|
||||
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,
|
||||
&actual);
|
||||
if (err != GRUB_USB_ERR_NONE)
|
||||
if (err != VasEBoot_USB_ERR_NONE)
|
||||
return -1;
|
||||
|
||||
port->bufstart = header_size;
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/serial.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/usb.h>
|
||||
#include <grub/usbserial.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <VasEBoot/serial.h>
|
||||
#include <VasEBoot/types.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/mm.h>
|
||||
#include <VasEBoot/usb.h>
|
||||
#include <VasEBoot/usbserial.h>
|
||||
#include <VasEBoot/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
VasEBoot_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
enum
|
||||
{
|
||||
GRUB_FTDI_MODEM_CTRL = 0x01,
|
||||
GRUB_FTDI_FLOW_CTRL = 0x02,
|
||||
GRUB_FTDI_SPEED_CTRL = 0x03,
|
||||
GRUB_FTDI_DATA_CTRL = 0x04
|
||||
VasEBoot_FTDI_MODEM_CTRL = 0x01,
|
||||
VasEBoot_FTDI_FLOW_CTRL = 0x02,
|
||||
VasEBoot_FTDI_SPEED_CTRL = 0x03,
|
||||
VasEBoot_FTDI_DATA_CTRL = 0x04
|
||||
};
|
||||
|
||||
#define GRUB_FTDI_MODEM_CTRL_DTRRTS 3
|
||||
#define GRUB_FTDI_FLOW_CTRL_DTRRTS 3
|
||||
#define VasEBoot_FTDI_MODEM_CTRL_DTRRTS 3
|
||||
#define VasEBoot_FTDI_FLOW_CTRL_DTRRTS 3
|
||||
|
||||
/* Convert speed to divisor. */
|
||||
static grub_uint32_t
|
||||
static VasEBoot_uint32_t
|
||||
get_divisor (unsigned int speed)
|
||||
{
|
||||
unsigned int i;
|
||||
|
|
@ -48,7 +48,7 @@ get_divisor (unsigned int speed)
|
|||
struct divisor
|
||||
{
|
||||
unsigned int speed;
|
||||
grub_uint32_t div;
|
||||
VasEBoot_uint32_t div;
|
||||
};
|
||||
|
||||
/* The table which lists common configurations. */
|
||||
|
|
@ -72,40 +72,40 @@ get_divisor (unsigned int speed)
|
|||
}
|
||||
|
||||
static void
|
||||
real_config (struct grub_serial_port *port)
|
||||
real_config (struct VasEBoot_serial_port *port)
|
||||
{
|
||||
grub_uint32_t divisor;
|
||||
const grub_uint16_t parities[] = {
|
||||
[GRUB_SERIAL_PARITY_NONE] = 0x0000,
|
||||
[GRUB_SERIAL_PARITY_ODD] = 0x0100,
|
||||
[GRUB_SERIAL_PARITY_EVEN] = 0x0200
|
||||
VasEBoot_uint32_t divisor;
|
||||
const VasEBoot_uint16_t parities[] = {
|
||||
[VasEBoot_SERIAL_PARITY_NONE] = 0x0000,
|
||||
[VasEBoot_SERIAL_PARITY_ODD] = 0x0100,
|
||||
[VasEBoot_SERIAL_PARITY_EVEN] = 0x0200
|
||||
};
|
||||
const grub_uint16_t stop_bits[] = {
|
||||
[GRUB_SERIAL_STOP_BITS_1] = 0x0000,
|
||||
[GRUB_SERIAL_STOP_BITS_1_5] = 0x0800,
|
||||
[GRUB_SERIAL_STOP_BITS_2] = 0x1000,
|
||||
const VasEBoot_uint16_t stop_bits[] = {
|
||||
[VasEBoot_SERIAL_STOP_BITS_1] = 0x0000,
|
||||
[VasEBoot_SERIAL_STOP_BITS_1_5] = 0x0800,
|
||||
[VasEBoot_SERIAL_STOP_BITS_2] = 0x1000,
|
||||
};
|
||||
|
||||
if (port->configured)
|
||||
return;
|
||||
|
||||
grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT,
|
||||
GRUB_FTDI_MODEM_CTRL,
|
||||
port->config.rtscts ? GRUB_FTDI_MODEM_CTRL_DTRRTS : 0,
|
||||
VasEBoot_usb_control_msg (port->usbdev, VasEBoot_USB_REQTYPE_VENDOR_OUT,
|
||||
VasEBoot_FTDI_MODEM_CTRL,
|
||||
port->config.rtscts ? VasEBoot_FTDI_MODEM_CTRL_DTRRTS : 0,
|
||||
0, 0, 0);
|
||||
|
||||
grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT,
|
||||
GRUB_FTDI_FLOW_CTRL,
|
||||
port->config.rtscts ? GRUB_FTDI_FLOW_CTRL_DTRRTS : 0,
|
||||
VasEBoot_usb_control_msg (port->usbdev, VasEBoot_USB_REQTYPE_VENDOR_OUT,
|
||||
VasEBoot_FTDI_FLOW_CTRL,
|
||||
port->config.rtscts ? VasEBoot_FTDI_FLOW_CTRL_DTRRTS : 0,
|
||||
0, 0, 0);
|
||||
|
||||
divisor = get_divisor (port->config.speed);
|
||||
grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT,
|
||||
GRUB_FTDI_SPEED_CTRL,
|
||||
VasEBoot_usb_control_msg (port->usbdev, VasEBoot_USB_REQTYPE_VENDOR_OUT,
|
||||
VasEBoot_FTDI_SPEED_CTRL,
|
||||
divisor & 0xffff, divisor >> 16, 0, 0);
|
||||
|
||||
grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_VENDOR_OUT,
|
||||
GRUB_FTDI_DATA_CTRL,
|
||||
VasEBoot_usb_control_msg (port->usbdev, VasEBoot_USB_REQTYPE_VENDOR_OUT,
|
||||
VasEBoot_FTDI_DATA_CTRL,
|
||||
parities[port->config.parity]
|
||||
| stop_bits[port->config.stop_bits]
|
||||
| port->config.word_len, 0, 0, 0);
|
||||
|
|
@ -115,75 +115,75 @@ real_config (struct grub_serial_port *port)
|
|||
|
||||
/* Fetch a key. */
|
||||
static int
|
||||
ftdi_hw_fetch (struct grub_serial_port *port)
|
||||
ftdi_hw_fetch (struct VasEBoot_serial_port *port)
|
||||
{
|
||||
real_config (port);
|
||||
|
||||
return grub_usbserial_fetch (port, 2);
|
||||
return VasEBoot_usbserial_fetch (port, 2);
|
||||
}
|
||||
|
||||
/* Put a character. */
|
||||
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;
|
||||
|
||||
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
|
||||
ftdi_hw_configure (struct grub_serial_port *port,
|
||||
struct grub_serial_config *config)
|
||||
static VasEBoot_err_t
|
||||
ftdi_hw_configure (struct VasEBoot_serial_port *port,
|
||||
struct VasEBoot_serial_config *config)
|
||||
{
|
||||
grub_uint16_t divisor;
|
||||
VasEBoot_uint16_t divisor;
|
||||
|
||||
divisor = get_divisor (config->speed);
|
||||
if (divisor == 0)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT,
|
||||
N_("unsupported serial port speed"));
|
||||
|
||||
if (config->parity != GRUB_SERIAL_PARITY_NONE
|
||||
&& config->parity != GRUB_SERIAL_PARITY_ODD
|
||||
&& config->parity != GRUB_SERIAL_PARITY_EVEN)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
if (config->parity != VasEBoot_SERIAL_PARITY_NONE
|
||||
&& config->parity != VasEBoot_SERIAL_PARITY_ODD
|
||||
&& config->parity != VasEBoot_SERIAL_PARITY_EVEN)
|
||||
return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT,
|
||||
N_("unsupported serial port parity"));
|
||||
|
||||
if (config->stop_bits != GRUB_SERIAL_STOP_BITS_1
|
||||
&& config->stop_bits != GRUB_SERIAL_STOP_BITS_1_5
|
||||
&& config->stop_bits != GRUB_SERIAL_STOP_BITS_2)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
if (config->stop_bits != VasEBoot_SERIAL_STOP_BITS_1
|
||||
&& config->stop_bits != VasEBoot_SERIAL_STOP_BITS_1_5
|
||||
&& config->stop_bits != VasEBoot_SERIAL_STOP_BITS_2)
|
||||
return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT,
|
||||
N_("unsupported serial port stop bits number"));
|
||||
|
||||
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"));
|
||||
|
||||
port->config = *config;
|
||||
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,
|
||||
.fetch = ftdi_hw_fetch,
|
||||
.put = ftdi_hw_put,
|
||||
.fini = grub_usbserial_fini
|
||||
.fini = VasEBoot_usbserial_fini
|
||||
};
|
||||
|
||||
static const struct
|
||||
{
|
||||
grub_uint16_t vendor, product;
|
||||
VasEBoot_uint16_t vendor, product;
|
||||
} products[] =
|
||||
{
|
||||
{0x0403, 0x6001} /* QEMU virtual USBserial. */
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
|
|
@ -194,25 +194,25 @@ grub_ftdi_attach (grub_usb_device_t usbdev, int configno, int interfno)
|
|||
if (j == ARRAY_SIZE (products))
|
||||
return 0;
|
||||
|
||||
return grub_usbserial_attach (usbdev, configno, interfno,
|
||||
&grub_ftdi_driver,
|
||||
GRUB_USB_SERIAL_ENDPOINT_LAST_MATCHING,
|
||||
GRUB_USB_SERIAL_ENDPOINT_LAST_MATCHING);
|
||||
return VasEBoot_usbserial_attach (usbdev, configno, interfno,
|
||||
&VasEBoot_ftdi_driver,
|
||||
VasEBoot_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,
|
||||
.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);
|
||||
grub_usb_unregister_attach_hook_class (&attach_hook);
|
||||
VasEBoot_serial_unregister_driver (&VasEBoot_ftdi_driver);
|
||||
VasEBoot_usb_unregister_attach_hook_class (&attach_hook);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/serial.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/usb.h>
|
||||
#include <grub/usbserial.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <VasEBoot/serial.h>
|
||||
#include <VasEBoot/types.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/mm.h>
|
||||
#include <VasEBoot/usb.h>
|
||||
#include <VasEBoot/usbserial.h>
|
||||
#include <VasEBoot/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
VasEBoot_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
/* Convert speed to divisor. */
|
||||
static grub_uint32_t
|
||||
static VasEBoot_uint32_t
|
||||
is_speed_supported (unsigned int speed)
|
||||
{
|
||||
unsigned int i;
|
||||
|
|
@ -40,163 +40,163 @@ is_speed_supported (unsigned int speed)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#define GRUB_PL2303_REQUEST_SET_CONFIG 0x20
|
||||
#define GRUB_PL2303_STOP_BITS_1 0x0
|
||||
#define GRUB_PL2303_STOP_BITS_1_5 0x1
|
||||
#define GRUB_PL2303_STOP_BITS_2 0x2
|
||||
#define VasEBoot_PL2303_REQUEST_SET_CONFIG 0x20
|
||||
#define VasEBoot_PL2303_STOP_BITS_1 0x0
|
||||
#define VasEBoot_PL2303_STOP_BITS_1_5 0x1
|
||||
#define VasEBoot_PL2303_STOP_BITS_2 0x2
|
||||
|
||||
#define GRUB_PL2303_PARITY_NONE 0
|
||||
#define GRUB_PL2303_PARITY_ODD 1
|
||||
#define GRUB_PL2303_PARITY_EVEN 2
|
||||
#define VasEBoot_PL2303_PARITY_NONE 0
|
||||
#define VasEBoot_PL2303_PARITY_ODD 1
|
||||
#define VasEBoot_PL2303_PARITY_EVEN 2
|
||||
|
||||
struct grub_pl2303_config
|
||||
struct VasEBoot_pl2303_config
|
||||
{
|
||||
grub_uint32_t speed;
|
||||
grub_uint8_t stop_bits;
|
||||
grub_uint8_t parity;
|
||||
grub_uint8_t word_len;
|
||||
} GRUB_PACKED;
|
||||
VasEBoot_uint32_t speed;
|
||||
VasEBoot_uint8_t stop_bits;
|
||||
VasEBoot_uint8_t parity;
|
||||
VasEBoot_uint8_t word_len;
|
||||
} VasEBoot_PACKED;
|
||||
|
||||
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;
|
||||
|
||||
if (port->configured)
|
||||
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);
|
||||
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);
|
||||
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
|
||||
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);
|
||||
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);
|
||||
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
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);
|
||||
|
||||
if (port->config.stop_bits == GRUB_SERIAL_STOP_BITS_2)
|
||||
config_pl2303.stop_bits = GRUB_PL2303_STOP_BITS_2;
|
||||
else if (port->config.stop_bits == GRUB_SERIAL_STOP_BITS_1_5)
|
||||
config_pl2303.stop_bits = GRUB_PL2303_STOP_BITS_1_5;
|
||||
if (port->config.stop_bits == VasEBoot_SERIAL_STOP_BITS_2)
|
||||
config_pl2303.stop_bits = VasEBoot_PL2303_STOP_BITS_2;
|
||||
else if (port->config.stop_bits == VasEBoot_SERIAL_STOP_BITS_1_5)
|
||||
config_pl2303.stop_bits = VasEBoot_PL2303_STOP_BITS_1_5;
|
||||
else
|
||||
config_pl2303.stop_bits = GRUB_PL2303_STOP_BITS_1;
|
||||
config_pl2303.stop_bits = VasEBoot_PL2303_STOP_BITS_1;
|
||||
|
||||
switch (port->config.parity)
|
||||
{
|
||||
case GRUB_SERIAL_PARITY_NONE:
|
||||
config_pl2303.parity = GRUB_PL2303_PARITY_NONE;
|
||||
case VasEBoot_SERIAL_PARITY_NONE:
|
||||
config_pl2303.parity = VasEBoot_PL2303_PARITY_NONE;
|
||||
break;
|
||||
case GRUB_SERIAL_PARITY_ODD:
|
||||
config_pl2303.parity = GRUB_PL2303_PARITY_ODD;
|
||||
case VasEBoot_SERIAL_PARITY_ODD:
|
||||
config_pl2303.parity = VasEBoot_PL2303_PARITY_ODD;
|
||||
break;
|
||||
case GRUB_SERIAL_PARITY_EVEN:
|
||||
config_pl2303.parity = GRUB_PL2303_PARITY_EVEN;
|
||||
case VasEBoot_SERIAL_PARITY_EVEN:
|
||||
config_pl2303.parity = VasEBoot_PL2303_PARITY_EVEN;
|
||||
break;
|
||||
}
|
||||
|
||||
config_pl2303.word_len = port->config.word_len;
|
||||
config_pl2303.speed = port->config.speed;
|
||||
grub_usb_control_msg (port->usbdev, GRUB_USB_REQTYPE_CLASS_INTERFACE_OUT,
|
||||
GRUB_PL2303_REQUEST_SET_CONFIG, 0, 0,
|
||||
VasEBoot_usb_control_msg (port->usbdev, VasEBoot_USB_REQTYPE_CLASS_INTERFACE_OUT,
|
||||
VasEBoot_PL2303_REQUEST_SET_CONFIG, 0, 0,
|
||||
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);
|
||||
|
||||
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);
|
||||
port->configured = 1;
|
||||
}
|
||||
|
||||
/* Fetch a key. */
|
||||
static int
|
||||
pl2303_hw_fetch (struct grub_serial_port *port)
|
||||
pl2303_hw_fetch (struct VasEBoot_serial_port *port)
|
||||
{
|
||||
real_config (port);
|
||||
|
||||
return grub_usbserial_fetch (port, 0);
|
||||
return VasEBoot_usbserial_fetch (port, 0);
|
||||
}
|
||||
|
||||
/* Put a character. */
|
||||
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;
|
||||
|
||||
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
|
||||
pl2303_hw_configure (struct grub_serial_port *port,
|
||||
struct grub_serial_config *config)
|
||||
static VasEBoot_err_t
|
||||
pl2303_hw_configure (struct VasEBoot_serial_port *port,
|
||||
struct VasEBoot_serial_config *config)
|
||||
{
|
||||
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"));
|
||||
|
||||
if (config->parity != GRUB_SERIAL_PARITY_NONE
|
||||
&& config->parity != GRUB_SERIAL_PARITY_ODD
|
||||
&& config->parity != GRUB_SERIAL_PARITY_EVEN)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
if (config->parity != VasEBoot_SERIAL_PARITY_NONE
|
||||
&& config->parity != VasEBoot_SERIAL_PARITY_ODD
|
||||
&& config->parity != VasEBoot_SERIAL_PARITY_EVEN)
|
||||
return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT,
|
||||
N_("unsupported serial port parity"));
|
||||
|
||||
if (config->stop_bits != GRUB_SERIAL_STOP_BITS_1
|
||||
&& config->stop_bits != GRUB_SERIAL_STOP_BITS_1_5
|
||||
&& config->stop_bits != GRUB_SERIAL_STOP_BITS_2)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
if (config->stop_bits != VasEBoot_SERIAL_STOP_BITS_1
|
||||
&& config->stop_bits != VasEBoot_SERIAL_STOP_BITS_1_5
|
||||
&& config->stop_bits != VasEBoot_SERIAL_STOP_BITS_2)
|
||||
return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT,
|
||||
N_("unsupported serial port stop bits number"));
|
||||
|
||||
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"));
|
||||
|
||||
port->config = *config;
|
||||
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,
|
||||
.fetch = pl2303_hw_fetch,
|
||||
.put = pl2303_hw_put,
|
||||
.fini = grub_usbserial_fini
|
||||
.fini = VasEBoot_usbserial_fini
|
||||
};
|
||||
|
||||
static const struct
|
||||
{
|
||||
grub_uint16_t vendor, product;
|
||||
VasEBoot_uint16_t vendor, product;
|
||||
} products[] =
|
||||
{
|
||||
{0x067b, 0x2303}
|
||||
};
|
||||
|
||||
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;
|
||||
|
||||
|
|
@ -207,25 +207,25 @@ grub_pl2303_attach (grub_usb_device_t usbdev, int configno, int interfno)
|
|||
if (j == ARRAY_SIZE (products))
|
||||
return 0;
|
||||
|
||||
return grub_usbserial_attach (usbdev, configno, interfno,
|
||||
&grub_pl2303_driver,
|
||||
GRUB_USB_SERIAL_ENDPOINT_LAST_MATCHING,
|
||||
GRUB_USB_SERIAL_ENDPOINT_LAST_MATCHING);
|
||||
return VasEBoot_usbserial_attach (usbdev, configno, interfno,
|
||||
&VasEBoot_pl2303_driver,
|
||||
VasEBoot_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,
|
||||
.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);
|
||||
grub_usb_unregister_attach_hook_class (&attach_hook);
|
||||
VasEBoot_serial_unregister_driver (&VasEBoot_pl2303_driver);
|
||||
VasEBoot_usb_unregister_attach_hook_class (&attach_hook);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/serial.h>
|
||||
#include <grub/types.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/usb.h>
|
||||
#include <grub/usbserial.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <VasEBoot/serial.h>
|
||||
#include <VasEBoot/types.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/mm.h>
|
||||
#include <VasEBoot/usb.h>
|
||||
#include <VasEBoot/usbserial.h>
|
||||
#include <VasEBoot/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
VasEBoot_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
|
||||
/* Fetch a key. */
|
||||
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. */
|
||||
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;
|
||||
|
||||
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
|
||||
usbdebug_late_hw_configure (struct grub_serial_port *port __attribute__ ((unused)),
|
||||
struct grub_serial_config *config __attribute__ ((unused)))
|
||||
static VasEBoot_err_t
|
||||
usbdebug_late_hw_configure (struct VasEBoot_serial_port *port __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,
|
||||
.fetch = usbdebug_late_hw_fetch,
|
||||
.put = usbdebug_late_hw_put,
|
||||
.fini = grub_usbserial_fini
|
||||
.fini = VasEBoot_usbserial_fini
|
||||
};
|
||||
|
||||
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;
|
||||
struct grub_usb_desc_debug debugdesc;
|
||||
VasEBoot_usb_err_t err;
|
||||
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);
|
||||
if (err)
|
||||
return 0;
|
||||
|
||||
return grub_usbserial_attach (usbdev, configno, interfno,
|
||||
&grub_usbdebug_late_driver,
|
||||
return VasEBoot_usbserial_attach (usbdev, configno, interfno,
|
||||
&VasEBoot_usbdebug_late_driver,
|
||||
debugdesc.in_endp, debugdesc.out_endp);
|
||||
}
|
||||
|
||||
static struct grub_usb_attach_desc attach_hook =
|
||||
static struct VasEBoot_usb_attach_desc attach_hook =
|
||||
{
|
||||
.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);
|
||||
grub_usb_unregister_attach_hook_class (&attach_hook);
|
||||
VasEBoot_serial_unregister_driver (&VasEBoot_usbdebug_late_driver);
|
||||
VasEBoot_usb_unregister_attach_hook_class (&attach_hook);
|
||||
}
|
||||
|
|
|
|||
File diff suppressed because it is too large
Load Diff
|
|
@ -1,47 +1,47 @@
|
|||
/* usb.c - Generic USB interfaces. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/usb.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/list.h>
|
||||
#include <grub/term.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/mm.h>
|
||||
#include <VasEBoot/usb.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/list.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
|
||||
/* Context for grub_usb_controller_iterate. */
|
||||
struct grub_usb_controller_iterate_ctx
|
||||
/* Context for VasEBoot_usb_controller_iterate. */
|
||||
struct VasEBoot_usb_controller_iterate_ctx
|
||||
{
|
||||
grub_usb_controller_iterate_hook_t hook;
|
||||
VasEBoot_usb_controller_iterate_hook_t hook;
|
||||
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
|
||||
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;
|
||||
if (ctx->hook (dev, ctx->hook_data))
|
||||
|
|
@ -50,20 +50,20 @@ grub_usb_controller_iterate_iter (grub_usb_controller_t dev, void *data)
|
|||
}
|
||||
|
||||
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)
|
||||
{
|
||||
struct grub_usb_controller_iterate_ctx ctx = {
|
||||
struct VasEBoot_usb_controller_iterate_ctx ctx = {
|
||||
.hook = hook,
|
||||
.hook_data = hook_data
|
||||
};
|
||||
|
||||
/* 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
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
@ -72,63 +72,63 @@ grub_usb_controller_iterate (grub_usb_controller_iterate_hook_t hook,
|
|||
#endif
|
||||
|
||||
|
||||
grub_usb_err_t
|
||||
grub_usb_clear_halt (grub_usb_device_t dev, int endpoint)
|
||||
VasEBoot_usb_err_t
|
||||
VasEBoot_usb_clear_halt (VasEBoot_usb_device_t dev, int endpoint)
|
||||
{
|
||||
dev->toggle[endpoint] = 0;
|
||||
return grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_OUT
|
||||
| GRUB_USB_REQTYPE_STANDARD
|
||||
| GRUB_USB_REQTYPE_TARGET_ENDP),
|
||||
GRUB_USB_REQ_CLEAR_FEATURE,
|
||||
GRUB_USB_FEATURE_ENDP_HALT,
|
||||
return VasEBoot_usb_control_msg (dev, (VasEBoot_USB_REQTYPE_OUT
|
||||
| VasEBoot_USB_REQTYPE_STANDARD
|
||||
| VasEBoot_USB_REQTYPE_TARGET_ENDP),
|
||||
VasEBoot_USB_REQ_CLEAR_FEATURE,
|
||||
VasEBoot_USB_FEATURE_ENDP_HALT,
|
||||
endpoint, 0, 0);
|
||||
}
|
||||
|
||||
grub_usb_err_t
|
||||
grub_usb_set_configuration (grub_usb_device_t dev, int configuration)
|
||||
VasEBoot_usb_err_t
|
||||
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
|
||||
| GRUB_USB_REQTYPE_STANDARD
|
||||
| GRUB_USB_REQTYPE_TARGET_DEV),
|
||||
GRUB_USB_REQ_SET_CONFIGURATION, configuration,
|
||||
return VasEBoot_usb_control_msg (dev, (VasEBoot_USB_REQTYPE_OUT
|
||||
| VasEBoot_USB_REQTYPE_STANDARD
|
||||
| VasEBoot_USB_REQTYPE_TARGET_DEV),
|
||||
VasEBoot_USB_REQ_SET_CONFIGURATION, configuration,
|
||||
0, 0, NULL);
|
||||
}
|
||||
|
||||
grub_usb_err_t
|
||||
grub_usb_get_descriptor (grub_usb_device_t dev,
|
||||
grub_uint8_t type, grub_uint8_t index,
|
||||
grub_size_t size, char *data)
|
||||
VasEBoot_usb_err_t
|
||||
VasEBoot_usb_get_descriptor (VasEBoot_usb_device_t dev,
|
||||
VasEBoot_uint8_t type, VasEBoot_uint8_t index,
|
||||
VasEBoot_size_t size, char *data)
|
||||
{
|
||||
return grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_IN
|
||||
| GRUB_USB_REQTYPE_STANDARD
|
||||
| GRUB_USB_REQTYPE_TARGET_DEV),
|
||||
GRUB_USB_REQ_GET_DESCRIPTOR,
|
||||
return VasEBoot_usb_control_msg (dev, (VasEBoot_USB_REQTYPE_IN
|
||||
| VasEBoot_USB_REQTYPE_STANDARD
|
||||
| VasEBoot_USB_REQTYPE_TARGET_DEV),
|
||||
VasEBoot_USB_REQ_GET_DESCRIPTOR,
|
||||
(type << 8) | index,
|
||||
0, size, data);
|
||||
}
|
||||
|
||||
grub_usb_err_t
|
||||
grub_usb_device_initialize (grub_usb_device_t dev)
|
||||
VasEBoot_usb_err_t
|
||||
VasEBoot_usb_device_initialize (VasEBoot_usb_device_t dev)
|
||||
{
|
||||
struct grub_usb_desc_device *descdev;
|
||||
struct grub_usb_desc_config config;
|
||||
grub_usb_err_t err;
|
||||
struct VasEBoot_usb_desc_device *descdev;
|
||||
struct VasEBoot_usb_desc_config config;
|
||||
VasEBoot_usb_err_t err;
|
||||
int i;
|
||||
|
||||
/* First we have to read first 8 bytes only and determine
|
||||
* max. size of packet */
|
||||
dev->descdev.maxsize0 = 0; /* invalidating, for safety only, can be removed if it is sure it is zero here */
|
||||
err = grub_usb_get_descriptor (dev, GRUB_USB_DESCRIPTOR_DEVICE,
|
||||
err = VasEBoot_usb_get_descriptor (dev, VasEBoot_USB_DESCRIPTOR_DEVICE,
|
||||
0, 8, (char *) &dev->descdev);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
/* Now we have valid value in dev->descdev.maxsize0,
|
||||
* so we can read whole device descriptor */
|
||||
err = grub_usb_get_descriptor (dev, GRUB_USB_DESCRIPTOR_DEVICE,
|
||||
0, sizeof (struct grub_usb_desc_device),
|
||||
err = VasEBoot_usb_get_descriptor (dev, VasEBoot_USB_DESCRIPTOR_DEVICE,
|
||||
0, sizeof (struct VasEBoot_usb_desc_device),
|
||||
(char *) &dev->descdev);
|
||||
if (err)
|
||||
return err;
|
||||
|
|
@ -139,7 +139,7 @@ grub_usb_device_initialize (grub_usb_device_t dev)
|
|||
|
||||
if (descdev->configcnt == 0)
|
||||
{
|
||||
err = GRUB_USB_ERR_BADDEVICE;
|
||||
err = VasEBoot_USB_ERR_BADDEVICE;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
|
|
@ -148,23 +148,23 @@ grub_usb_device_initialize (grub_usb_device_t dev)
|
|||
int pos;
|
||||
int currif;
|
||||
char *data;
|
||||
struct grub_usb_desc *desc;
|
||||
struct VasEBoot_usb_desc *desc;
|
||||
|
||||
/* First just read the first 4 bytes of the configuration
|
||||
descriptor, after that it is known how many bytes really have
|
||||
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);
|
||||
|
||||
data = grub_malloc (config.totallen);
|
||||
data = VasEBoot_malloc (config.totallen);
|
||||
if (! data)
|
||||
{
|
||||
err = GRUB_USB_ERR_INTERNAL;
|
||||
err = VasEBoot_USB_ERR_INTERNAL;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
dev->config[i].descconf = (struct grub_usb_desc_config *) data;
|
||||
err = grub_usb_get_descriptor (dev, GRUB_USB_DESCRIPTOR_CONFIG, i,
|
||||
dev->config[i].descconf = (struct VasEBoot_usb_desc_config *) data;
|
||||
err = VasEBoot_usb_get_descriptor (dev, VasEBoot_USB_DESCRIPTOR_CONFIG, i,
|
||||
config.totallen, data);
|
||||
if (err)
|
||||
goto fail;
|
||||
|
|
@ -177,29 +177,29 @@ grub_usb_device_initialize (grub_usb_device_t dev)
|
|||
{
|
||||
while (pos < config.totallen)
|
||||
{
|
||||
desc = (struct grub_usb_desc *)&data[pos];
|
||||
if (desc->type == GRUB_USB_DESCRIPTOR_INTERFACE)
|
||||
desc = (struct VasEBoot_usb_desc *)&data[pos];
|
||||
if (desc->type == VasEBoot_USB_DESCRIPTOR_INTERFACE)
|
||||
break;
|
||||
if (!desc->length)
|
||||
{
|
||||
err = GRUB_USB_ERR_BADDEVICE;
|
||||
err = VasEBoot_USB_ERR_BADDEVICE;
|
||||
goto fail;
|
||||
}
|
||||
pos += desc->length;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
while (pos < config.totallen)
|
||||
{
|
||||
desc = (struct grub_usb_desc *)&data[pos];
|
||||
if (desc->type == GRUB_USB_DESCRIPTOR_ENDPOINT)
|
||||
desc = (struct VasEBoot_usb_desc *)&data[pos];
|
||||
if (desc->type == VasEBoot_USB_DESCRIPTOR_ENDPOINT)
|
||||
break;
|
||||
if (!desc->length)
|
||||
{
|
||||
err = GRUB_USB_ERR_BADDEVICE;
|
||||
err = VasEBoot_USB_ERR_BADDEVICE;
|
||||
goto fail;
|
||||
}
|
||||
pos += desc->length;
|
||||
|
|
@ -207,35 +207,35 @@ grub_usb_device_initialize (grub_usb_device_t dev)
|
|||
|
||||
/* Point to the first endpoint. */
|
||||
dev->config[i].interf[currif].descendp
|
||||
= (struct grub_usb_desc_endp *) &data[pos];
|
||||
pos += (sizeof (struct grub_usb_desc_endp)
|
||||
= (struct VasEBoot_usb_desc_endp *) &data[pos];
|
||||
pos += (sizeof (struct VasEBoot_usb_desc_endp)
|
||||
* dev->config[i].interf[currif].descif->endpointcnt);
|
||||
}
|
||||
}
|
||||
|
||||
return GRUB_USB_ERR_NONE;
|
||||
return VasEBoot_USB_ERR_NONE;
|
||||
|
||||
fail:
|
||||
|
||||
for (i = 0; i < 8; i++)
|
||||
grub_free (dev->config[i].descconf);
|
||||
VasEBoot_free (dev->config[i].descconf);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
void grub_usb_device_attach (grub_usb_device_t dev)
|
||||
void VasEBoot_usb_device_attach (VasEBoot_usb_device_t dev)
|
||||
{
|
||||
int i;
|
||||
|
||||
/* XXX: Just check configuration 0 for now. */
|
||||
for (i = 0; i < dev->config[0].descconf->numif; i++)
|
||||
{
|
||||
struct grub_usb_desc_if *interf;
|
||||
struct grub_usb_attach_desc *desc;
|
||||
struct VasEBoot_usb_desc_if *interf;
|
||||
struct VasEBoot_usb_attach_desc *desc;
|
||||
|
||||
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);
|
||||
|
||||
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)
|
||||
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))
|
||||
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)
|
||||
|
|
@ -255,33 +255,33 @@ void grub_usb_device_attach (grub_usb_device_t dev)
|
|||
|
||||
switch (interf->class)
|
||||
{
|
||||
case GRUB_USB_CLASS_MASS_STORAGE:
|
||||
grub_dl_load ("usbms");
|
||||
grub_print_error ();
|
||||
case VasEBoot_USB_CLASS_MASS_STORAGE:
|
||||
VasEBoot_dl_load ("usbms");
|
||||
VasEBoot_print_error ();
|
||||
break;
|
||||
case GRUB_USB_CLASS_HID:
|
||||
grub_dl_load ("usb_keyboard");
|
||||
grub_print_error ();
|
||||
case VasEBoot_USB_CLASS_HID:
|
||||
VasEBoot_dl_load ("usb_keyboard");
|
||||
VasEBoot_print_error ();
|
||||
break;
|
||||
case 0xff:
|
||||
/* FIXME: don't load useless modules. */
|
||||
grub_dl_load ("usbserial_ftdi");
|
||||
grub_print_error ();
|
||||
grub_dl_load ("usbserial_pl2303");
|
||||
grub_print_error ();
|
||||
grub_dl_load ("usbserial_usbdebug");
|
||||
grub_print_error ();
|
||||
VasEBoot_dl_load ("usbserial_ftdi");
|
||||
VasEBoot_print_error ();
|
||||
VasEBoot_dl_load ("usbserial_pl2303");
|
||||
VasEBoot_print_error ();
|
||||
VasEBoot_dl_load ("usbserial_usbdebug");
|
||||
VasEBoot_print_error ();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Helper for grub_usb_register_attach_hook_class. */
|
||||
/* Helper for VasEBoot_usb_register_attach_hook_class. */
|
||||
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 grub_usb_desc_device *descdev = &usbdev->descdev;
|
||||
struct VasEBoot_usb_attach_desc *desc = data;
|
||||
struct VasEBoot_usb_desc_device *descdev = &usbdev->descdev;
|
||||
int i;
|
||||
|
||||
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. */
|
||||
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;
|
||||
|
||||
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);
|
||||
|
||||
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
|
||||
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;
|
||||
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
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,63 +1,63 @@
|
|||
/* usb.c - USB Hub Support. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/usb.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/time.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/mm.h>
|
||||
#include <VasEBoot/usb.h>
|
||||
#include <VasEBoot/misc.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. */
|
||||
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 npending = 0;
|
||||
|
||||
struct grub_usb_hub
|
||||
struct VasEBoot_usb_hub
|
||||
{
|
||||
struct grub_usb_hub *next;
|
||||
grub_usb_controller_t controller;
|
||||
struct VasEBoot_usb_hub *next;
|
||||
VasEBoot_usb_controller_t controller;
|
||||
int nports;
|
||||
struct grub_usb_device **devices;
|
||||
struct grub_usb_hub_port *ports;
|
||||
grub_usb_device_t dev;
|
||||
struct VasEBoot_usb_device **devices;
|
||||
struct VasEBoot_usb_hub_port *ports;
|
||||
VasEBoot_usb_device_t dev;
|
||||
};
|
||||
|
||||
static struct grub_usb_hub *hubs;
|
||||
static grub_usb_controller_dev_t grub_usb_list;
|
||||
static struct VasEBoot_usb_hub *hubs;
|
||||
static VasEBoot_usb_controller_dev_t VasEBoot_usb_list;
|
||||
|
||||
/* Add a device that currently has device number 0 and resides on
|
||||
CONTROLLER, the Hub reported that the device speed is SPEED. */
|
||||
static grub_usb_device_t
|
||||
grub_usb_hub_add_dev (grub_usb_controller_t controller,
|
||||
grub_usb_speed_t speed,
|
||||
static VasEBoot_usb_device_t
|
||||
VasEBoot_usb_hub_add_dev (VasEBoot_usb_controller_t controller,
|
||||
VasEBoot_usb_speed_t speed,
|
||||
int split_hubport, int split_hubaddr)
|
||||
{
|
||||
grub_usb_device_t dev;
|
||||
VasEBoot_usb_device_t dev;
|
||||
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)
|
||||
return NULL;
|
||||
|
||||
|
|
@ -66,108 +66,108 @@ grub_usb_hub_add_dev (grub_usb_controller_t controller,
|
|||
dev->split_hubport = split_hubport;
|
||||
dev->split_hubaddr = split_hubaddr;
|
||||
|
||||
err = grub_usb_device_initialize (dev);
|
||||
err = VasEBoot_usb_device_initialize (dev);
|
||||
if (err)
|
||||
{
|
||||
grub_free (dev);
|
||||
VasEBoot_free (dev);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* 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;
|
||||
}
|
||||
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++)
|
||||
grub_free (dev->config[i].descconf);
|
||||
grub_free (dev);
|
||||
VasEBoot_free (dev->config[i].descconf);
|
||||
VasEBoot_free (dev);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
err = grub_usb_control_msg (dev,
|
||||
(GRUB_USB_REQTYPE_OUT
|
||||
| GRUB_USB_REQTYPE_STANDARD
|
||||
| GRUB_USB_REQTYPE_TARGET_DEV),
|
||||
GRUB_USB_REQ_SET_ADDRESS,
|
||||
err = VasEBoot_usb_control_msg (dev,
|
||||
(VasEBoot_USB_REQTYPE_OUT
|
||||
| VasEBoot_USB_REQTYPE_STANDARD
|
||||
| VasEBoot_USB_REQTYPE_TARGET_DEV),
|
||||
VasEBoot_USB_REQ_SET_ADDRESS,
|
||||
i, 0, 0, NULL);
|
||||
if (err)
|
||||
{
|
||||
for (i = 0; i < 8; i++)
|
||||
grub_free (dev->config[i].descconf);
|
||||
grub_free (dev);
|
||||
VasEBoot_free (dev->config[i].descconf);
|
||||
VasEBoot_free (dev);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
dev->addr = i;
|
||||
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);
|
||||
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);
|
||||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
|
||||
static grub_usb_err_t
|
||||
grub_usb_add_hub (grub_usb_device_t dev)
|
||||
static VasEBoot_usb_err_t
|
||||
VasEBoot_usb_add_hub (VasEBoot_usb_device_t dev)
|
||||
{
|
||||
struct grub_usb_usb_hubdesc hubdesc;
|
||||
grub_usb_err_t err;
|
||||
struct VasEBoot_usb_usb_hubdesc hubdesc;
|
||||
VasEBoot_usb_err_t err;
|
||||
int i;
|
||||
|
||||
err = grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_IN
|
||||
| GRUB_USB_REQTYPE_CLASS
|
||||
| GRUB_USB_REQTYPE_TARGET_DEV),
|
||||
GRUB_USB_REQ_GET_DESCRIPTOR,
|
||||
(GRUB_USB_DESCRIPTOR_HUB << 8) | 0,
|
||||
err = VasEBoot_usb_control_msg (dev, (VasEBoot_USB_REQTYPE_IN
|
||||
| VasEBoot_USB_REQTYPE_CLASS
|
||||
| VasEBoot_USB_REQTYPE_TARGET_DEV),
|
||||
VasEBoot_USB_REQ_GET_DESCRIPTOR,
|
||||
(VasEBoot_USB_DESCRIPTOR_HUB << 8) | 0,
|
||||
0, sizeof (hubdesc), (char *) &hubdesc);
|
||||
if (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.characteristics, hubdesc.pwdgood,
|
||||
hubdesc.current);
|
||||
|
||||
/* Activate the first configuration. Hubs should have only one conf. */
|
||||
grub_dprintf ("usb", "Hub set configuration\n");
|
||||
grub_usb_set_configuration (dev, 1);
|
||||
VasEBoot_dprintf ("usb", "Hub set configuration\n");
|
||||
VasEBoot_usb_set_configuration (dev, 1);
|
||||
|
||||
dev->nports = hubdesc.portcnt;
|
||||
dev->children = grub_zalloc (hubdesc.portcnt * sizeof (dev->children[0]));
|
||||
dev->ports = grub_zalloc (dev->nports * sizeof (dev->ports[0]));
|
||||
dev->children = VasEBoot_zalloc (hubdesc.portcnt * sizeof (dev->children[0]));
|
||||
dev->ports = VasEBoot_zalloc (dev->nports * sizeof (dev->ports[0]));
|
||||
if (!dev->children || !dev->ports)
|
||||
{
|
||||
grub_free (dev->children);
|
||||
grub_free (dev->ports);
|
||||
return GRUB_USB_ERR_INTERNAL;
|
||||
VasEBoot_free (dev->children);
|
||||
VasEBoot_free (dev->ports);
|
||||
return VasEBoot_USB_ERR_INTERNAL;
|
||||
}
|
||||
|
||||
/* Power on all Hub ports. */
|
||||
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 */
|
||||
grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_OUT
|
||||
| GRUB_USB_REQTYPE_CLASS
|
||||
| GRUB_USB_REQTYPE_TARGET_OTHER),
|
||||
GRUB_USB_REQ_SET_FEATURE,
|
||||
GRUB_USB_HUB_FEATURE_PORT_POWER,
|
||||
VasEBoot_usb_control_msg (dev, (VasEBoot_USB_REQTYPE_OUT
|
||||
| VasEBoot_USB_REQTYPE_CLASS
|
||||
| VasEBoot_USB_REQTYPE_TARGET_OTHER),
|
||||
VasEBoot_USB_REQ_SET_FEATURE,
|
||||
VasEBoot_USB_HUB_FEATURE_PORT_POWER,
|
||||
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;
|
||||
i++)
|
||||
{
|
||||
struct grub_usb_desc_endp *endp = NULL;
|
||||
struct VasEBoot_usb_desc_endp *endp = NULL;
|
||||
endp = &dev->config[0].interf[0].descendp[i];
|
||||
|
||||
if ((endp->endp_addr & 128) && grub_usb_get_ep_type(endp)
|
||||
== GRUB_USB_EP_INTERRUPT)
|
||||
if ((endp->endp_addr & 128) && VasEBoot_usb_get_ep_type(endp)
|
||||
== VasEBoot_USB_EP_INTERRUPT)
|
||||
{
|
||||
grub_size_t len;
|
||||
VasEBoot_size_t len;
|
||||
dev->hub_endpoint = endp;
|
||||
len = endp->maxpacket;
|
||||
if (len > sizeof (dev->statuschange))
|
||||
len = sizeof (dev->statuschange);
|
||||
dev->hub_transfer
|
||||
= grub_usb_bulk_read_background (dev, endp, len,
|
||||
= VasEBoot_usb_bulk_read_background (dev, endp, len,
|
||||
(char *) &dev->statuschange);
|
||||
break;
|
||||
}
|
||||
|
|
@ -195,28 +195,28 @@ grub_usb_add_hub (grub_usb_device_t dev)
|
|||
|
||||
rescan = 1;
|
||||
|
||||
return GRUB_USB_ERR_NONE;
|
||||
return VasEBoot_USB_ERR_NONE;
|
||||
}
|
||||
|
||||
static void
|
||||
attach_root_port (struct grub_usb_hub *hub, int portno,
|
||||
grub_usb_speed_t speed)
|
||||
attach_root_port (struct VasEBoot_usb_hub *hub, int portno,
|
||||
VasEBoot_usb_speed_t speed)
|
||||
{
|
||||
grub_usb_device_t dev;
|
||||
grub_usb_err_t err;
|
||||
VasEBoot_usb_device_t dev;
|
||||
VasEBoot_usb_err_t err;
|
||||
|
||||
grub_boot_time ("After detect_dev");
|
||||
VasEBoot_boot_time ("After detect_dev");
|
||||
|
||||
/* Enable the port. */
|
||||
err = hub->controller->dev->portstatus (hub->controller, portno, 1);
|
||||
if (err)
|
||||
return;
|
||||
hub->controller->dev->pending_reset = grub_get_time_ms () + 5000;
|
||||
hub->controller->dev->pending_reset = VasEBoot_get_time_ms () + 5000;
|
||||
npending++;
|
||||
|
||||
grub_millisleep (10);
|
||||
VasEBoot_millisleep (10);
|
||||
|
||||
grub_boot_time ("Port enabled");
|
||||
VasEBoot_boot_time ("Port enabled");
|
||||
|
||||
/* Enable the port and create a device. */
|
||||
/* 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
|
||||
transaction translation - e.g. hubport and hubaddr should be
|
||||
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;
|
||||
npending--;
|
||||
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 (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. */
|
||||
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;
|
||||
struct grub_usb_hub *hub;
|
||||
VasEBoot_usb_controller_dev_t usb = data;
|
||||
struct VasEBoot_usb_hub *hub;
|
||||
|
||||
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)
|
||||
return GRUB_USB_ERR_INTERNAL;
|
||||
return VasEBoot_USB_ERR_INTERNAL;
|
||||
|
||||
hub->next = hubs;
|
||||
hubs = hub;
|
||||
hub->controller = grub_malloc (sizeof (*controller));
|
||||
hub->controller = VasEBoot_malloc (sizeof (*controller));
|
||||
if (!hub->controller)
|
||||
{
|
||||
grub_free (hub);
|
||||
return GRUB_USB_ERR_INTERNAL;
|
||||
VasEBoot_free (hub);
|
||||
return VasEBoot_USB_ERR_INTERNAL;
|
||||
}
|
||||
|
||||
grub_memcpy (hub->controller, controller, sizeof (*controller));
|
||||
VasEBoot_memcpy (hub->controller, controller, sizeof (*controller));
|
||||
hub->dev = 0;
|
||||
|
||||
/* Query the number of ports the root Hub has. */
|
||||
hub->nports = controller->dev->hubports (controller);
|
||||
hub->devices = grub_zalloc (sizeof (hub->devices[0]) * hub->nports);
|
||||
hub->ports = grub_zalloc (sizeof (hub->ports[0]) * hub->nports);
|
||||
hub->devices = VasEBoot_zalloc (sizeof (hub->devices[0]) * hub->nports);
|
||||
hub->ports = VasEBoot_zalloc (sizeof (hub->ports[0]) * hub->nports);
|
||||
if (!hub->devices || !hub->ports)
|
||||
{
|
||||
grub_free (hub->devices);
|
||||
grub_free (hub->ports);
|
||||
grub_free (hub->controller);
|
||||
grub_free (hub);
|
||||
grub_print_error ();
|
||||
VasEBoot_free (hub->devices);
|
||||
VasEBoot_free (hub->ports);
|
||||
VasEBoot_free (hub->controller);
|
||||
VasEBoot_free (hub);
|
||||
VasEBoot_print_error ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -284,11 +284,11 @@ grub_usb_controller_dev_register_iter (grub_usb_controller_t controller, void *d
|
|||
}
|
||||
|
||||
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)
|
||||
{
|
||||
*p = q->next;
|
||||
|
|
@ -297,19 +297,19 @@ grub_usb_controller_dev_unregister (grub_usb_controller_dev_t usb)
|
|||
}
|
||||
|
||||
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 continue_waiting = 0;
|
||||
struct grub_usb_hub *hub;
|
||||
struct VasEBoot_usb_hub *hub;
|
||||
|
||||
usb->next = grub_usb_list;
|
||||
grub_usb_list = usb;
|
||||
usb->next = VasEBoot_usb_list;
|
||||
VasEBoot_usb_list = usb;
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
@ -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... */
|
||||
for (portno = 0; portno < hub->nports; portno++)
|
||||
{
|
||||
grub_usb_speed_t speed;
|
||||
VasEBoot_usb_speed_t speed;
|
||||
int changed = 0;
|
||||
|
||||
speed = hub->controller->dev->detect_dev (hub->controller, portno,
|
||||
&changed);
|
||||
|
||||
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].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);
|
||||
continue_waiting++;
|
||||
continue;
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
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;
|
||||
grub_boot_time ("Got stable power wait for port %p:%d",
|
||||
VasEBoot_boot_time ("Got stable power wait for port %p:%d",
|
||||
usb, portno);
|
||||
continue_waiting--;
|
||||
continue;
|
||||
}
|
||||
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;
|
||||
continue_waiting--;
|
||||
|
|
@ -367,73 +367,73 @@ grub_usb_controller_dev_register (grub_usb_controller_dev_t usb)
|
|||
}
|
||||
if (!continue_waiting)
|
||||
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)
|
||||
if (hub->controller->dev == usb)
|
||||
for (portno = 0; portno < hub->nports; portno++)
|
||||
if (hub->ports[portno].state == PORT_STATE_STABLE_POWER)
|
||||
{
|
||||
grub_usb_speed_t speed;
|
||||
VasEBoot_usb_speed_t speed;
|
||||
int changed = 0;
|
||||
hub->ports[portno].state = PORT_STATE_NORMAL;
|
||||
speed = hub->controller->dev->detect_dev (hub->controller, portno, &changed);
|
||||
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
|
||||
detach_device (grub_usb_device_t dev)
|
||||
detach_device (VasEBoot_usb_device_t dev)
|
||||
{
|
||||
unsigned i;
|
||||
int k;
|
||||
if (!dev)
|
||||
return;
|
||||
if (dev->descdev.class == GRUB_USB_CLASS_HUB)
|
||||
if (dev->descdev.class == VasEBoot_USB_CLASS_HUB)
|
||||
{
|
||||
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++)
|
||||
detach_device (dev->children[i]);
|
||||
grub_free (dev->children);
|
||||
VasEBoot_free (dev->children);
|
||||
}
|
||||
for (i = 0; i < ARRAY_SIZE (dev->config); i++)
|
||||
if (dev->config[i].descconf)
|
||||
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)
|
||||
inter->detach_hook (dev, i, k);
|
||||
}
|
||||
grub_usb_devs[dev->addr] = 0;
|
||||
VasEBoot_usb_devs[dev->addr] = 0;
|
||||
}
|
||||
|
||||
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;
|
||||
unsigned i;
|
||||
|
||||
for (i = 1; i <= dev->nports; i++)
|
||||
if (dev->ports[i - 1].state == PORT_STATE_WAITING_FOR_STABLE_POWER)
|
||||
{
|
||||
grub_uint64_t tm;
|
||||
grub_uint32_t current_status = 0;
|
||||
VasEBoot_uint64_t tm;
|
||||
VasEBoot_uint32_t current_status = 0;
|
||||
|
||||
/* Get the port status. */
|
||||
err = grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_IN
|
||||
| GRUB_USB_REQTYPE_CLASS
|
||||
| GRUB_USB_REQTYPE_TARGET_OTHER),
|
||||
GRUB_USB_REQ_GET_STATUS,
|
||||
err = VasEBoot_usb_control_msg (dev, (VasEBoot_USB_REQTYPE_IN
|
||||
| VasEBoot_USB_REQTYPE_CLASS
|
||||
| VasEBoot_USB_REQTYPE_TARGET_OTHER),
|
||||
VasEBoot_USB_REQ_GET_STATUS,
|
||||
0, i,
|
||||
sizeof (current_status),
|
||||
(char *) ¤t_status);
|
||||
|
|
@ -442,22 +442,22 @@ wait_power_nonroot_hub (grub_usb_device_t dev)
|
|||
dev->ports[i - 1].state = PORT_STATE_FAILED_DEVICE;
|
||||
continue;
|
||||
}
|
||||
tm = grub_get_time_ms ();
|
||||
if (!(current_status & GRUB_USB_HUB_STATUS_PORT_CONNECTED))
|
||||
tm = VasEBoot_get_time_ms ();
|
||||
if (!(current_status & VasEBoot_USB_HUB_STATUS_PORT_CONNECTED))
|
||||
dev->ports[i - 1].soft_limit_time = tm + 250;
|
||||
if (tm >= dev->ports[i - 1].soft_limit_time)
|
||||
{
|
||||
if (dev->controller.dev->pending_reset)
|
||||
continue;
|
||||
/* Now do reset of port. */
|
||||
grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_OUT
|
||||
| GRUB_USB_REQTYPE_CLASS
|
||||
| GRUB_USB_REQTYPE_TARGET_OTHER),
|
||||
GRUB_USB_REQ_SET_FEATURE,
|
||||
GRUB_USB_HUB_FEATURE_PORT_RESET,
|
||||
VasEBoot_usb_control_msg (dev, (VasEBoot_USB_REQTYPE_OUT
|
||||
| VasEBoot_USB_REQTYPE_CLASS
|
||||
| VasEBoot_USB_REQTYPE_TARGET_OTHER),
|
||||
VasEBoot_USB_REQ_SET_FEATURE,
|
||||
VasEBoot_USB_HUB_FEATURE_PORT_RESET,
|
||||
i, 0, 0);
|
||||
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;
|
||||
/* 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
|
||||
* anywhere on the same OHCI controller until
|
||||
* 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++;
|
||||
continue;
|
||||
}
|
||||
|
|
@ -482,19 +482,19 @@ wait_power_nonroot_hub (grub_usb_device_t dev)
|
|||
}
|
||||
|
||||
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;
|
||||
grub_uint32_t changed;
|
||||
grub_size_t actual, len;
|
||||
VasEBoot_uint32_t changed;
|
||||
VasEBoot_size_t actual, len;
|
||||
|
||||
if (!dev->hub_transfer)
|
||||
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;
|
||||
|
||||
changed = dev->statuschange;
|
||||
|
|
@ -503,7 +503,7 @@ poll_nonroot_hub (grub_usb_device_t dev)
|
|||
if (len > sizeof (dev->statuschange))
|
||||
len = sizeof (dev->statuschange);
|
||||
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);
|
||||
|
||||
if (err || actual == 0 || changed == 0)
|
||||
|
|
@ -512,111 +512,111 @@ poll_nonroot_hub (grub_usb_device_t dev)
|
|||
/* Iterate over the Hub ports. */
|
||||
for (i = 1; i <= dev->nports; i++)
|
||||
{
|
||||
grub_uint32_t status;
|
||||
VasEBoot_uint32_t status;
|
||||
|
||||
if (!(changed & (1 << i))
|
||||
|| dev->ports[i - 1].state == PORT_STATE_WAITING_FOR_STABLE_POWER)
|
||||
continue;
|
||||
|
||||
/* Get the port status. */
|
||||
err = grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_IN
|
||||
| GRUB_USB_REQTYPE_CLASS
|
||||
| GRUB_USB_REQTYPE_TARGET_OTHER),
|
||||
GRUB_USB_REQ_GET_STATUS,
|
||||
err = VasEBoot_usb_control_msg (dev, (VasEBoot_USB_REQTYPE_IN
|
||||
| VasEBoot_USB_REQTYPE_CLASS
|
||||
| VasEBoot_USB_REQTYPE_TARGET_OTHER),
|
||||
VasEBoot_USB_REQ_GET_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);
|
||||
|
||||
if (err)
|
||||
continue;
|
||||
|
||||
/* FIXME: properly handle these conditions. */
|
||||
if (status & GRUB_USB_HUB_STATUS_C_PORT_ENABLED)
|
||||
grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_OUT
|
||||
| GRUB_USB_REQTYPE_CLASS
|
||||
| GRUB_USB_REQTYPE_TARGET_OTHER),
|
||||
GRUB_USB_REQ_CLEAR_FEATURE,
|
||||
GRUB_USB_HUB_FEATURE_C_PORT_ENABLED, i, 0, 0);
|
||||
if (status & VasEBoot_USB_HUB_STATUS_C_PORT_ENABLED)
|
||||
VasEBoot_usb_control_msg (dev, (VasEBoot_USB_REQTYPE_OUT
|
||||
| VasEBoot_USB_REQTYPE_CLASS
|
||||
| VasEBoot_USB_REQTYPE_TARGET_OTHER),
|
||||
VasEBoot_USB_REQ_CLEAR_FEATURE,
|
||||
VasEBoot_USB_HUB_FEATURE_C_PORT_ENABLED, i, 0, 0);
|
||||
|
||||
if (status & GRUB_USB_HUB_STATUS_C_PORT_SUSPEND)
|
||||
grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_OUT
|
||||
| GRUB_USB_REQTYPE_CLASS
|
||||
| GRUB_USB_REQTYPE_TARGET_OTHER),
|
||||
GRUB_USB_REQ_CLEAR_FEATURE,
|
||||
GRUB_USB_HUB_FEATURE_C_PORT_SUSPEND, i, 0, 0);
|
||||
if (status & VasEBoot_USB_HUB_STATUS_C_PORT_SUSPEND)
|
||||
VasEBoot_usb_control_msg (dev, (VasEBoot_USB_REQTYPE_OUT
|
||||
| VasEBoot_USB_REQTYPE_CLASS
|
||||
| VasEBoot_USB_REQTYPE_TARGET_OTHER),
|
||||
VasEBoot_USB_REQ_CLEAR_FEATURE,
|
||||
VasEBoot_USB_HUB_FEATURE_C_PORT_SUSPEND, i, 0, 0);
|
||||
|
||||
if (status & GRUB_USB_HUB_STATUS_C_PORT_OVERCURRENT)
|
||||
grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_OUT
|
||||
| GRUB_USB_REQTYPE_CLASS
|
||||
| GRUB_USB_REQTYPE_TARGET_OTHER),
|
||||
GRUB_USB_REQ_CLEAR_FEATURE,
|
||||
GRUB_USB_HUB_FEATURE_C_PORT_OVERCURRENT, i, 0, 0);
|
||||
if (status & VasEBoot_USB_HUB_STATUS_C_PORT_OVERCURRENT)
|
||||
VasEBoot_usb_control_msg (dev, (VasEBoot_USB_REQTYPE_OUT
|
||||
| VasEBoot_USB_REQTYPE_CLASS
|
||||
| VasEBoot_USB_REQTYPE_TARGET_OTHER),
|
||||
VasEBoot_USB_REQ_CLEAR_FEATURE,
|
||||
VasEBoot_USB_HUB_FEATURE_C_PORT_OVERCURRENT, i, 0, 0);
|
||||
|
||||
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
|
||||
| GRUB_USB_REQTYPE_CLASS
|
||||
| GRUB_USB_REQTYPE_TARGET_OTHER),
|
||||
GRUB_USB_REQ_CLEAR_FEATURE,
|
||||
GRUB_USB_HUB_FEATURE_C_PORT_CONNECTED, i, 0, 0);
|
||||
VasEBoot_usb_control_msg (dev, (VasEBoot_USB_REQTYPE_OUT
|
||||
| VasEBoot_USB_REQTYPE_CLASS
|
||||
| VasEBoot_USB_REQTYPE_TARGET_OTHER),
|
||||
VasEBoot_USB_REQ_CLEAR_FEATURE,
|
||||
VasEBoot_USB_HUB_FEATURE_C_PORT_CONNECTED, i, 0, 0);
|
||||
|
||||
detach_device (dev->children[i - 1]);
|
||||
dev->children[i - 1] = NULL;
|
||||
|
||||
/* 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. */
|
||||
/* Wait for completion of insertion and stable power (USB spec.)
|
||||
* Should be at least 100ms, some devices requires more...
|
||||
* There is also another thing - some devices have worse contacts
|
||||
* and connected signal is unstable for some time - we should handle
|
||||
* 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].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);
|
||||
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
|
||||
| GRUB_USB_REQTYPE_CLASS
|
||||
| GRUB_USB_REQTYPE_TARGET_OTHER),
|
||||
GRUB_USB_REQ_CLEAR_FEATURE,
|
||||
GRUB_USB_HUB_FEATURE_C_PORT_RESET, i, 0, 0);
|
||||
VasEBoot_usb_control_msg (dev, (VasEBoot_USB_REQTYPE_OUT
|
||||
| VasEBoot_USB_REQTYPE_CLASS
|
||||
| VasEBoot_USB_REQTYPE_TARGET_OTHER),
|
||||
VasEBoot_USB_REQ_CLEAR_FEATURE,
|
||||
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;
|
||||
grub_usb_device_t next_dev;
|
||||
VasEBoot_usb_speed_t speed;
|
||||
VasEBoot_usb_device_t next_dev;
|
||||
int split_hubport = 0;
|
||||
int split_hubaddr = 0;
|
||||
|
||||
/* Determine the device speed. */
|
||||
if (status & GRUB_USB_HUB_STATUS_PORT_LOWSPEED)
|
||||
speed = GRUB_USB_SPEED_LOW;
|
||||
if (status & VasEBoot_USB_HUB_STATUS_PORT_LOWSPEED)
|
||||
speed = VasEBoot_USB_SPEED_LOW;
|
||||
else
|
||||
{
|
||||
if (status & GRUB_USB_HUB_STATUS_PORT_HIGHSPEED)
|
||||
speed = GRUB_USB_SPEED_HIGH;
|
||||
if (status & VasEBoot_USB_HUB_STATUS_PORT_HIGHSPEED)
|
||||
speed = VasEBoot_USB_SPEED_HIGH;
|
||||
else
|
||||
speed = GRUB_USB_SPEED_FULL;
|
||||
speed = VasEBoot_USB_SPEED_FULL;
|
||||
}
|
||||
|
||||
/* Wait a recovery time after reset, spec. says 10ms */
|
||||
grub_millisleep (10);
|
||||
VasEBoot_millisleep (10);
|
||||
|
||||
/* 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 */
|
||||
split_hubport = 0;
|
||||
|
|
@ -625,7 +625,7 @@ poll_nonroot_hub (grub_usb_device_t dev)
|
|||
else
|
||||
/* FULL/LOW device needs hub port and hub address
|
||||
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
|
||||
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. */
|
||||
next_dev = grub_usb_hub_add_dev (&dev->controller, speed,
|
||||
next_dev = VasEBoot_usb_hub_add_dev (&dev->controller, speed,
|
||||
split_hubport, split_hubaddr);
|
||||
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 (next_dev->descdev.class == 0x09)
|
||||
grub_usb_add_hub (next_dev);
|
||||
VasEBoot_usb_add_hub (next_dev);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
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. */
|
||||
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;
|
||||
|
||||
if (hub->controller->dev->pending_reset)
|
||||
{
|
||||
/* 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
|
||||
* addressed properly, timeout happened */
|
||||
|
|
@ -698,7 +698,7 @@ grub_usb_poll_devices (int wait_for_completion)
|
|||
{
|
||||
detach_device (hub->devices[i]);
|
||||
hub->devices[i] = NULL;
|
||||
if (speed != GRUB_USB_SPEED_NONE)
|
||||
if (speed != VasEBoot_USB_SPEED_NONE)
|
||||
attach_root_port (hub, i, speed);
|
||||
}
|
||||
}
|
||||
|
|
@ -709,9 +709,9 @@ grub_usb_poll_devices (int wait_for_completion)
|
|||
rescan = 0;
|
||||
|
||||
/* 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)
|
||||
poll_nonroot_hub (dev);
|
||||
|
|
@ -720,34 +720,34 @@ grub_usb_poll_devices (int wait_for_completion)
|
|||
while (1)
|
||||
{
|
||||
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)
|
||||
continue_waiting = continue_waiting || wait_power_nonroot_hub (dev);
|
||||
}
|
||||
if (!continue_waiting)
|
||||
break;
|
||||
grub_millisleep (1);
|
||||
VasEBoot_millisleep (1);
|
||||
}
|
||||
|
||||
if (!(rescan || (npending && wait_for_completion)))
|
||||
break;
|
||||
grub_millisleep (25);
|
||||
VasEBoot_millisleep (25);
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,35 +1,35 @@
|
|||
/* usbtrans.c - USB Transfers and Transactions. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/pci.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/usb.h>
|
||||
#include <grub/usbtrans.h>
|
||||
#include <grub/time.h>
|
||||
#include <grub/cache.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/pci.h>
|
||||
#include <VasEBoot/mm.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/usb.h>
|
||||
#include <VasEBoot/usbtrans.h>
|
||||
#include <VasEBoot/time.h>
|
||||
#include <VasEBoot/cache.h>
|
||||
|
||||
|
||||
static inline unsigned int
|
||||
grub_usb_bulk_maxpacket (grub_usb_device_t dev,
|
||||
struct grub_usb_desc_endp *endpoint)
|
||||
VasEBoot_usb_bulk_maxpacket (VasEBoot_usb_device_t dev,
|
||||
struct VasEBoot_usb_desc_endp *endpoint)
|
||||
{
|
||||
/* Use the maximum packet size given in the endpoint descriptor. */
|
||||
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
|
||||
grub_usb_execute_and_wait_transfer (grub_usb_device_t dev,
|
||||
grub_usb_transfer_t transfer,
|
||||
int timeout, grub_size_t *actual)
|
||||
static VasEBoot_usb_err_t
|
||||
VasEBoot_usb_execute_and_wait_transfer (VasEBoot_usb_device_t dev,
|
||||
VasEBoot_usb_transfer_t transfer,
|
||||
int timeout, VasEBoot_size_t *actual)
|
||||
{
|
||||
grub_usb_err_t err;
|
||||
grub_uint64_t endtime;
|
||||
VasEBoot_usb_err_t err;
|
||||
VasEBoot_uint64_t endtime;
|
||||
|
||||
err = dev->controller.dev->setup_transfer (&dev->controller, transfer);
|
||||
if (err)
|
||||
return err;
|
||||
/* endtime moved behind setup transfer to prevent false timeouts
|
||||
* while debugging... */
|
||||
endtime = grub_get_time_ms () + timeout;
|
||||
endtime = VasEBoot_get_time_ms () + timeout;
|
||||
while (1)
|
||||
{
|
||||
err = dev->controller.dev->check_transfer (&dev->controller, transfer,
|
||||
actual);
|
||||
if (!err)
|
||||
return GRUB_USB_ERR_NONE;
|
||||
if (err != GRUB_USB_ERR_WAIT)
|
||||
return VasEBoot_USB_ERR_NONE;
|
||||
if (err != VasEBoot_USB_ERR_WAIT)
|
||||
return err;
|
||||
if (grub_get_time_ms () > endtime)
|
||||
if (VasEBoot_get_time_ms () > endtime)
|
||||
{
|
||||
err = dev->controller.dev->cancel_transfer (&dev->controller,
|
||||
transfer);
|
||||
if (err)
|
||||
return err;
|
||||
return GRUB_USB_ERR_TIMEOUT;
|
||||
return VasEBoot_USB_ERR_TIMEOUT;
|
||||
}
|
||||
grub_cpu_idle ();
|
||||
VasEBoot_cpu_idle ();
|
||||
}
|
||||
}
|
||||
|
||||
grub_usb_err_t
|
||||
grub_usb_control_msg (grub_usb_device_t dev,
|
||||
grub_uint8_t reqtype,
|
||||
grub_uint8_t request,
|
||||
grub_uint16_t value,
|
||||
grub_uint16_t index,
|
||||
grub_size_t size0, char *data_in)
|
||||
VasEBoot_usb_err_t
|
||||
VasEBoot_usb_control_msg (VasEBoot_usb_device_t dev,
|
||||
VasEBoot_uint8_t reqtype,
|
||||
VasEBoot_uint8_t request,
|
||||
VasEBoot_uint16_t value,
|
||||
VasEBoot_uint16_t index,
|
||||
VasEBoot_size_t size0, char *data_in)
|
||||
{
|
||||
int i;
|
||||
grub_usb_transfer_t transfer;
|
||||
VasEBoot_usb_transfer_t transfer;
|
||||
int datablocks;
|
||||
volatile struct grub_usb_packet_setup *setupdata;
|
||||
grub_uint32_t setupdata_addr;
|
||||
grub_usb_err_t err;
|
||||
volatile struct VasEBoot_usb_packet_setup *setupdata;
|
||||
VasEBoot_uint32_t setupdata_addr;
|
||||
VasEBoot_usb_err_t err;
|
||||
unsigned int max;
|
||||
struct grub_pci_dma_chunk *data_chunk, *setupdata_chunk;
|
||||
struct VasEBoot_pci_dma_chunk *data_chunk, *setupdata_chunk;
|
||||
volatile char *data;
|
||||
grub_uint32_t data_addr;
|
||||
grub_size_t size = size0;
|
||||
grub_size_t actual;
|
||||
VasEBoot_uint32_t data_addr;
|
||||
VasEBoot_size_t size = size0;
|
||||
VasEBoot_size_t actual;
|
||||
|
||||
/* 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)
|
||||
return GRUB_USB_ERR_INTERNAL;
|
||||
data = grub_dma_get_virt (data_chunk);
|
||||
data_addr = grub_dma_get_phys (data_chunk);
|
||||
grub_memcpy ((char *) data, data_in, size);
|
||||
return VasEBoot_USB_ERR_INTERNAL;
|
||||
data = VasEBoot_dma_get_virt (data_chunk);
|
||||
data_addr = VasEBoot_dma_get_phys (data_chunk);
|
||||
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",
|
||||
reqtype, request, value, index, (unsigned long)size);
|
||||
|
||||
/* Create a transfer. */
|
||||
transfer = grub_malloc (sizeof (*transfer));
|
||||
transfer = VasEBoot_malloc (sizeof (*transfer));
|
||||
if (! transfer)
|
||||
{
|
||||
grub_dma_free (data_chunk);
|
||||
return GRUB_USB_ERR_INTERNAL;
|
||||
VasEBoot_dma_free (data_chunk);
|
||||
return VasEBoot_USB_ERR_INTERNAL;
|
||||
}
|
||||
|
||||
setupdata_chunk = grub_memalign_dma32 (32, sizeof (*setupdata));
|
||||
setupdata_chunk = VasEBoot_memalign_dma32 (32, sizeof (*setupdata));
|
||||
if (! setupdata_chunk)
|
||||
{
|
||||
grub_free (transfer);
|
||||
grub_dma_free (data_chunk);
|
||||
return GRUB_USB_ERR_INTERNAL;
|
||||
VasEBoot_free (transfer);
|
||||
VasEBoot_dma_free (data_chunk);
|
||||
return VasEBoot_USB_ERR_INTERNAL;
|
||||
}
|
||||
|
||||
setupdata = grub_dma_get_virt (setupdata_chunk);
|
||||
setupdata_addr = grub_dma_get_phys (setupdata_chunk);
|
||||
setupdata = VasEBoot_dma_get_virt (setupdata_chunk);
|
||||
setupdata_addr = VasEBoot_dma_get_phys (setupdata_chunk);
|
||||
|
||||
/* Determine the maximum packet size. */
|
||||
if (dev->descdev.maxsize0)
|
||||
|
|
@ -133,7 +133,7 @@ grub_usb_control_msg (grub_usb_device_t dev,
|
|||
else
|
||||
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;
|
||||
|
||||
|
|
@ -143,19 +143,19 @@ grub_usb_control_msg (grub_usb_device_t dev,
|
|||
transfer->size = size; /* XXX ? */
|
||||
transfer->endpoint = 0;
|
||||
transfer->devaddr = dev->addr;
|
||||
transfer->type = GRUB_USB_TRANSACTION_TYPE_CONTROL;
|
||||
transfer->type = VasEBoot_USB_TRANSACTION_TYPE_CONTROL;
|
||||
transfer->max = max;
|
||||
transfer->dev = dev;
|
||||
|
||||
/* Allocate an array of transfer data structures. */
|
||||
transfer->transactions = grub_malloc (transfer->transcnt
|
||||
* sizeof (struct grub_usb_transfer));
|
||||
transfer->transactions = VasEBoot_malloc (transfer->transcnt
|
||||
* sizeof (struct VasEBoot_usb_transfer));
|
||||
if (! transfer->transactions)
|
||||
{
|
||||
grub_free (transfer);
|
||||
grub_dma_free (setupdata_chunk);
|
||||
grub_dma_free (data_chunk);
|
||||
return GRUB_USB_ERR_INTERNAL;
|
||||
VasEBoot_free (transfer);
|
||||
VasEBoot_dma_free (setupdata_chunk);
|
||||
VasEBoot_dma_free (data_chunk);
|
||||
return VasEBoot_USB_ERR_INTERNAL;
|
||||
}
|
||||
|
||||
/* Build a Setup packet. XXX: Endianness. */
|
||||
|
|
@ -164,10 +164,10 @@ grub_usb_control_msg (grub_usb_device_t dev,
|
|||
setupdata->value = value;
|
||||
setupdata->index = index;
|
||||
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].pid = GRUB_USB_TRANSFER_TYPE_SETUP;
|
||||
transfer->transactions[0].pid = VasEBoot_USB_TRANSFER_TYPE_SETUP;
|
||||
transfer->transactions[0].data = setupdata_addr;
|
||||
transfer->transactions[0].toggle = 0;
|
||||
|
||||
|
|
@ -175,16 +175,16 @@ grub_usb_control_msg (grub_usb_device_t dev,
|
|||
transfers? */
|
||||
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;
|
||||
/* Use the right most bit as the data toggle. Simple and
|
||||
effective. */
|
||||
tr->toggle = !(i & 1);
|
||||
if (reqtype & 128)
|
||||
tr->pid = GRUB_USB_TRANSFER_TYPE_IN;
|
||||
tr->pid = VasEBoot_USB_TRANSFER_TYPE_IN;
|
||||
else
|
||||
tr->pid = GRUB_USB_TRANSFER_TYPE_OUT;
|
||||
tr->pid = VasEBoot_USB_TRANSFER_TYPE_OUT;
|
||||
tr->data = data_addr + i * max;
|
||||
tr->preceding = i * 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].data = 0;
|
||||
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
|
||||
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;
|
||||
|
||||
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);
|
||||
grub_dma_free (setupdata_chunk);
|
||||
VasEBoot_free (transfer);
|
||||
VasEBoot_dma_free (setupdata_chunk);
|
||||
|
||||
grub_arch_sync_dma_caches (data, size0);
|
||||
grub_memcpy (data_in, (char *) data, size0);
|
||||
VasEBoot_arch_sync_dma_caches (data, size0);
|
||||
VasEBoot_memcpy (data_in, (char *) data, size0);
|
||||
|
||||
grub_dma_free (data_chunk);
|
||||
VasEBoot_dma_free (data_chunk);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
static grub_usb_transfer_t
|
||||
grub_usb_bulk_setup_readwrite (grub_usb_device_t dev,
|
||||
struct grub_usb_desc_endp *endpoint,
|
||||
grub_size_t size0, char *data_in,
|
||||
grub_transfer_type_t type)
|
||||
static VasEBoot_usb_transfer_t
|
||||
VasEBoot_usb_bulk_setup_readwrite (VasEBoot_usb_device_t dev,
|
||||
struct VasEBoot_usb_desc_endp *endpoint,
|
||||
VasEBoot_size_t size0, char *data_in,
|
||||
VasEBoot_transfer_type_t type)
|
||||
{
|
||||
int i;
|
||||
grub_usb_transfer_t transfer;
|
||||
VasEBoot_usb_transfer_t transfer;
|
||||
int datablocks;
|
||||
unsigned int max;
|
||||
volatile char *data;
|
||||
grub_uint32_t data_addr;
|
||||
struct grub_pci_dma_chunk *data_chunk;
|
||||
grub_size_t size = size0;
|
||||
VasEBoot_uint32_t data_addr;
|
||||
struct VasEBoot_pci_dma_chunk *data_chunk;
|
||||
VasEBoot_size_t size = size0;
|
||||
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);
|
||||
|
||||
/* 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)
|
||||
return NULL;
|
||||
data = grub_dma_get_virt (data_chunk);
|
||||
data_addr = grub_dma_get_phys (data_chunk);
|
||||
if (type == GRUB_USB_TRANSFER_TYPE_OUT)
|
||||
data = VasEBoot_dma_get_virt (data_chunk);
|
||||
data_addr = VasEBoot_dma_get_phys (data_chunk);
|
||||
if (type == VasEBoot_USB_TRANSFER_TYPE_OUT)
|
||||
{
|
||||
grub_memcpy ((char *) data, data_in, size);
|
||||
grub_arch_sync_dma_caches (data, size);
|
||||
VasEBoot_memcpy ((char *) data, data_in, size);
|
||||
VasEBoot_arch_sync_dma_caches (data, size);
|
||||
}
|
||||
|
||||
/* Create a transfer. */
|
||||
transfer = grub_malloc (sizeof (struct grub_usb_transfer));
|
||||
transfer = VasEBoot_malloc (sizeof (struct VasEBoot_usb_transfer));
|
||||
if (! transfer)
|
||||
{
|
||||
grub_dma_free (data_chunk);
|
||||
VasEBoot_dma_free (data_chunk);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
max = grub_usb_bulk_maxpacket (dev, endpoint);
|
||||
max = VasEBoot_usb_bulk_maxpacket (dev, endpoint);
|
||||
|
||||
datablocks = ((size + max - 1) / max);
|
||||
transfer->transcnt = datablocks;
|
||||
transfer->size = size - 1;
|
||||
transfer->endpoint = endpoint->endp_addr;
|
||||
transfer->devaddr = dev->addr;
|
||||
transfer->type = GRUB_USB_TRANSACTION_TYPE_BULK;
|
||||
transfer->type = VasEBoot_USB_TRANSACTION_TYPE_BULK;
|
||||
transfer->dir = type;
|
||||
transfer->max = max;
|
||||
transfer->dev = dev;
|
||||
|
|
@ -272,19 +272,19 @@ grub_usb_bulk_setup_readwrite (grub_usb_device_t dev,
|
|||
transfer->data = data_in;
|
||||
|
||||
/* Allocate an array of transfer data structures. */
|
||||
transfer->transactions = grub_malloc (transfer->transcnt
|
||||
* sizeof (struct grub_usb_transfer));
|
||||
transfer->transactions = VasEBoot_malloc (transfer->transcnt
|
||||
* sizeof (struct VasEBoot_usb_transfer));
|
||||
if (! transfer->transactions)
|
||||
{
|
||||
grub_free (transfer);
|
||||
grub_dma_free (data_chunk);
|
||||
VasEBoot_free (transfer);
|
||||
VasEBoot_dma_free (data_chunk);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/* Set up all transfers. */
|
||||
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;
|
||||
/* 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
|
||||
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];
|
||||
|
||||
/* 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;
|
||||
else
|
||||
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;
|
||||
|
||||
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);
|
||||
grub_memcpy (transfer->data, (void *)
|
||||
grub_dma_get_virt (transfer->data_chunk),
|
||||
VasEBoot_memcpy (transfer->data, (void *)
|
||||
VasEBoot_dma_get_virt (transfer->data_chunk),
|
||||
transfer->size + 1);
|
||||
}
|
||||
|
||||
grub_free (transfer->transactions);
|
||||
grub_dma_free (transfer->data_chunk);
|
||||
grub_free (transfer);
|
||||
VasEBoot_free (transfer->transactions);
|
||||
VasEBoot_dma_free (transfer->data_chunk);
|
||||
VasEBoot_free (transfer);
|
||||
}
|
||||
|
||||
static grub_usb_err_t
|
||||
grub_usb_bulk_readwrite (grub_usb_device_t dev,
|
||||
struct grub_usb_desc_endp *endpoint,
|
||||
grub_size_t size0, char *data_in,
|
||||
grub_transfer_type_t type, int timeout,
|
||||
grub_size_t *actual)
|
||||
static VasEBoot_usb_err_t
|
||||
VasEBoot_usb_bulk_readwrite (VasEBoot_usb_device_t dev,
|
||||
struct VasEBoot_usb_desc_endp *endpoint,
|
||||
VasEBoot_size_t size0, char *data_in,
|
||||
VasEBoot_transfer_type_t type, int timeout,
|
||||
VasEBoot_size_t *actual)
|
||||
{
|
||||
grub_usb_err_t err;
|
||||
grub_usb_transfer_t transfer;
|
||||
VasEBoot_usb_err_t err;
|
||||
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);
|
||||
if (!transfer)
|
||||
return GRUB_USB_ERR_INTERNAL;
|
||||
err = grub_usb_execute_and_wait_transfer (dev, transfer, timeout, actual);
|
||||
return VasEBoot_USB_ERR_INTERNAL;
|
||||
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;
|
||||
}
|
||||
|
||||
static grub_usb_err_t
|
||||
grub_usb_bulk_readwrite_packetize (grub_usb_device_t dev,
|
||||
struct grub_usb_desc_endp *endpoint,
|
||||
grub_transfer_type_t type,
|
||||
grub_size_t size, char *data)
|
||||
static VasEBoot_usb_err_t
|
||||
VasEBoot_usb_bulk_readwrite_packetize (VasEBoot_usb_device_t dev,
|
||||
struct VasEBoot_usb_desc_endp *endpoint,
|
||||
VasEBoot_transfer_type_t type,
|
||||
VasEBoot_size_t size, char *data)
|
||||
{
|
||||
grub_size_t actual, transferred;
|
||||
grub_usb_err_t err = GRUB_USB_ERR_NONE;
|
||||
grub_size_t current_size, position;
|
||||
grub_size_t max_bulk_transfer_len = MAX_USB_TRANSFER_LEN;
|
||||
grub_size_t max;
|
||||
VasEBoot_size_t actual, transferred;
|
||||
VasEBoot_usb_err_t err = VasEBoot_USB_ERR_NONE;
|
||||
VasEBoot_size_t current_size, position;
|
||||
VasEBoot_size_t max_bulk_transfer_len = MAX_USB_TRANSFER_LEN;
|
||||
VasEBoot_size_t max;
|
||||
|
||||
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 */
|
||||
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;
|
||||
if (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);
|
||||
transferred += actual;
|
||||
if (err || (current_size != actual)) break;
|
||||
}
|
||||
|
||||
if (!err && transferred != size)
|
||||
err = GRUB_USB_ERR_DATA;
|
||||
err = VasEBoot_USB_ERR_DATA;
|
||||
return err;
|
||||
}
|
||||
|
||||
grub_usb_err_t
|
||||
grub_usb_bulk_write (grub_usb_device_t dev,
|
||||
struct grub_usb_desc_endp *endpoint,
|
||||
grub_size_t size, char *data)
|
||||
VasEBoot_usb_err_t
|
||||
VasEBoot_usb_bulk_write (VasEBoot_usb_device_t dev,
|
||||
struct VasEBoot_usb_desc_endp *endpoint,
|
||||
VasEBoot_size_t size, char *data)
|
||||
{
|
||||
return grub_usb_bulk_readwrite_packetize (dev, endpoint,
|
||||
GRUB_USB_TRANSFER_TYPE_OUT,
|
||||
return VasEBoot_usb_bulk_readwrite_packetize (dev, endpoint,
|
||||
VasEBoot_USB_TRANSFER_TYPE_OUT,
|
||||
size, data);
|
||||
}
|
||||
|
||||
grub_usb_err_t
|
||||
grub_usb_bulk_read (grub_usb_device_t dev,
|
||||
struct grub_usb_desc_endp *endpoint,
|
||||
grub_size_t size, char *data)
|
||||
VasEBoot_usb_err_t
|
||||
VasEBoot_usb_bulk_read (VasEBoot_usb_device_t dev,
|
||||
struct VasEBoot_usb_desc_endp *endpoint,
|
||||
VasEBoot_size_t size, char *data)
|
||||
{
|
||||
return grub_usb_bulk_readwrite_packetize (dev, endpoint,
|
||||
GRUB_USB_TRANSFER_TYPE_IN,
|
||||
return VasEBoot_usb_bulk_readwrite_packetize (dev, endpoint,
|
||||
VasEBoot_USB_TRANSFER_TYPE_IN,
|
||||
size, data);
|
||||
}
|
||||
|
||||
grub_usb_err_t
|
||||
grub_usb_check_transfer (grub_usb_transfer_t transfer, grub_size_t *actual)
|
||||
VasEBoot_usb_err_t
|
||||
VasEBoot_usb_check_transfer (VasEBoot_usb_transfer_t transfer, VasEBoot_size_t *actual)
|
||||
{
|
||||
grub_usb_err_t err;
|
||||
grub_usb_device_t dev = transfer->dev;
|
||||
VasEBoot_usb_err_t err;
|
||||
VasEBoot_usb_device_t dev = transfer->dev;
|
||||
|
||||
err = dev->controller.dev->check_transfer (&dev->controller, transfer,
|
||||
actual);
|
||||
if (err == GRUB_USB_ERR_WAIT)
|
||||
if (err == VasEBoot_USB_ERR_WAIT)
|
||||
return err;
|
||||
|
||||
grub_usb_bulk_finish_readwrite (transfer);
|
||||
VasEBoot_usb_bulk_finish_readwrite (transfer);
|
||||
|
||||
return err;
|
||||
}
|
||||
|
||||
grub_usb_transfer_t
|
||||
grub_usb_bulk_read_background (grub_usb_device_t dev,
|
||||
struct grub_usb_desc_endp *endpoint,
|
||||
grub_size_t size, void *data)
|
||||
VasEBoot_usb_transfer_t
|
||||
VasEBoot_usb_bulk_read_background (VasEBoot_usb_device_t dev,
|
||||
struct VasEBoot_usb_desc_endp *endpoint,
|
||||
VasEBoot_size_t size, void *data)
|
||||
{
|
||||
grub_usb_err_t err;
|
||||
grub_usb_transfer_t transfer;
|
||||
VasEBoot_usb_err_t err;
|
||||
VasEBoot_usb_transfer_t transfer;
|
||||
|
||||
transfer = grub_usb_bulk_setup_readwrite (dev, endpoint, size,
|
||||
data, GRUB_USB_TRANSFER_TYPE_IN);
|
||||
transfer = VasEBoot_usb_bulk_setup_readwrite (dev, endpoint, size,
|
||||
data, VasEBoot_USB_TRANSFER_TYPE_IN);
|
||||
if (!transfer)
|
||||
return NULL;
|
||||
|
||||
|
|
@ -444,19 +444,19 @@ grub_usb_bulk_read_background (grub_usb_device_t dev,
|
|||
}
|
||||
|
||||
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);
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
VasEBoot_errno = VasEBoot_ERR_NONE;
|
||||
}
|
||||
|
||||
grub_usb_err_t
|
||||
grub_usb_bulk_read_extended (grub_usb_device_t dev,
|
||||
struct grub_usb_desc_endp *endpoint,
|
||||
grub_size_t size, char *data,
|
||||
int timeout, grub_size_t *actual)
|
||||
VasEBoot_usb_err_t
|
||||
VasEBoot_usb_bulk_read_extended (VasEBoot_usb_device_t dev,
|
||||
struct VasEBoot_usb_desc_endp *endpoint,
|
||||
VasEBoot_size_t size, char *data,
|
||||
int timeout, VasEBoot_size_t *actual)
|
||||
{
|
||||
return grub_usb_bulk_readwrite (dev, endpoint, size, data,
|
||||
GRUB_USB_TRANSFER_TYPE_IN, timeout, actual);
|
||||
return VasEBoot_usb_bulk_readwrite (dev, endpoint, size, data,
|
||||
VasEBoot_USB_TRANSFER_TYPE_IN, timeout, actual);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,43 +1,43 @@
|
|||
/* acpi.c - modify acpi tables. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/term.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/acpi.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/memory.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/extcmd.h>
|
||||
#include <VasEBoot/file.h>
|
||||
#include <VasEBoot/disk.h>
|
||||
#include <VasEBoot/term.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/acpi.h>
|
||||
#include <VasEBoot/mm.h>
|
||||
#include <VasEBoot/memory.h>
|
||||
#include <VasEBoot/i18n.h>
|
||||
|
||||
#ifdef GRUB_MACHINE_EFI
|
||||
#include <grub/efi/efi.h>
|
||||
#include <grub/efi/api.h>
|
||||
#ifdef VasEBoot_MACHINE_EFI
|
||||
#include <VasEBoot/efi/efi.h>
|
||||
#include <VasEBoot/efi/api.h>
|
||||
#endif
|
||||
|
||||
#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,
|
||||
N_("Don't load host tables specified by comma-separated list."),
|
||||
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},
|
||||
/* 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 "
|
||||
"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, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
|
@ -69,13 +69,13 @@ static char root_oemid[6];
|
|||
/* OEMTABLE of the same tables. */
|
||||
static char root_oemtable[8];
|
||||
/* OEMREVISION of the same tables. */
|
||||
static grub_uint32_t root_oemrev;
|
||||
static VasEBoot_uint32_t root_oemrev;
|
||||
/* CreatorID of the same tables. */
|
||||
static char root_creator_id[4];
|
||||
/* CreatorRevision of the same tables. */
|
||||
static grub_uint32_t root_creator_rev;
|
||||
static struct grub_acpi_rsdp_v10 *rsdpv1_new = 0;
|
||||
static struct grub_acpi_rsdp_v20 *rsdpv2_new = 0;
|
||||
static VasEBoot_uint32_t root_creator_rev;
|
||||
static struct VasEBoot_acpi_rsdp_v10 *rsdpv1_new = 0;
|
||||
static struct VasEBoot_acpi_rsdp_v20 *rsdpv2_new = 0;
|
||||
static char *playground = 0, *playground_ptr = 0;
|
||||
static int playground_size = 0;
|
||||
|
||||
|
|
@ -83,7 +83,7 @@ static int playground_size = 0;
|
|||
struct efiemu_acpi_table
|
||||
{
|
||||
void *addr;
|
||||
grub_size_t size;
|
||||
VasEBoot_size_t size;
|
||||
struct efiemu_acpi_table *next;
|
||||
};
|
||||
static struct efiemu_acpi_table *acpi_tables = 0;
|
||||
|
|
@ -94,35 +94,35 @@ static void *table_dsdt = 0;
|
|||
static void *rsdt_addr = 0;
|
||||
|
||||
/* Allocation handles for different tables. */
|
||||
static grub_size_t dsdt_size = 0;
|
||||
static VasEBoot_size_t dsdt_size = 0;
|
||||
|
||||
/* Address of original FACS. */
|
||||
static grub_uint32_t facs_addr = 0;
|
||||
static VasEBoot_uint32_t facs_addr = 0;
|
||||
|
||||
struct grub_acpi_rsdp_v20 *
|
||||
grub_acpi_get_rsdpv2 (void)
|
||||
struct VasEBoot_acpi_rsdp_v20 *
|
||||
VasEBoot_acpi_get_rsdpv2 (void)
|
||||
{
|
||||
if (rsdpv2_new)
|
||||
return rsdpv2_new;
|
||||
if (rsdpv1_new)
|
||||
return 0;
|
||||
return grub_machine_acpi_get_rsdpv2 ();
|
||||
return VasEBoot_machine_acpi_get_rsdpv2 ();
|
||||
}
|
||||
|
||||
struct grub_acpi_rsdp_v10 *
|
||||
grub_acpi_get_rsdpv1 (void)
|
||||
struct VasEBoot_acpi_rsdp_v10 *
|
||||
VasEBoot_acpi_get_rsdpv1 (void)
|
||||
{
|
||||
if (rsdpv1_new)
|
||||
return rsdpv1_new;
|
||||
if (rsdpv2_new)
|
||||
return 0;
|
||||
return grub_machine_acpi_get_rsdpv1 ();
|
||||
return VasEBoot_machine_acpi_get_rsdpv1 ();
|
||||
}
|
||||
|
||||
#if defined (__i386__) || defined (__x86_64__)
|
||||
|
||||
static inline int
|
||||
iszero (grub_uint8_t *reg, int size)
|
||||
iszero (VasEBoot_uint8_t *reg, int size)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < size; i++)
|
||||
|
|
@ -131,20 +131,20 @@ iszero (grub_uint8_t *reg, int size)
|
|||
return 1;
|
||||
}
|
||||
|
||||
/* Context for grub_acpi_create_ebda. */
|
||||
struct grub_acpi_create_ebda_ctx {
|
||||
/* Context for VasEBoot_acpi_create_ebda. */
|
||||
struct VasEBoot_acpi_create_ebda_ctx {
|
||||
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
|
||||
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)
|
||||
{
|
||||
struct grub_acpi_create_ebda_ctx *ctx = data;
|
||||
grub_uint64_t end = start + size;
|
||||
if (type != GRUB_MEMORY_AVAILABLE)
|
||||
struct VasEBoot_acpi_create_ebda_ctx *ctx = data;
|
||||
VasEBoot_uint64_t end = start + size;
|
||||
if (type != VasEBoot_MEMORY_AVAILABLE)
|
||||
return 0;
|
||||
if (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;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_acpi_create_ebda (void)
|
||||
VasEBoot_err_t
|
||||
VasEBoot_acpi_create_ebda (void)
|
||||
{
|
||||
struct grub_acpi_create_ebda_ctx ctx = {
|
||||
struct VasEBoot_acpi_create_ebda_ctx ctx = {
|
||||
.highestlow = 0
|
||||
};
|
||||
int ebda_kb_len = 0;
|
||||
int mmapregion = 0;
|
||||
grub_uint8_t *ebda, *v1inebda = 0, *v2inebda = 0;
|
||||
grub_uint8_t *targetebda, *target;
|
||||
struct grub_acpi_rsdp_v10 *v1;
|
||||
struct grub_acpi_rsdp_v20 *v2;
|
||||
VasEBoot_uint8_t *ebda, *v1inebda = 0, *v2inebda = 0;
|
||||
VasEBoot_uint8_t *targetebda, *target;
|
||||
struct VasEBoot_acpi_rsdp_v10 *v1;
|
||||
struct VasEBoot_acpi_rsdp_v20 *v2;
|
||||
|
||||
ebda = (grub_uint8_t *) (grub_addr_t) ((*((grub_uint16_t *)0x40e)) << 4);
|
||||
grub_dprintf ("acpi", "EBDA @%p\n", ebda);
|
||||
ebda = (VasEBoot_uint8_t *) (VasEBoot_addr_t) ((*((VasEBoot_uint16_t *)0x40e)) << 4);
|
||||
VasEBoot_dprintf ("acpi", "EBDA @%p\n", ebda);
|
||||
if (ebda)
|
||||
ebda_kb_len = *(grub_uint16_t *) ebda;
|
||||
grub_dprintf ("acpi", "EBDA length 0x%x\n", ebda_kb_len);
|
||||
ebda_kb_len = *(VasEBoot_uint16_t *) ebda;
|
||||
VasEBoot_dprintf ("acpi", "EBDA length 0x%x\n", ebda_kb_len);
|
||||
if (ebda_kb_len > 16)
|
||||
ebda_kb_len = 0;
|
||||
ctx.ebda_len = (ebda_kb_len + 1) << 10;
|
||||
|
||||
/* FIXME: use low-memory mm allocation once it's available. */
|
||||
grub_mmap_iterate (find_hook, &ctx);
|
||||
targetebda = (grub_uint8_t *) (grub_addr_t) ctx.highestlow;
|
||||
grub_dprintf ("acpi", "creating ebda @%llx\n",
|
||||
VasEBoot_mmap_iterate (find_hook, &ctx);
|
||||
targetebda = (VasEBoot_uint8_t *) (VasEBoot_addr_t) ctx.highestlow;
|
||||
VasEBoot_dprintf ("acpi", "creating ebda @%llx\n",
|
||||
(unsigned long long) 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");
|
||||
|
||||
mmapregion = grub_mmap_register ((grub_addr_t) targetebda, ctx.ebda_len,
|
||||
GRUB_MEMORY_RESERVED);
|
||||
mmapregion = VasEBoot_mmap_register ((VasEBoot_addr_t) targetebda, ctx.ebda_len,
|
||||
VasEBoot_MEMORY_RESERVED);
|
||||
if (! mmapregion)
|
||||
return grub_errno;
|
||||
return VasEBoot_errno;
|
||||
|
||||
/* XXX: EBDA is unstandardized, so this implementation is heuristical. */
|
||||
if (ebda_kb_len)
|
||||
grub_memcpy (targetebda, ebda, 0x400);
|
||||
VasEBoot_memcpy (targetebda, ebda, 0x400);
|
||||
else
|
||||
grub_memset (targetebda, 0, 0x400);
|
||||
*((grub_uint16_t *) targetebda) = ebda_kb_len + 1;
|
||||
VasEBoot_memset (targetebda, 0, 0x400);
|
||||
*((VasEBoot_uint16_t *) targetebda) = ebda_kb_len + 1;
|
||||
target = targetebda;
|
||||
|
||||
v1 = grub_acpi_get_rsdpv1 ();
|
||||
v2 = grub_acpi_get_rsdpv2 ();
|
||||
v1 = VasEBoot_acpi_get_rsdpv1 ();
|
||||
v2 = VasEBoot_acpi_get_rsdpv2 ();
|
||||
if (v2 && v2->length > 40)
|
||||
v2 = 0;
|
||||
|
||||
/* First try to replace already existing rsdp. */
|
||||
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)
|
||||
if (grub_memcmp (target, GRUB_RSDP_SIGNATURE, GRUB_RSDP_SIGNATURE_SIZE) == 0
|
||||
&& grub_byte_checksum (target,
|
||||
sizeof (struct grub_acpi_rsdp_v10)) == 0
|
||||
&& ((struct grub_acpi_rsdp_v10 *) target)->revision != 0
|
||||
&& ((struct grub_acpi_rsdp_v20 *) target)->length <= v2->length)
|
||||
if (VasEBoot_memcmp (target, VasEBoot_RSDP_SIGNATURE, VasEBoot_RSDP_SIGNATURE_SIZE) == 0
|
||||
&& VasEBoot_byte_checksum (target,
|
||||
sizeof (struct VasEBoot_acpi_rsdp_v10)) == 0
|
||||
&& ((struct VasEBoot_acpi_rsdp_v10 *) target)->revision != 0
|
||||
&& ((struct VasEBoot_acpi_rsdp_v20 *) target)->length <= v2->length)
|
||||
{
|
||||
grub_memcpy (target, v2, v2->length);
|
||||
grub_dprintf ("acpi", "Copying rsdpv2 to %p\n", target);
|
||||
VasEBoot_memcpy (target, v2, v2->length);
|
||||
VasEBoot_dprintf ("acpi", "Copying rsdpv2 to %p\n", target);
|
||||
v2inebda = target;
|
||||
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;
|
||||
break;
|
||||
}
|
||||
|
|
@ -226,18 +226,18 @@ grub_acpi_create_ebda (void)
|
|||
|
||||
if (v1)
|
||||
{
|
||||
grub_dprintf ("acpi", "Scanning EBDA for old rsdpv1\n");
|
||||
for (; target < targetebda + 0x400 - sizeof (struct grub_acpi_rsdp_v10);
|
||||
VasEBoot_dprintf ("acpi", "Scanning EBDA for old rsdpv1\n");
|
||||
for (; target < targetebda + 0x400 - sizeof (struct VasEBoot_acpi_rsdp_v10);
|
||||
target += 0x10)
|
||||
if (grub_memcmp (target, GRUB_RSDP_SIGNATURE, GRUB_RSDP_SIGNATURE_SIZE) == 0
|
||||
&& grub_byte_checksum (target,
|
||||
sizeof (struct grub_acpi_rsdp_v10)) == 0)
|
||||
if (VasEBoot_memcmp (target, VasEBoot_RSDP_SIGNATURE, VasEBoot_RSDP_SIGNATURE_SIZE) == 0
|
||||
&& VasEBoot_byte_checksum (target,
|
||||
sizeof (struct VasEBoot_acpi_rsdp_v10)) == 0)
|
||||
{
|
||||
grub_memcpy (target, v1, sizeof (struct grub_acpi_rsdp_v10));
|
||||
grub_dprintf ("acpi", "Copying rsdpv1 to %p\n", target);
|
||||
VasEBoot_memcpy (target, v1, sizeof (struct VasEBoot_acpi_rsdp_v10));
|
||||
VasEBoot_dprintf ("acpi", "Copying rsdpv1 to %p\n", target);
|
||||
v1inebda = target;
|
||||
target += sizeof (struct grub_acpi_rsdp_v10);
|
||||
target = (grub_uint8_t *) ALIGN_UP((grub_addr_t) target, 16);
|
||||
target += sizeof (struct VasEBoot_acpi_rsdp_v10);
|
||||
target = (VasEBoot_uint8_t *) ALIGN_UP((VasEBoot_addr_t) target, 16);
|
||||
v1 = 0;
|
||||
break;
|
||||
}
|
||||
|
|
@ -248,15 +248,15 @@ grub_acpi_create_ebda (void)
|
|||
/* Try contiguous zeros. */
|
||||
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)
|
||||
if (iszero (target, v2->length))
|
||||
{
|
||||
grub_dprintf ("acpi", "Copying rsdpv2 to %p\n", target);
|
||||
grub_memcpy (target, v2, v2->length);
|
||||
VasEBoot_dprintf ("acpi", "Copying rsdpv2 to %p\n", target);
|
||||
VasEBoot_memcpy (target, v2, v2->length);
|
||||
v2inebda = target;
|
||||
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;
|
||||
break;
|
||||
}
|
||||
|
|
@ -264,16 +264,16 @@ grub_acpi_create_ebda (void)
|
|||
|
||||
if (v1)
|
||||
{
|
||||
grub_dprintf ("acpi", "Scanning EBDA for block of zeros\n");
|
||||
for (; target < targetebda + 0x400 - sizeof (struct grub_acpi_rsdp_v10);
|
||||
VasEBoot_dprintf ("acpi", "Scanning EBDA for block of zeros\n");
|
||||
for (; target < targetebda + 0x400 - sizeof (struct VasEBoot_acpi_rsdp_v10);
|
||||
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);
|
||||
grub_memcpy (target, v1, sizeof (struct grub_acpi_rsdp_v10));
|
||||
VasEBoot_dprintf ("acpi", "Copying rsdpv1 to %p\n", target);
|
||||
VasEBoot_memcpy (target, v1, sizeof (struct VasEBoot_acpi_rsdp_v10));
|
||||
v1inebda = target;
|
||||
target += sizeof (struct grub_acpi_rsdp_v10);
|
||||
target = (grub_uint8_t *) ALIGN_UP((grub_addr_t) target, 16);
|
||||
target += sizeof (struct VasEBoot_acpi_rsdp_v10);
|
||||
target = (VasEBoot_uint8_t *) ALIGN_UP((VasEBoot_addr_t) target, 16);
|
||||
v1 = 0;
|
||||
break;
|
||||
}
|
||||
|
|
@ -281,26 +281,26 @@ grub_acpi_create_ebda (void)
|
|||
|
||||
if (v1 || v2)
|
||||
{
|
||||
grub_mmap_unregister (mmapregion);
|
||||
return grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||
VasEBoot_mmap_unregister (mmapregion);
|
||||
return VasEBoot_error (VasEBoot_ERR_OUT_OF_MEMORY,
|
||||
"couldn't find suitable spot in EBDA");
|
||||
}
|
||||
|
||||
/* Remove any other RSDT. */
|
||||
for (target = targetebda;
|
||||
target < targetebda + 0x400 - sizeof (struct grub_acpi_rsdp_v10);
|
||||
target < targetebda + 0x400 - sizeof (struct VasEBoot_acpi_rsdp_v10);
|
||||
target += 0x10)
|
||||
if (grub_memcmp (target, GRUB_RSDP_SIGNATURE, GRUB_RSDP_SIGNATURE_SIZE) == 0
|
||||
&& grub_byte_checksum (target,
|
||||
sizeof (struct grub_acpi_rsdp_v10)) == 0
|
||||
if (VasEBoot_memcmp (target, VasEBoot_RSDP_SIGNATURE, VasEBoot_RSDP_SIGNATURE_SIZE) == 0
|
||||
&& VasEBoot_byte_checksum (target,
|
||||
sizeof (struct VasEBoot_acpi_rsdp_v10)) == 0
|
||||
&& target != v1inebda && target != v2inebda)
|
||||
*target = 0;
|
||||
|
||||
grub_dprintf ("acpi", "Switching EBDA\n");
|
||||
(*((grub_uint16_t *) 0x40e)) = ((grub_addr_t) targetebda) >> 4;
|
||||
grub_dprintf ("acpi", "EBDA switched\n");
|
||||
VasEBoot_dprintf ("acpi", "Switching EBDA\n");
|
||||
(*((VasEBoot_uint16_t *) 0x40e)) = ((VasEBoot_addr_t) targetebda) >> 4;
|
||||
VasEBoot_dprintf ("acpi", "EBDA switched\n");
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
return VasEBoot_ERR_NONE;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
|
@ -309,44 +309,44 @@ static void
|
|||
setup_common_tables (void)
|
||||
{
|
||||
struct efiemu_acpi_table *cur;
|
||||
struct grub_acpi_table_header *rsdt;
|
||||
grub_uint32_t *rsdt_entry;
|
||||
struct VasEBoot_acpi_table_header *rsdt;
|
||||
VasEBoot_uint32_t *rsdt_entry;
|
||||
int numoftables;
|
||||
|
||||
/* Treat DSDT. */
|
||||
grub_memcpy (playground_ptr, table_dsdt, dsdt_size);
|
||||
grub_free (table_dsdt);
|
||||
VasEBoot_memcpy (playground_ptr, table_dsdt, dsdt_size);
|
||||
VasEBoot_free (table_dsdt);
|
||||
table_dsdt = playground_ptr;
|
||||
playground_ptr += dsdt_size;
|
||||
|
||||
/* Treat other tables. */
|
||||
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);
|
||||
grub_free (cur->addr);
|
||||
VasEBoot_memcpy (playground_ptr, cur->addr, cur->size);
|
||||
VasEBoot_free (cur->addr);
|
||||
cur->addr = playground_ptr;
|
||||
playground_ptr += cur->size;
|
||||
|
||||
/* If it's FADT correct DSDT and FACS addresses. */
|
||||
fadt = (struct grub_acpi_fadt *) cur->addr;
|
||||
if (grub_memcmp (fadt->hdr.signature, GRUB_ACPI_FADT_SIGNATURE,
|
||||
fadt = (struct VasEBoot_acpi_fadt *) cur->addr;
|
||||
if (VasEBoot_memcmp (fadt->hdr.signature, VasEBoot_ACPI_FADT_SIGNATURE,
|
||||
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;
|
||||
|
||||
/* Does a revision 2 exist at all? */
|
||||
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;
|
||||
}
|
||||
|
||||
/* Recompute checksum. */
|
||||
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)
|
||||
numoftables++;
|
||||
|
||||
rsdt_addr = rsdt = (struct grub_acpi_table_header *) playground_ptr;
|
||||
playground_ptr += sizeof (struct grub_acpi_table_header) + sizeof (grub_uint32_t) * numoftables;
|
||||
rsdt_addr = rsdt = (struct VasEBoot_acpi_table_header *) playground_ptr;
|
||||
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. */
|
||||
grub_memcpy (&(rsdt->signature), "RSDT", 4);
|
||||
rsdt->length = sizeof (struct grub_acpi_table_header) + sizeof (grub_uint32_t) * numoftables;
|
||||
VasEBoot_memcpy (&(rsdt->signature), "RSDT", 4);
|
||||
rsdt->length = sizeof (struct VasEBoot_acpi_table_header) + sizeof (VasEBoot_uint32_t) * numoftables;
|
||||
rsdt->revision = 1;
|
||||
grub_memcpy (&(rsdt->oemid), root_oemid, sizeof (rsdt->oemid));
|
||||
grub_memcpy (&(rsdt->oemtable), root_oemtable, sizeof (rsdt->oemtable));
|
||||
VasEBoot_memcpy (&(rsdt->oemid), root_oemid, sizeof (rsdt->oemid));
|
||||
VasEBoot_memcpy (&(rsdt->oemtable), root_oemtable, sizeof (rsdt->oemtable));
|
||||
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;
|
||||
|
||||
for (cur = acpi_tables; cur; cur = cur->next)
|
||||
*(rsdt_entry++) = (grub_addr_t) cur->addr;
|
||||
*(rsdt_entry++) = (VasEBoot_addr_t) cur->addr;
|
||||
|
||||
/* Recompute checksum. */
|
||||
rsdt->checksum = 0;
|
||||
rsdt->checksum = 1 + ~grub_byte_checksum (rsdt, rsdt->length);
|
||||
rsdt->checksum = 1 + ~VasEBoot_byte_checksum (rsdt, rsdt->length);
|
||||
}
|
||||
|
||||
/* Regenerate ACPIv1 RSDP */
|
||||
|
|
@ -383,25 +383,25 @@ static void
|
|||
setv1table (void)
|
||||
{
|
||||
/* Create RSDP. */
|
||||
rsdpv1_new = (struct grub_acpi_rsdp_v10 *) playground_ptr;
|
||||
playground_ptr += sizeof (struct grub_acpi_rsdp_v10);
|
||||
grub_memcpy (&(rsdpv1_new->signature), GRUB_RSDP_SIGNATURE,
|
||||
rsdpv1_new = (struct VasEBoot_acpi_rsdp_v10 *) playground_ptr;
|
||||
playground_ptr += sizeof (struct VasEBoot_acpi_rsdp_v10);
|
||||
VasEBoot_memcpy (&(rsdpv1_new->signature), VasEBoot_RSDP_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->rsdt_addr = (grub_addr_t) rsdt_addr;
|
||||
rsdpv1_new->rsdt_addr = (VasEBoot_addr_t) rsdt_addr;
|
||||
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));
|
||||
grub_dprintf ("acpi", "Generated ACPIv1 tables\n");
|
||||
VasEBoot_dprintf ("acpi", "Generated ACPIv1 tables\n");
|
||||
}
|
||||
|
||||
static void
|
||||
setv2table (void)
|
||||
{
|
||||
struct grub_acpi_table_header *xsdt;
|
||||
struct VasEBoot_acpi_table_header *xsdt;
|
||||
struct efiemu_acpi_table *cur;
|
||||
grub_uint64_t *xsdt_entry;
|
||||
VasEBoot_uint64_t *xsdt_entry;
|
||||
int numoftables;
|
||||
|
||||
numoftables = 0;
|
||||
|
|
@ -409,41 +409,41 @@ setv2table (void)
|
|||
numoftables++;
|
||||
|
||||
/* Create XSDT. */
|
||||
xsdt = (struct grub_acpi_table_header *) playground_ptr;
|
||||
playground_ptr += sizeof (struct grub_acpi_table_header) + sizeof (grub_uint64_t) * numoftables;
|
||||
xsdt = (struct VasEBoot_acpi_table_header *) playground_ptr;
|
||||
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)
|
||||
*(xsdt_entry++) = (grub_addr_t) cur->addr;
|
||||
grub_memcpy (&(xsdt->signature), "XSDT", 4);
|
||||
xsdt->length = sizeof (struct grub_acpi_table_header) + sizeof (grub_uint64_t) * numoftables;
|
||||
*(xsdt_entry++) = (VasEBoot_addr_t) cur->addr;
|
||||
VasEBoot_memcpy (&(xsdt->signature), "XSDT", 4);
|
||||
xsdt->length = sizeof (struct VasEBoot_acpi_table_header) + sizeof (VasEBoot_uint64_t) * numoftables;
|
||||
xsdt->revision = 1;
|
||||
grub_memcpy (&(xsdt->oemid), root_oemid, sizeof (xsdt->oemid));
|
||||
grub_memcpy (&(xsdt->oemtable), root_oemtable, sizeof (xsdt->oemtable));
|
||||
VasEBoot_memcpy (&(xsdt->oemid), root_oemid, sizeof (xsdt->oemid));
|
||||
VasEBoot_memcpy (&(xsdt->oemtable), root_oemtable, sizeof (xsdt->oemtable));
|
||||
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->checksum = 0;
|
||||
xsdt->checksum = 1 + ~grub_byte_checksum (xsdt, xsdt->length);
|
||||
xsdt->checksum = 1 + ~VasEBoot_byte_checksum (xsdt, xsdt->length);
|
||||
|
||||
/* Create RSDPv2. */
|
||||
rsdpv2_new = (struct grub_acpi_rsdp_v20 *) playground_ptr;
|
||||
playground_ptr += sizeof (struct grub_acpi_rsdp_v20);
|
||||
grub_memcpy (&(rsdpv2_new->rsdpv1.signature), GRUB_RSDP_SIGNATURE,
|
||||
rsdpv2_new = (struct VasEBoot_acpi_rsdp_v20 *) playground_ptr;
|
||||
playground_ptr += sizeof (struct VasEBoot_acpi_rsdp_v20);
|
||||
VasEBoot_memcpy (&(rsdpv2_new->rsdpv1.signature), VasEBoot_RSDP_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));
|
||||
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 = 1 + ~grub_byte_checksum
|
||||
rsdpv2_new->rsdpv1.checksum = 1 + ~VasEBoot_byte_checksum
|
||||
(&(rsdpv2_new->rsdpv1), sizeof (rsdpv2_new->rsdpv1));
|
||||
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 = 1 + ~grub_byte_checksum (rsdpv2_new,
|
||||
rsdpv2_new->checksum = 1 + ~VasEBoot_byte_checksum (rsdpv2_new,
|
||||
rsdpv2_new->length);
|
||||
grub_dprintf ("acpi", "Generated ACPIv2 tables\n");
|
||||
VasEBoot_dprintf ("acpi", "Generated ACPIv2 tables\n");
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -451,23 +451,23 @@ free_tables (void)
|
|||
{
|
||||
struct efiemu_acpi_table *cur, *t;
|
||||
if (table_dsdt)
|
||||
grub_free (table_dsdt);
|
||||
VasEBoot_free (table_dsdt);
|
||||
for (cur = acpi_tables; cur;)
|
||||
{
|
||||
t = cur;
|
||||
grub_free (cur->addr);
|
||||
VasEBoot_free (cur->addr);
|
||||
cur = cur->next;
|
||||
grub_free (t);
|
||||
VasEBoot_free (t);
|
||||
}
|
||||
acpi_tables = 0;
|
||||
table_dsdt = 0;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_acpi (struct VasEBoot_extcmd_context *ctxt, int argc, char **args)
|
||||
{
|
||||
struct grub_arg_list *state = ctxt->state;
|
||||
struct grub_acpi_rsdp_v10 *rsdp;
|
||||
struct VasEBoot_arg_list *state = ctxt->state;
|
||||
struct VasEBoot_acpi_rsdp_v10 *rsdp;
|
||||
struct efiemu_acpi_table *cur, *t;
|
||||
int i, mmapregion;
|
||||
int numoftables;
|
||||
|
|
@ -480,88 +480,88 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
|
|||
playground = playground_ptr = 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)
|
||||
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)
|
||||
{
|
||||
grub_uint32_t *entry_ptr;
|
||||
VasEBoot_uint32_t *entry_ptr;
|
||||
char *exclude = 0;
|
||||
char *load_only = 0;
|
||||
char *ptr;
|
||||
/* 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)
|
||||
{
|
||||
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)
|
||||
{
|
||||
for (ptr = load_only; *ptr; ptr++)
|
||||
*ptr = grub_tolower (*ptr);
|
||||
*ptr = VasEBoot_tolower (*ptr);
|
||||
}
|
||||
|
||||
/* Set revision variables to replicate the same version as host. */
|
||||
rev1 = ! 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. */
|
||||
for (entry_ptr = (grub_uint32_t *) (rsdt + 1);
|
||||
entry_ptr < (grub_uint32_t *) (((grub_uint8_t *) rsdt)
|
||||
for (entry_ptr = (VasEBoot_uint32_t *) (rsdt + 1);
|
||||
entry_ptr < (VasEBoot_uint32_t *) (((VasEBoot_uint8_t *) rsdt)
|
||||
+ rsdt->length);
|
||||
entry_ptr++)
|
||||
{
|
||||
char signature[5];
|
||||
struct efiemu_acpi_table *table;
|
||||
struct grub_acpi_table_header *curtable
|
||||
= (struct grub_acpi_table_header *) (grub_addr_t) *entry_ptr;
|
||||
struct VasEBoot_acpi_table_header *curtable
|
||||
= (struct VasEBoot_acpi_table_header *) (VasEBoot_addr_t) *entry_ptr;
|
||||
signature[4] = 0;
|
||||
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 (grub_strcmp (signature, "facp") == 0)
|
||||
if (VasEBoot_strcmp (signature, "facp") == 0)
|
||||
{
|
||||
struct grub_acpi_table_header *dsdt;
|
||||
struct grub_acpi_fadt *fadt = (struct grub_acpi_fadt *) curtable;
|
||||
struct VasEBoot_acpi_table_header *dsdt;
|
||||
struct VasEBoot_acpi_fadt *fadt = (struct VasEBoot_acpi_fadt *) curtable;
|
||||
|
||||
/* Set root header variables to the same values
|
||||
as FADT by default. */
|
||||
grub_memcpy (&root_oemid, &(fadt->hdr.oemid),
|
||||
VasEBoot_memcpy (&root_oemid, &(fadt->hdr.oemid),
|
||||
sizeof (root_oemid));
|
||||
grub_memcpy (&root_oemtable, &(fadt->hdr.oemtable),
|
||||
VasEBoot_memcpy (&root_oemtable, &(fadt->hdr.oemtable),
|
||||
sizeof (root_oemtable));
|
||||
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));
|
||||
root_creator_rev = fadt->hdr.creator_rev;
|
||||
|
||||
/* Load DSDT if not excluded. */
|
||||
dsdt = (struct grub_acpi_table_header *)
|
||||
(grub_addr_t) fadt->dsdt_addr;
|
||||
if (dsdt && (! exclude || ! grub_strword (exclude, "dsdt"))
|
||||
&& (! load_only || grub_strword (load_only, "dsdt"))
|
||||
dsdt = (struct VasEBoot_acpi_table_header *)
|
||||
(VasEBoot_addr_t) fadt->dsdt_addr;
|
||||
if (dsdt && (! exclude || ! VasEBoot_strword (exclude, "dsdt"))
|
||||
&& (! load_only || VasEBoot_strword (load_only, "dsdt"))
|
||||
&& dsdt->length >= sizeof (*dsdt))
|
||||
{
|
||||
dsdt_size = dsdt->length;
|
||||
table_dsdt = grub_malloc (dsdt->length);
|
||||
table_dsdt = VasEBoot_malloc (dsdt->length);
|
||||
if (! table_dsdt)
|
||||
{
|
||||
free_tables ();
|
||||
grub_free (exclude);
|
||||
grub_free (load_only);
|
||||
return grub_errno;
|
||||
VasEBoot_free (exclude);
|
||||
VasEBoot_free (load_only);
|
||||
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. */
|
||||
|
|
@ -569,41 +569,41 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
|
|||
}
|
||||
|
||||
/* Skip excluded tables. */
|
||||
if (exclude && grub_strword (exclude, signature))
|
||||
if (exclude && VasEBoot_strword (exclude, signature))
|
||||
continue;
|
||||
if (load_only && ! grub_strword (load_only, signature))
|
||||
if (load_only && ! VasEBoot_strword (load_only, signature))
|
||||
continue;
|
||||
|
||||
/* Sanity check. */
|
||||
if (curtable->length < sizeof (*curtable))
|
||||
continue;
|
||||
|
||||
table = (struct efiemu_acpi_table *) grub_malloc
|
||||
table = (struct efiemu_acpi_table *) VasEBoot_malloc
|
||||
(sizeof (struct efiemu_acpi_table));
|
||||
if (! table)
|
||||
{
|
||||
free_tables ();
|
||||
grub_free (exclude);
|
||||
grub_free (load_only);
|
||||
return grub_errno;
|
||||
VasEBoot_free (exclude);
|
||||
VasEBoot_free (load_only);
|
||||
return VasEBoot_errno;
|
||||
}
|
||||
table->size = curtable->length;
|
||||
table->addr = grub_malloc (table->size);
|
||||
table->addr = VasEBoot_malloc (table->size);
|
||||
playground_size += table->size;
|
||||
if (! table->addr)
|
||||
{
|
||||
free_tables ();
|
||||
grub_free (exclude);
|
||||
grub_free (load_only);
|
||||
grub_free (table);
|
||||
return grub_errno;
|
||||
VasEBoot_free (exclude);
|
||||
VasEBoot_free (load_only);
|
||||
VasEBoot_free (table);
|
||||
return VasEBoot_errno;
|
||||
}
|
||||
table->next = acpi_tables;
|
||||
acpi_tables = table;
|
||||
grub_memcpy (table->addr, curtable, table->size);
|
||||
VasEBoot_memcpy (table->addr, curtable, table->size);
|
||||
}
|
||||
grub_free (exclude);
|
||||
grub_free (load_only);
|
||||
VasEBoot_free (exclude);
|
||||
VasEBoot_free (load_only);
|
||||
}
|
||||
|
||||
/* 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? */
|
||||
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)
|
||||
grub_strncpy (root_oemtable, state[5].arg, sizeof (root_oemtable));
|
||||
VasEBoot_strncpy (root_oemtable, state[5].arg, sizeof (root_oemtable));
|
||||
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)
|
||||
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)
|
||||
root_creator_rev = grub_strtoul (state[8].arg, 0, 0);
|
||||
root_creator_rev = VasEBoot_strtoul (state[8].arg, 0, 0);
|
||||
|
||||
/* Load user tables */
|
||||
for (i = 0; i < argc; i++)
|
||||
{
|
||||
grub_file_t file;
|
||||
grub_size_t size;
|
||||
VasEBoot_file_t file;
|
||||
VasEBoot_size_t size;
|
||||
char *buf;
|
||||
|
||||
file = grub_file_open (args[i]);
|
||||
file = VasEBoot_file_open (args[i]);
|
||||
if (! file)
|
||||
{
|
||||
free_tables ();
|
||||
return grub_errno;
|
||||
return VasEBoot_errno;
|
||||
}
|
||||
|
||||
size = grub_file_size (file);
|
||||
if (size < sizeof (struct grub_acpi_table_header))
|
||||
size = VasEBoot_file_size (file);
|
||||
if (size < sizeof (struct VasEBoot_acpi_table_header))
|
||||
{
|
||||
grub_file_close (file);
|
||||
VasEBoot_file_close (file);
|
||||
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]);
|
||||
}
|
||||
|
||||
buf = (char *) grub_malloc (size);
|
||||
buf = (char *) VasEBoot_malloc (size);
|
||||
if (! buf)
|
||||
{
|
||||
grub_file_close (file);
|
||||
VasEBoot_file_close (file);
|
||||
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 ();
|
||||
if (!grub_errno)
|
||||
grub_error (GRUB_ERR_BAD_OS, N_("premature end of file %s"),
|
||||
if (!VasEBoot_errno)
|
||||
VasEBoot_error (VasEBoot_ERR_BAD_OS, N_("premature end of file %s"),
|
||||
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)
|
||||
{
|
||||
grub_free (table_dsdt);
|
||||
VasEBoot_free (table_dsdt);
|
||||
table_dsdt = buf;
|
||||
dsdt_size = size;
|
||||
}
|
||||
else
|
||||
{
|
||||
struct efiemu_acpi_table *table;
|
||||
table = (struct efiemu_acpi_table *) grub_malloc
|
||||
table = (struct efiemu_acpi_table *) VasEBoot_malloc
|
||||
(sizeof (struct efiemu_acpi_table));
|
||||
if (! table)
|
||||
{
|
||||
free_tables ();
|
||||
return grub_errno;
|
||||
return VasEBoot_errno;
|
||||
}
|
||||
|
||||
table->size = size;
|
||||
|
|
@ -704,22 +704,22 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
|
|||
/* DSDT. */
|
||||
playground_size += dsdt_size;
|
||||
/* 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. */
|
||||
playground_size += sizeof (struct grub_acpi_rsdp_v10);
|
||||
playground_size += sizeof (struct VasEBoot_acpi_rsdp_v10);
|
||||
/* 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. */
|
||||
playground_size += sizeof (struct grub_acpi_rsdp_v20);
|
||||
playground_size += sizeof (struct VasEBoot_acpi_rsdp_v20);
|
||||
|
||||
playground = playground_ptr
|
||||
= grub_mmap_malign_and_register (1, playground_size, &mmapregion,
|
||||
GRUB_MEMORY_ACPI, 0);
|
||||
= VasEBoot_mmap_malign_and_register (1, playground_size, &mmapregion,
|
||||
VasEBoot_MEMORY_ACPI, 0);
|
||||
|
||||
if (! playground)
|
||||
{
|
||||
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");
|
||||
}
|
||||
|
||||
|
|
@ -737,45 +737,45 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
|
|||
{
|
||||
t = cur;
|
||||
cur = cur->next;
|
||||
grub_free (t);
|
||||
VasEBoot_free (t);
|
||||
}
|
||||
acpi_tables = 0;
|
||||
|
||||
#if defined (__i386__) || defined (__x86_64__)
|
||||
if (! state[9].set)
|
||||
{
|
||||
grub_err_t err;
|
||||
err = grub_acpi_create_ebda ();
|
||||
VasEBoot_err_t err;
|
||||
err = VasEBoot_acpi_create_ebda ();
|
||||
if (err)
|
||||
{
|
||||
rsdpv1_new = 0;
|
||||
rsdpv2_new = 0;
|
||||
grub_mmap_free_and_unregister (mmapregion);
|
||||
VasEBoot_mmap_free_and_unregister (mmapregion);
|
||||
return err;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef GRUB_MACHINE_EFI
|
||||
#ifdef VasEBoot_MACHINE_EFI
|
||||
{
|
||||
struct grub_efi_guid acpi = GRUB_EFI_ACPI_TABLE_GUID;
|
||||
struct grub_efi_guid acpi20 = GRUB_EFI_ACPI_20_TABLE_GUID;
|
||||
struct VasEBoot_efi_guid acpi = VasEBoot_EFI_ACPI_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,
|
||||
&acpi20, grub_acpi_get_rsdpv2 ());
|
||||
efi_call_2 (grub_efi_system_table->boot_services->install_configuration_table,
|
||||
&acpi, grub_acpi_get_rsdpv1 ());
|
||||
efi_call_2 (VasEBoot_efi_system_table->boot_services->install_configuration_table,
|
||||
&acpi20, VasEBoot_acpi_get_rsdpv2 ());
|
||||
efi_call_2 (VasEBoot_efi_system_table->boot_services->install_configuration_table,
|
||||
&acpi, VasEBoot_acpi_get_rsdpv1 ());
|
||||
}
|
||||
#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|"
|
||||
"--load-only=TABLE1,TABLE2] FILE1"
|
||||
" [FILE2] [...]"),
|
||||
|
|
@ -784,7 +784,7 @@ GRUB_MOD_INIT(acpi)
|
|||
options);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(acpi)
|
||||
VasEBoot_MOD_FINI(acpi)
|
||||
{
|
||||
grub_unregister_extcmd (cmd);
|
||||
VasEBoot_unregister_extcmd (cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,22 +1,22 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifdef GRUB_DSDT_TEST
|
||||
#ifdef VasEBoot_DSDT_TEST
|
||||
#include <stdio.h>
|
||||
#include <unistd.h>
|
||||
#include <stdlib.h>
|
||||
|
|
@ -24,37 +24,37 @@
|
|||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#define grub_dprintf(cond, args...) printf ( args )
|
||||
#define grub_printf printf
|
||||
#define grub_util_fopen fopen
|
||||
#define grub_memcmp memcmp
|
||||
typedef uint64_t grub_uint64_t;
|
||||
typedef uint32_t grub_uint32_t;
|
||||
typedef uint16_t grub_uint16_t;
|
||||
typedef uint8_t grub_uint8_t;
|
||||
#define VasEBoot_dprintf(cond, args...) printf ( args )
|
||||
#define VasEBoot_printf printf
|
||||
#define VasEBoot_util_fopen fopen
|
||||
#define VasEBoot_memcmp memcmp
|
||||
typedef uint64_t VasEBoot_uint64_t;
|
||||
typedef uint32_t VasEBoot_uint32_t;
|
||||
typedef uint16_t VasEBoot_uint16_t;
|
||||
typedef uint8_t VasEBoot_uint8_t;
|
||||
|
||||
#endif
|
||||
|
||||
#include <grub/acpi.h>
|
||||
#ifndef GRUB_DSDT_TEST
|
||||
#include <grub/i18n.h>
|
||||
#include <VasEBoot/acpi.h>
|
||||
#ifndef VasEBoot_DSDT_TEST
|
||||
#include <VasEBoot/i18n.h>
|
||||
#else
|
||||
#define _(x) x
|
||||
#define N_(x) x
|
||||
#endif
|
||||
|
||||
#ifndef GRUB_DSDT_TEST
|
||||
#include <grub/mm.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/time.h>
|
||||
#include <grub/cpu/io.h>
|
||||
#ifndef VasEBoot_DSDT_TEST
|
||||
#include <VasEBoot/mm.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/time.h>
|
||||
#include <VasEBoot/cpu/io.h>
|
||||
#endif
|
||||
|
||||
static inline grub_uint32_t
|
||||
decode_length (const grub_uint8_t *ptr, int *numlen)
|
||||
static inline VasEBoot_uint32_t
|
||||
decode_length (const VasEBoot_uint8_t *ptr, int *numlen)
|
||||
{
|
||||
int num_bytes, i;
|
||||
grub_uint32_t ret;
|
||||
VasEBoot_uint32_t ret;
|
||||
if (*ptr < 64)
|
||||
{
|
||||
if (numlen)
|
||||
|
|
@ -74,10 +74,10 @@ decode_length (const grub_uint8_t *ptr, int *numlen)
|
|||
return ret;
|
||||
}
|
||||
|
||||
static inline grub_uint32_t
|
||||
skip_name_string (const grub_uint8_t *ptr, const grub_uint8_t *end)
|
||||
static inline VasEBoot_uint32_t
|
||||
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 == '\\'))
|
||||
ptr++;
|
||||
|
|
@ -101,28 +101,28 @@ skip_name_string (const grub_uint8_t *ptr, const grub_uint8_t *end)
|
|||
return ptr - ptr0;
|
||||
}
|
||||
|
||||
static inline grub_uint32_t
|
||||
skip_data_ref_object (const grub_uint8_t *ptr, const grub_uint8_t *end)
|
||||
static inline VasEBoot_uint32_t
|
||||
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)
|
||||
{
|
||||
case GRUB_ACPI_OPCODE_PACKAGE:
|
||||
case GRUB_ACPI_OPCODE_BUFFER:
|
||||
case VasEBoot_ACPI_OPCODE_PACKAGE:
|
||||
case VasEBoot_ACPI_OPCODE_BUFFER:
|
||||
return 1 + decode_length (ptr + 1, 0);
|
||||
case GRUB_ACPI_OPCODE_ZERO:
|
||||
case GRUB_ACPI_OPCODE_ONES:
|
||||
case GRUB_ACPI_OPCODE_ONE:
|
||||
case VasEBoot_ACPI_OPCODE_ZERO:
|
||||
case VasEBoot_ACPI_OPCODE_ONES:
|
||||
case VasEBoot_ACPI_OPCODE_ONE:
|
||||
return 1;
|
||||
case GRUB_ACPI_OPCODE_BYTE_CONST:
|
||||
case VasEBoot_ACPI_OPCODE_BYTE_CONST:
|
||||
return 2;
|
||||
case GRUB_ACPI_OPCODE_WORD_CONST:
|
||||
case VasEBoot_ACPI_OPCODE_WORD_CONST:
|
||||
return 3;
|
||||
case GRUB_ACPI_OPCODE_DWORD_CONST:
|
||||
case VasEBoot_ACPI_OPCODE_DWORD_CONST:
|
||||
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++);
|
||||
if (ptr == end)
|
||||
return 0;
|
||||
|
|
@ -132,35 +132,35 @@ skip_data_ref_object (const grub_uint8_t *ptr, const grub_uint8_t *end)
|
|||
if (*ptr == '^' || *ptr == '\\' || *ptr == '_'
|
||||
|| (*ptr >= 'A' && *ptr <= 'Z'))
|
||||
return skip_name_string (ptr, end);
|
||||
grub_printf ("Unknown opcode 0x%x\n", *ptr);
|
||||
VasEBoot_printf ("Unknown opcode 0x%x\n", *ptr);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static inline grub_uint32_t
|
||||
skip_term (const grub_uint8_t *ptr, const grub_uint8_t *end)
|
||||
static inline VasEBoot_uint32_t
|
||||
skip_term (const VasEBoot_uint8_t *ptr, const VasEBoot_uint8_t *end)
|
||||
{
|
||||
grub_uint32_t add;
|
||||
const grub_uint8_t *ptr0 = ptr;
|
||||
VasEBoot_uint32_t add;
|
||||
const VasEBoot_uint8_t *ptr0 = ptr;
|
||||
|
||||
switch(*ptr)
|
||||
{
|
||||
case GRUB_ACPI_OPCODE_ADD:
|
||||
case GRUB_ACPI_OPCODE_AND:
|
||||
case GRUB_ACPI_OPCODE_CONCAT:
|
||||
case GRUB_ACPI_OPCODE_CONCATRES:
|
||||
case GRUB_ACPI_OPCODE_DIVIDE:
|
||||
case GRUB_ACPI_OPCODE_INDEX:
|
||||
case GRUB_ACPI_OPCODE_LSHIFT:
|
||||
case GRUB_ACPI_OPCODE_MOD:
|
||||
case GRUB_ACPI_OPCODE_MULTIPLY:
|
||||
case GRUB_ACPI_OPCODE_NAND:
|
||||
case GRUB_ACPI_OPCODE_NOR:
|
||||
case GRUB_ACPI_OPCODE_OR:
|
||||
case GRUB_ACPI_OPCODE_RSHIFT:
|
||||
case GRUB_ACPI_OPCODE_SUBTRACT:
|
||||
case GRUB_ACPI_OPCODE_TOSTRING:
|
||||
case GRUB_ACPI_OPCODE_XOR:
|
||||
case VasEBoot_ACPI_OPCODE_ADD:
|
||||
case VasEBoot_ACPI_OPCODE_AND:
|
||||
case VasEBoot_ACPI_OPCODE_CONCAT:
|
||||
case VasEBoot_ACPI_OPCODE_CONCATRES:
|
||||
case VasEBoot_ACPI_OPCODE_DIVIDE:
|
||||
case VasEBoot_ACPI_OPCODE_INDEX:
|
||||
case VasEBoot_ACPI_OPCODE_LSHIFT:
|
||||
case VasEBoot_ACPI_OPCODE_MOD:
|
||||
case VasEBoot_ACPI_OPCODE_MULTIPLY:
|
||||
case VasEBoot_ACPI_OPCODE_NAND:
|
||||
case VasEBoot_ACPI_OPCODE_NOR:
|
||||
case VasEBoot_ACPI_OPCODE_OR:
|
||||
case VasEBoot_ACPI_OPCODE_RSHIFT:
|
||||
case VasEBoot_ACPI_OPCODE_SUBTRACT:
|
||||
case VasEBoot_ACPI_OPCODE_TOSTRING:
|
||||
case VasEBoot_ACPI_OPCODE_XOR:
|
||||
/*
|
||||
* Parameters for these opcodes: TermArg, TermArg Target, see ACPI
|
||||
* spec r5.0, page 828f.
|
||||
|
|
@ -180,24 +180,24 @@ skip_term (const grub_uint8_t *ptr, const grub_uint8_t *end)
|
|||
return ptr - ptr0;
|
||||
}
|
||||
|
||||
static inline grub_uint32_t
|
||||
skip_ext_op (const grub_uint8_t *ptr, const grub_uint8_t *end)
|
||||
static inline VasEBoot_uint32_t
|
||||
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;
|
||||
grub_dprintf ("acpi", "Extended opcode: 0x%x\n", *ptr);
|
||||
VasEBoot_dprintf ("acpi", "Extended opcode: 0x%x\n", *ptr);
|
||||
switch (*ptr)
|
||||
{
|
||||
case GRUB_ACPI_EXTOPCODE_MUTEX:
|
||||
case VasEBoot_ACPI_EXTOPCODE_MUTEX:
|
||||
ptr++;
|
||||
ptr += skip_name_string (ptr, end);
|
||||
ptr++;
|
||||
break;
|
||||
case GRUB_ACPI_EXTOPCODE_EVENT_OP:
|
||||
case VasEBoot_ACPI_EXTOPCODE_EVENT_OP:
|
||||
ptr++;
|
||||
ptr += skip_name_string (ptr, end);
|
||||
break;
|
||||
case GRUB_ACPI_EXTOPCODE_OPERATION_REGION:
|
||||
case VasEBoot_ACPI_EXTOPCODE_OPERATION_REGION:
|
||||
ptr++;
|
||||
ptr += skip_name_string (ptr, end);
|
||||
ptr++;
|
||||
|
|
@ -208,18 +208,18 @@ skip_ext_op (const grub_uint8_t *ptr, const grub_uint8_t *end)
|
|||
if (!add)
|
||||
return 0;
|
||||
break;
|
||||
case GRUB_ACPI_EXTOPCODE_FIELD_OP:
|
||||
case GRUB_ACPI_EXTOPCODE_DEVICE_OP:
|
||||
case GRUB_ACPI_EXTOPCODE_PROCESSOR_OP:
|
||||
case GRUB_ACPI_EXTOPCODE_POWER_RES_OP:
|
||||
case GRUB_ACPI_EXTOPCODE_THERMAL_ZONE_OP:
|
||||
case GRUB_ACPI_EXTOPCODE_INDEX_FIELD_OP:
|
||||
case GRUB_ACPI_EXTOPCODE_BANK_FIELD_OP:
|
||||
case VasEBoot_ACPI_EXTOPCODE_FIELD_OP:
|
||||
case VasEBoot_ACPI_EXTOPCODE_DEVICE_OP:
|
||||
case VasEBoot_ACPI_EXTOPCODE_PROCESSOR_OP:
|
||||
case VasEBoot_ACPI_EXTOPCODE_POWER_RES_OP:
|
||||
case VasEBoot_ACPI_EXTOPCODE_THERMAL_ZONE_OP:
|
||||
case VasEBoot_ACPI_EXTOPCODE_INDEX_FIELD_OP:
|
||||
case VasEBoot_ACPI_EXTOPCODE_BANK_FIELD_OP:
|
||||
ptr++;
|
||||
ptr += decode_length (ptr, 0);
|
||||
break;
|
||||
default:
|
||||
grub_printf ("Unexpected extended opcode: 0x%x\n", *ptr);
|
||||
VasEBoot_printf ("Unexpected extended opcode: 0x%x\n", *ptr);
|
||||
return 0;
|
||||
}
|
||||
return ptr - ptr0;
|
||||
|
|
@ -227,30 +227,30 @@ skip_ext_op (const grub_uint8_t *ptr, const grub_uint8_t *end)
|
|||
|
||||
|
||||
static int
|
||||
get_sleep_type (grub_uint8_t *table, grub_uint8_t *ptr, grub_uint8_t *end,
|
||||
grub_uint8_t *scope, int scope_len)
|
||||
get_sleep_type (VasEBoot_uint8_t *table, VasEBoot_uint8_t *ptr, VasEBoot_uint8_t *end,
|
||||
VasEBoot_uint8_t *scope, int scope_len)
|
||||
{
|
||||
grub_uint8_t *prev = table;
|
||||
VasEBoot_uint8_t *prev = table;
|
||||
|
||||
if (!ptr)
|
||||
ptr = table + sizeof (struct grub_acpi_table_header);
|
||||
ptr = table + sizeof (struct VasEBoot_acpi_table_header);
|
||||
while (ptr < end && prev < ptr)
|
||||
{
|
||||
int add;
|
||||
prev = ptr;
|
||||
grub_dprintf ("acpi", "Opcode 0x%x\n", *ptr);
|
||||
grub_dprintf ("acpi", "Tell %x\n", (unsigned) (ptr - table));
|
||||
VasEBoot_dprintf ("acpi", "Opcode 0x%x\n", *ptr);
|
||||
VasEBoot_dprintf ("acpi", "Tell %x\n", (unsigned) (ptr - table));
|
||||
switch (*ptr)
|
||||
{
|
||||
case GRUB_ACPI_OPCODE_EXTOP:
|
||||
case VasEBoot_ACPI_OPCODE_EXTOP:
|
||||
ptr++;
|
||||
ptr += add = skip_ext_op (ptr, end);
|
||||
if (!add)
|
||||
return -1;
|
||||
break;
|
||||
case GRUB_ACPI_OPCODE_CREATE_DWORD_FIELD:
|
||||
case GRUB_ACPI_OPCODE_CREATE_WORD_FIELD:
|
||||
case GRUB_ACPI_OPCODE_CREATE_BYTE_FIELD:
|
||||
case VasEBoot_ACPI_OPCODE_CREATE_DWORD_FIELD:
|
||||
case VasEBoot_ACPI_OPCODE_CREATE_WORD_FIELD:
|
||||
case VasEBoot_ACPI_OPCODE_CREATE_BYTE_FIELD:
|
||||
{
|
||||
ptr += 5;
|
||||
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;
|
||||
break;
|
||||
}
|
||||
case GRUB_ACPI_OPCODE_NAME:
|
||||
case VasEBoot_ACPI_OPCODE_NAME:
|
||||
ptr++;
|
||||
if ((!scope || grub_memcmp (scope, "\\", scope_len) == 0) &&
|
||||
(grub_memcmp (ptr, "_S5_", 4) == 0 || grub_memcmp (ptr, "\\_S5_", 4) == 0))
|
||||
if ((!scope || VasEBoot_memcmp (scope, "\\", scope_len) == 0) &&
|
||||
(VasEBoot_memcmp (ptr, "_S5_", 4) == 0 || VasEBoot_memcmp (ptr, "\\_S5_", 4) == 0))
|
||||
{
|
||||
int ll;
|
||||
grub_uint8_t *ptr2 = ptr;
|
||||
grub_dprintf ("acpi", "S5 found\n");
|
||||
VasEBoot_uint8_t *ptr2 = ptr;
|
||||
VasEBoot_dprintf ("acpi", "S5 found\n");
|
||||
ptr2 += skip_name_string (ptr, end);
|
||||
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;
|
||||
}
|
||||
ptr2++;
|
||||
|
|
@ -279,14 +279,14 @@ get_sleep_type (grub_uint8_t *table, grub_uint8_t *ptr, grub_uint8_t *end,
|
|||
ptr2++;
|
||||
switch (*ptr2)
|
||||
{
|
||||
case GRUB_ACPI_OPCODE_ZERO:
|
||||
case VasEBoot_ACPI_OPCODE_ZERO:
|
||||
return 0;
|
||||
case GRUB_ACPI_OPCODE_ONE:
|
||||
case VasEBoot_ACPI_OPCODE_ONE:
|
||||
return 1;
|
||||
case GRUB_ACPI_OPCODE_BYTE_CONST:
|
||||
case VasEBoot_ACPI_OPCODE_BYTE_CONST:
|
||||
return ptr2[1];
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
|
@ -297,7 +297,7 @@ get_sleep_type (grub_uint8_t *table, grub_uint8_t *ptr, grub_uint8_t *end,
|
|||
if (!add)
|
||||
return -1;
|
||||
break;
|
||||
case GRUB_ACPI_OPCODE_ALIAS:
|
||||
case VasEBoot_ACPI_OPCODE_ALIAS:
|
||||
ptr++;
|
||||
/* We need to skip two name strings */
|
||||
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;
|
||||
break;
|
||||
|
||||
case GRUB_ACPI_OPCODE_SCOPE:
|
||||
case VasEBoot_ACPI_OPCODE_SCOPE:
|
||||
{
|
||||
int scope_sleep_type;
|
||||
int ll;
|
||||
grub_uint8_t *name;
|
||||
VasEBoot_uint8_t *name;
|
||||
int name_len;
|
||||
|
||||
ptr++;
|
||||
|
|
@ -328,15 +328,15 @@ get_sleep_type (grub_uint8_t *table, grub_uint8_t *ptr, grub_uint8_t *end,
|
|||
ptr += add;
|
||||
break;
|
||||
}
|
||||
case GRUB_ACPI_OPCODE_IF:
|
||||
case GRUB_ACPI_OPCODE_METHOD:
|
||||
case VasEBoot_ACPI_OPCODE_IF:
|
||||
case VasEBoot_ACPI_OPCODE_METHOD:
|
||||
{
|
||||
ptr++;
|
||||
ptr += decode_length (ptr, 0);
|
||||
break;
|
||||
}
|
||||
default:
|
||||
grub_printf ("Unknown opcode 0x%x\n", *ptr);
|
||||
VasEBoot_printf ("Unknown opcode 0x%x\n", *ptr);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
|
@ -344,7 +344,7 @@ get_sleep_type (grub_uint8_t *table, grub_uint8_t *ptr, grub_uint8_t *end,
|
|||
return -2;
|
||||
}
|
||||
|
||||
#ifdef GRUB_DSDT_TEST
|
||||
#ifdef VasEBoot_DSDT_TEST
|
||||
int
|
||||
main (int argc, char **argv)
|
||||
{
|
||||
|
|
@ -353,7 +353,7 @@ main (int argc, char **argv)
|
|||
unsigned char *buf;
|
||||
if (argc < 2)
|
||||
printf ("Usage: %s FILE\n", argv[0]);
|
||||
f = grub_util_fopen (argv[1], "rb");
|
||||
f = VasEBoot_util_fopen (argv[1], "rb");
|
||||
if (!f)
|
||||
{
|
||||
printf ("Couldn't open file\n");
|
||||
|
|
@ -386,69 +386,69 @@ main (int argc, char **argv)
|
|||
#else
|
||||
|
||||
void
|
||||
grub_acpi_halt (void)
|
||||
VasEBoot_acpi_halt (void)
|
||||
{
|
||||
struct grub_acpi_rsdp_v20 *rsdp2;
|
||||
struct grub_acpi_rsdp_v10 *rsdp1;
|
||||
struct grub_acpi_table_header *rsdt;
|
||||
grub_uint32_t *entry_ptr;
|
||||
grub_uint32_t port = 0;
|
||||
struct VasEBoot_acpi_rsdp_v20 *rsdp2;
|
||||
struct VasEBoot_acpi_rsdp_v10 *rsdp1;
|
||||
struct VasEBoot_acpi_table_header *rsdt;
|
||||
VasEBoot_uint32_t *entry_ptr;
|
||||
VasEBoot_uint32_t port = 0;
|
||||
int sleep_type = -1;
|
||||
|
||||
rsdp2 = grub_acpi_get_rsdpv2 ();
|
||||
rsdp2 = VasEBoot_acpi_get_rsdpv2 ();
|
||||
if (rsdp2)
|
||||
rsdp1 = &(rsdp2->rsdpv1);
|
||||
else
|
||||
rsdp1 = grub_acpi_get_rsdpv1 ();
|
||||
grub_dprintf ("acpi", "rsdp1=%p\n", rsdp1);
|
||||
rsdp1 = VasEBoot_acpi_get_rsdpv1 ();
|
||||
VasEBoot_dprintf ("acpi", "rsdp1=%p\n", rsdp1);
|
||||
if (!rsdp1)
|
||||
return;
|
||||
|
||||
rsdt = (struct grub_acpi_table_header *) (grub_addr_t) rsdp1->rsdt_addr;
|
||||
for (entry_ptr = (grub_uint32_t *) (rsdt + 1);
|
||||
entry_ptr < (grub_uint32_t *) (((grub_uint8_t *) rsdt)
|
||||
rsdt = (struct VasEBoot_acpi_table_header *) (VasEBoot_addr_t) rsdp1->rsdt_addr;
|
||||
for (entry_ptr = (VasEBoot_uint32_t *) (rsdt + 1);
|
||||
entry_ptr < (VasEBoot_uint32_t *) (((VasEBoot_uint8_t *) rsdt)
|
||||
+ rsdt->length);
|
||||
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 grub_acpi_fadt *) (grub_addr_t) *entry_ptr);
|
||||
struct grub_acpi_table_header *dsdt
|
||||
= (struct grub_acpi_table_header *) (grub_addr_t) fadt->dsdt_addr;
|
||||
grub_uint8_t *buf = (grub_uint8_t *) dsdt;
|
||||
struct VasEBoot_acpi_fadt *fadt
|
||||
= ((struct VasEBoot_acpi_fadt *) (VasEBoot_addr_t) *entry_ptr);
|
||||
struct VasEBoot_acpi_table_header *dsdt
|
||||
= (struct VasEBoot_acpi_table_header *) (VasEBoot_addr_t) fadt->dsdt_addr;
|
||||
VasEBoot_uint8_t *buf = (VasEBoot_uint8_t *) dsdt;
|
||||
|
||||
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
|
||||
&& sleep_type < 0)
|
||||
sleep_type = get_sleep_type (buf, NULL, buf + dsdt->length,
|
||||
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)
|
||||
{
|
||||
struct grub_acpi_table_header *ssdt
|
||||
= (struct grub_acpi_table_header *) (grub_addr_t) *entry_ptr;
|
||||
grub_uint8_t *buf = (grub_uint8_t *) ssdt;
|
||||
struct VasEBoot_acpi_table_header *ssdt
|
||||
= (struct VasEBoot_acpi_table_header *) (VasEBoot_addr_t) *entry_ptr;
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
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);
|
||||
|
||||
grub_millisleep (1500);
|
||||
VasEBoot_millisleep (1500);
|
||||
|
||||
/* TRANSLATORS: It's computer shutdown using ACPI, not disabling ACPI. */
|
||||
grub_puts_ (N_("ACPI shutdown failed"));
|
||||
VasEBoot_puts_ (N_("ACPI shutdown failed"));
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
|
|
@ -1,57 +1,57 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/arc/arc.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/command.h>
|
||||
#include <VasEBoot/i18n.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
|
||||
grub_cmd_lsdev_iter (const char *name,
|
||||
const struct grub_arc_component *comp __attribute__ ((unused)),
|
||||
VasEBoot_cmd_lsdev_iter (const char *name,
|
||||
const struct VasEBoot_arc_component *comp __attribute__ ((unused)),
|
||||
void *data __attribute__ ((unused)))
|
||||
{
|
||||
grub_printf ("%s\n", name);
|
||||
VasEBoot_printf ("%s\n", name);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_lsdev (grub_command_t cmd __attribute__ ((unused)),
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_lsdev (VasEBoot_command_t cmd __attribute__ ((unused)),
|
||||
int argc __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;
|
||||
}
|
||||
|
||||
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."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(lsdev)
|
||||
VasEBoot_MOD_FINI(lsdev)
|
||||
{
|
||||
grub_unregister_command (cmd);
|
||||
VasEBoot_unregister_command (cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,60 +1,60 @@
|
|||
/* 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.
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/file.h>
|
||||
#include <VasEBoot/mm.h>
|
||||
#include <VasEBoot/disk.h>
|
||||
#include <VasEBoot/partition.h>
|
||||
#include <VasEBoot/command.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
|
||||
{
|
||||
unsigned long start_sector;
|
||||
unsigned num_sectors;
|
||||
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
|
||||
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)
|
||||
{
|
||||
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)
|
||||
grub_printf ("+%u", num);
|
||||
VasEBoot_printf ("+%u", num);
|
||||
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
|
||||
read_blocklist (grub_disk_addr_t sector, unsigned offset, unsigned length,
|
||||
read_blocklist (VasEBoot_disk_addr_t sector, unsigned offset, unsigned length,
|
||||
void *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->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;
|
||||
sector += length >> GRUB_DISK_SECTOR_BITS;
|
||||
length &= (GRUB_DISK_SECTOR_SIZE - 1);
|
||||
ctx->num_sectors += length >> VasEBoot_DISK_SECTOR_BITS;
|
||||
sector += length >> VasEBoot_DISK_SECTOR_BITS;
|
||||
length &= (VasEBoot_DISK_SECTOR_SIZE - 1);
|
||||
}
|
||||
|
||||
if (!length)
|
||||
|
|
@ -78,7 +78,7 @@ read_blocklist (grub_disk_addr_t sector, unsigned offset, unsigned length,
|
|||
if (offset)
|
||||
{
|
||||
unsigned l = length + offset;
|
||||
l &= (GRUB_DISK_SECTOR_SIZE - 1);
|
||||
l &= (VasEBoot_DISK_SECTOR_SIZE - 1);
|
||||
l -= offset;
|
||||
print_blocklist (sector, 0, offset, l, ctx);
|
||||
length -= l;
|
||||
|
|
@ -89,28 +89,28 @@ read_blocklist (grub_disk_addr_t sector, unsigned offset, unsigned length,
|
|||
if (!length)
|
||||
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);
|
||||
sector += length >> GRUB_DISK_SECTOR_BITS;
|
||||
print_blocklist (sector, length >> VasEBoot_DISK_SECTOR_BITS, 0, 0, ctx);
|
||||
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
|
||||
{
|
||||
ctx->start_sector = sector;
|
||||
ctx->num_sectors = length >> GRUB_DISK_SECTOR_BITS;
|
||||
ctx->num_sectors = length >> VasEBoot_DISK_SECTOR_BITS;
|
||||
}
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_blocklist (grub_command_t cmd __attribute__ ((unused)),
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_blocklist (VasEBoot_command_t cmd __attribute__ ((unused)),
|
||||
int argc, char **args)
|
||||
{
|
||||
grub_file_t file;
|
||||
char buf[GRUB_DISK_SECTOR_SIZE];
|
||||
VasEBoot_file_t file;
|
||||
char buf[VasEBoot_DISK_SECTOR_SIZE];
|
||||
struct blocklist_ctx ctx = {
|
||||
.start_sector = 0,
|
||||
.num_sectors = 0,
|
||||
|
|
@ -119,42 +119,42 @@ grub_cmd_blocklist (grub_command_t cmd __attribute__ ((unused)),
|
|||
};
|
||||
|
||||
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 ();
|
||||
file = grub_file_open (args[0]);
|
||||
VasEBoot_file_filter_disable_compression ();
|
||||
file = VasEBoot_file_open (args[0]);
|
||||
if (! file)
|
||||
return grub_errno;
|
||||
return VasEBoot_errno;
|
||||
|
||||
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");
|
||||
|
||||
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_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)
|
||||
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."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(blocklist)
|
||||
VasEBoot_MOD_FINI(blocklist)
|
||||
{
|
||||
grub_unregister_command (cmd);
|
||||
VasEBoot_unregister_command (cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,68 +1,68 @@
|
|||
/* 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.
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/normal.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/loader.h>
|
||||
#include <grub/kernel.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <VasEBoot/normal.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/loader.h>
|
||||
#include <VasEBoot/kernel.h>
|
||||
#include <VasEBoot/mm.h>
|
||||
#include <VasEBoot/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
VasEBoot_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_err_t (*grub_loader_boot_func) (void);
|
||||
static grub_err_t (*grub_loader_unload_func) (void);
|
||||
static int grub_loader_flags;
|
||||
static VasEBoot_err_t (*VasEBoot_loader_boot_func) (void);
|
||||
static VasEBoot_err_t (*VasEBoot_loader_unload_func) (void);
|
||||
static int VasEBoot_loader_flags;
|
||||
|
||||
struct grub_preboot
|
||||
struct VasEBoot_preboot
|
||||
{
|
||||
grub_err_t (*preboot_func) (int);
|
||||
grub_err_t (*preboot_rest_func) (void);
|
||||
grub_loader_preboot_hook_prio_t prio;
|
||||
struct grub_preboot *next;
|
||||
struct grub_preboot *prev;
|
||||
VasEBoot_err_t (*preboot_func) (int);
|
||||
VasEBoot_err_t (*preboot_rest_func) (void);
|
||||
VasEBoot_loader_preboot_hook_prio_t prio;
|
||||
struct VasEBoot_preboot *next;
|
||||
struct VasEBoot_preboot *prev;
|
||||
};
|
||||
|
||||
static int grub_loader_loaded;
|
||||
static struct grub_preboot *preboots_head = 0,
|
||||
static int VasEBoot_loader_loaded;
|
||||
static struct VasEBoot_preboot *preboots_head = 0,
|
||||
*preboots_tail = 0;
|
||||
|
||||
int
|
||||
grub_loader_is_loaded (void)
|
||||
VasEBoot_loader_is_loaded (void)
|
||||
{
|
||||
return grub_loader_loaded;
|
||||
return VasEBoot_loader_loaded;
|
||||
}
|
||||
|
||||
/* Register a preboot hook. */
|
||||
struct grub_preboot *
|
||||
grub_loader_register_preboot_hook (grub_err_t (*preboot_func) (int flags),
|
||||
grub_err_t (*preboot_rest_func) (void),
|
||||
grub_loader_preboot_hook_prio_t prio)
|
||||
struct VasEBoot_preboot *
|
||||
VasEBoot_loader_register_preboot_hook (VasEBoot_err_t (*preboot_func) (int flags),
|
||||
VasEBoot_err_t (*preboot_rest_func) (void),
|
||||
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)
|
||||
return 0;
|
||||
|
||||
new_preboot = (struct grub_preboot *)
|
||||
grub_malloc (sizeof (struct grub_preboot));
|
||||
new_preboot = (struct VasEBoot_preboot *)
|
||||
VasEBoot_malloc (sizeof (struct VasEBoot_preboot));
|
||||
if (! new_preboot)
|
||||
return 0;
|
||||
|
||||
|
|
@ -93,9 +93,9 @@ grub_loader_register_preboot_hook (grub_err_t (*preboot_func) (int flags),
|
|||
}
|
||||
|
||||
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)
|
||||
preb->next->prev = preb->prev;
|
||||
|
|
@ -106,51 +106,51 @@ grub_loader_unregister_preboot_hook (struct grub_preboot *hnd)
|
|||
else
|
||||
preboots_head = preb->next;
|
||||
|
||||
grub_free (preb);
|
||||
VasEBoot_free (preb);
|
||||
}
|
||||
|
||||
void
|
||||
grub_loader_set (grub_err_t (*boot) (void),
|
||||
grub_err_t (*unload) (void),
|
||||
VasEBoot_loader_set (VasEBoot_err_t (*boot) (void),
|
||||
VasEBoot_err_t (*unload) (void),
|
||||
int flags)
|
||||
{
|
||||
if (grub_loader_loaded && grub_loader_unload_func)
|
||||
grub_loader_unload_func ();
|
||||
if (VasEBoot_loader_loaded && VasEBoot_loader_unload_func)
|
||||
VasEBoot_loader_unload_func ();
|
||||
|
||||
grub_loader_boot_func = boot;
|
||||
grub_loader_unload_func = unload;
|
||||
grub_loader_flags = flags;
|
||||
VasEBoot_loader_boot_func = boot;
|
||||
VasEBoot_loader_unload_func = unload;
|
||||
VasEBoot_loader_flags = flags;
|
||||
|
||||
grub_loader_loaded = 1;
|
||||
VasEBoot_loader_loaded = 1;
|
||||
}
|
||||
|
||||
void
|
||||
grub_loader_unset(void)
|
||||
VasEBoot_loader_unset(void)
|
||||
{
|
||||
if (grub_loader_loaded && grub_loader_unload_func)
|
||||
grub_loader_unload_func ();
|
||||
if (VasEBoot_loader_loaded && VasEBoot_loader_unload_func)
|
||||
VasEBoot_loader_unload_func ();
|
||||
|
||||
grub_loader_boot_func = 0;
|
||||
grub_loader_unload_func = 0;
|
||||
VasEBoot_loader_boot_func = 0;
|
||||
VasEBoot_loader_unload_func = 0;
|
||||
|
||||
grub_loader_loaded = 0;
|
||||
VasEBoot_loader_loaded = 0;
|
||||
}
|
||||
|
||||
grub_err_t
|
||||
grub_loader_boot (void)
|
||||
VasEBoot_err_t
|
||||
VasEBoot_loader_boot (void)
|
||||
{
|
||||
grub_err_t err = GRUB_ERR_NONE;
|
||||
struct grub_preboot *cur;
|
||||
VasEBoot_err_t err = VasEBoot_ERR_NONE;
|
||||
struct VasEBoot_preboot *cur;
|
||||
|
||||
if (! grub_loader_loaded)
|
||||
return grub_error (GRUB_ERR_NO_KERNEL,
|
||||
if (! VasEBoot_loader_loaded)
|
||||
return VasEBoot_error (VasEBoot_ERR_NO_KERNEL,
|
||||
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)
|
||||
{
|
||||
err = cur->preboot_func (grub_loader_flags);
|
||||
err = cur->preboot_func (VasEBoot_loader_flags);
|
||||
if (err)
|
||||
{
|
||||
for (cur = cur->prev; cur; cur = cur->prev)
|
||||
|
|
@ -158,7 +158,7 @@ grub_loader_boot (void)
|
|||
return err;
|
||||
}
|
||||
}
|
||||
err = (grub_loader_boot_func) ();
|
||||
err = (VasEBoot_loader_boot_func) ();
|
||||
|
||||
for (cur = preboots_tail; cur; cur = cur->prev)
|
||||
if (! err)
|
||||
|
|
@ -170,26 +170,26 @@ grub_loader_boot (void)
|
|||
}
|
||||
|
||||
/* boot */
|
||||
static grub_err_t
|
||||
grub_cmd_boot (struct grub_command *cmd __attribute__ ((unused)),
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_boot (struct VasEBoot_command *cmd __attribute__ ((unused)),
|
||||
int argc __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 =
|
||||
grub_register_command ("boot", grub_cmd_boot,
|
||||
VasEBoot_register_command ("boot", VasEBoot_cmd_boot,
|
||||
0, N_("Boot an operating system."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(boot)
|
||||
VasEBoot_MOD_FINI(boot)
|
||||
{
|
||||
grub_unregister_command (cmd_boot);
|
||||
VasEBoot_unregister_command (cmd_boot);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,65 +1,65 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/command.h>
|
||||
#include <VasEBoot/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
VasEBoot_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_boottime (struct grub_command *cmd __attribute__ ((unused)),
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_boottime (struct VasEBoot_command *cmd __attribute__ ((unused)),
|
||||
int argc __attribute__ ((unused)),
|
||||
char *argv[] __attribute__ ((unused)))
|
||||
{
|
||||
struct grub_boot_time *cur;
|
||||
grub_uint64_t last_time = 0, start_time = 0;
|
||||
if (!grub_boot_time_head)
|
||||
struct VasEBoot_boot_time *cur;
|
||||
VasEBoot_uint64_t last_time = 0, start_time = 0;
|
||||
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;
|
||||
}
|
||||
start_time = last_time = grub_boot_time_head->tp;
|
||||
for (cur = grub_boot_time_head; cur; cur = cur->next)
|
||||
start_time = last_time = VasEBoot_boot_time_head->tp;
|
||||
for (cur = VasEBoot_boot_time_head; cur; cur = cur->next)
|
||||
{
|
||||
grub_uint32_t tmabs = cur->tp - start_time;
|
||||
grub_uint32_t tmrel = cur->tp - last_time;
|
||||
VasEBoot_uint32_t tmabs = cur->tp - start_time;
|
||||
VasEBoot_uint32_t tmrel = cur->tp - last_time;
|
||||
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,
|
||||
cur->msg);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_command_t cmd_boottime;
|
||||
static VasEBoot_command_t cmd_boottime;
|
||||
|
||||
GRUB_MOD_INIT(boottime)
|
||||
VasEBoot_MOD_INIT(boottime)
|
||||
{
|
||||
cmd_boottime =
|
||||
grub_register_command ("boottime", grub_cmd_boottime,
|
||||
VasEBoot_register_command ("boottime", VasEBoot_cmd_boottime,
|
||||
0, N_("Show boot time statistics."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(boottime)
|
||||
VasEBoot_MOD_FINI(boottime)
|
||||
{
|
||||
grub_unregister_command (cmd_boottime);
|
||||
VasEBoot_unregister_command (cmd_boottime);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,62 +1,62 @@
|
|||
/* cacheinfo.c - disk cache statistics */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/disk.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/command.h>
|
||||
#include <VasEBoot/i18n.h>
|
||||
#include <VasEBoot/disk.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
VasEBoot_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_err_t
|
||||
grub_rescue_cmd_info (struct grub_command *cmd __attribute__ ((unused)),
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_rescue_cmd_info (struct VasEBoot_command *cmd __attribute__ ((unused)),
|
||||
int argc __attribute__ ((unused)),
|
||||
char *argv[] __attribute__ ((unused)))
|
||||
{
|
||||
unsigned long hits, misses;
|
||||
|
||||
grub_disk_cache_get_performance (&hits, &misses);
|
||||
VasEBoot_disk_cache_get_performance (&hits, &misses);
|
||||
if (hits + misses)
|
||||
{
|
||||
unsigned long ratio = hits * 10000 / (hits + misses);
|
||||
grub_printf ("(%lu.%lu%%)\n", ratio / 100, ratio % 100);
|
||||
grub_printf_ (N_("Disk cache statistics: hits = %lu (%lu.%02lu%%),"
|
||||
VasEBoot_printf ("(%lu.%lu%%)\n", ratio / 100, ratio % 100);
|
||||
VasEBoot_printf_ (N_("Disk cache statistics: hits = %lu (%lu.%02lu%%),"
|
||||
" misses = %lu\n"), ratio / 100, ratio % 100,
|
||||
hits, misses);
|
||||
}
|
||||
else
|
||||
grub_printf ("%s\n", _("No disk cache statistics available\n"));
|
||||
VasEBoot_printf ("%s\n", _("No disk cache statistics available\n"));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_command_t cmd_cacheinfo;
|
||||
static VasEBoot_command_t cmd_cacheinfo;
|
||||
|
||||
GRUB_MOD_INIT(cacheinfo)
|
||||
VasEBoot_MOD_INIT(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."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(cacheinfo)
|
||||
VasEBoot_MOD_FINI(cacheinfo)
|
||||
{
|
||||
grub_unregister_command (cmd_cacheinfo);
|
||||
VasEBoot_unregister_command (cmd_cacheinfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,51 +1,51 @@
|
|||
/* 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.
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/term.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/charset.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/file.h>
|
||||
#include <VasEBoot/disk.h>
|
||||
#include <VasEBoot/term.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/extcmd.h>
|
||||
#include <VasEBoot/i18n.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},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_cat (grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
static VasEBoot_err_t
|
||||
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;
|
||||
grub_file_t file;
|
||||
unsigned char buf[GRUB_DISK_SECTOR_SIZE];
|
||||
grub_ssize_t size;
|
||||
int key = GRUB_TERM_NO_KEY;
|
||||
grub_uint32_t code = 0;
|
||||
VasEBoot_file_t file;
|
||||
unsigned char buf[VasEBoot_DISK_SECTOR_SIZE];
|
||||
VasEBoot_ssize_t size;
|
||||
int key = VasEBoot_TERM_NO_KEY;
|
||||
VasEBoot_uint32_t code = 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 is_0d = 0;
|
||||
int j;
|
||||
|
|
@ -54,14 +54,14 @@ grub_cmd_cat (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
dos = 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)
|
||||
return grub_errno;
|
||||
return VasEBoot_errno;
|
||||
|
||||
while ((size = grub_file_read (file, buf, sizeof (buf))) > 0
|
||||
&& key != GRUB_TERM_ESC)
|
||||
while ((size = VasEBoot_file_read (file, buf, sizeof (buf))) > 0
|
||||
&& key != VasEBoot_TERM_ESC)
|
||||
{
|
||||
int i;
|
||||
|
||||
|
|
@ -71,39 +71,39 @@ grub_cmd_cat (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
|
||||
if (is_0d && buf[i] != '\n')
|
||||
{
|
||||
grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT);
|
||||
grub_printf ("<%x>", (int) '\r');
|
||||
grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);
|
||||
VasEBoot_setcolorstate (VasEBoot_TERM_COLOR_HIGHLIGHT);
|
||||
VasEBoot_printf ("<%x>", (int) '\r');
|
||||
VasEBoot_setcolorstate (VasEBoot_TERM_COLOR_STANDARD);
|
||||
}
|
||||
|
||||
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++)
|
||||
grub_printf ("<%x>", (unsigned int) utbuf[j]);
|
||||
VasEBoot_printf ("<%x>", (unsigned int) utbuf[j]);
|
||||
code = 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;
|
||||
count = 0;
|
||||
utcount = 0;
|
||||
grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);
|
||||
VasEBoot_setcolorstate (VasEBoot_TERM_COLOR_STANDARD);
|
||||
continue;
|
||||
}
|
||||
grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);
|
||||
VasEBoot_setcolorstate (VasEBoot_TERM_COLOR_STANDARD);
|
||||
utcount = 1;
|
||||
}
|
||||
if (count)
|
||||
continue;
|
||||
|
||||
if ((code >= 0xa1 || grub_isprint (code)
|
||||
|| grub_isspace (code)) && code != '\r')
|
||||
if ((code >= 0xa1 || VasEBoot_isprint (code)
|
||||
|| VasEBoot_isspace (code)) && code != '\r')
|
||||
{
|
||||
grub_printf ("%C", code);
|
||||
VasEBoot_printf ("%C", code);
|
||||
count = 0;
|
||||
code = 0;
|
||||
utcount = 0;
|
||||
|
|
@ -119,52 +119,52 @@ grub_cmd_cat (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
continue;
|
||||
}
|
||||
|
||||
grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT);
|
||||
VasEBoot_setcolorstate (VasEBoot_TERM_COLOR_HIGHLIGHT);
|
||||
for (j = 0; j < utcount; j++)
|
||||
grub_printf ("<%x>", (unsigned int) utbuf[j]);
|
||||
grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);
|
||||
VasEBoot_printf ("<%x>", (unsigned int) utbuf[j]);
|
||||
VasEBoot_setcolorstate (VasEBoot_TERM_COLOR_STANDARD);
|
||||
count = 0;
|
||||
code = 0;
|
||||
utcount = 0;
|
||||
}
|
||||
|
||||
do
|
||||
key = grub_getkey_noblock ();
|
||||
while (key != GRUB_TERM_ESC && key != GRUB_TERM_NO_KEY);
|
||||
key = VasEBoot_getkey_noblock ();
|
||||
while (key != VasEBoot_TERM_ESC && key != VasEBoot_TERM_NO_KEY);
|
||||
}
|
||||
|
||||
if (is_0d)
|
||||
{
|
||||
grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT);
|
||||
grub_printf ("<%x>", (unsigned int) '\r');
|
||||
grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);
|
||||
VasEBoot_setcolorstate (VasEBoot_TERM_COLOR_HIGHLIGHT);
|
||||
VasEBoot_printf ("<%x>", (unsigned int) '\r');
|
||||
VasEBoot_setcolorstate (VasEBoot_TERM_COLOR_STANDARD);
|
||||
}
|
||||
|
||||
if (utcount)
|
||||
{
|
||||
grub_setcolorstate (GRUB_TERM_COLOR_HIGHLIGHT);
|
||||
VasEBoot_setcolorstate (VasEBoot_TERM_COLOR_HIGHLIGHT);
|
||||
for (j = 0; j < utcount; j++)
|
||||
grub_printf ("<%x>", (unsigned int) utbuf[j]);
|
||||
grub_setcolorstate (GRUB_TERM_COLOR_STANDARD);
|
||||
VasEBoot_printf ("<%x>", (unsigned int) utbuf[j]);
|
||||
VasEBoot_setcolorstate (VasEBoot_TERM_COLOR_STANDARD);
|
||||
}
|
||||
|
||||
grub_xputs ("\n");
|
||||
grub_refresh ();
|
||||
grub_file_close (file);
|
||||
VasEBoot_xputs ("\n");
|
||||
VasEBoot_refresh ();
|
||||
VasEBoot_file_close (file);
|
||||
|
||||
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."),
|
||||
options);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(cat)
|
||||
VasEBoot_MOD_FINI(cat)
|
||||
{
|
||||
grub_unregister_extcmd (cmd);
|
||||
VasEBoot_unregister_extcmd (cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,65 +1,65 @@
|
|||
/* 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.
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/file.h>
|
||||
#include <VasEBoot/mm.h>
|
||||
#include <VasEBoot/command.h>
|
||||
#include <VasEBoot/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
VasEBoot_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
#define BUFFER_SIZE 512
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_cmp (grub_command_t cmd __attribute__ ((unused)),
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_cmp (VasEBoot_command_t cmd __attribute__ ((unused)),
|
||||
int argc, char **args)
|
||||
{
|
||||
grub_ssize_t rd1, rd2;
|
||||
grub_off_t pos;
|
||||
grub_file_t file1 = 0;
|
||||
grub_file_t file2 = 0;
|
||||
VasEBoot_ssize_t rd1, rd2;
|
||||
VasEBoot_off_t pos;
|
||||
VasEBoot_file_t file1 = 0;
|
||||
VasEBoot_file_t file2 = 0;
|
||||
char *buf1 = 0;
|
||||
char *buf2 = 0;
|
||||
|
||||
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]);
|
||||
|
||||
file1 = grub_file_open (args[0]);
|
||||
file2 = grub_file_open (args[1]);
|
||||
file1 = VasEBoot_file_open (args[0]);
|
||||
file2 = VasEBoot_file_open (args[1]);
|
||||
if (! file1 || ! file2)
|
||||
goto cleanup;
|
||||
|
||||
if (grub_file_size (file1) != grub_file_size (file2))
|
||||
grub_printf_ (N_("Files differ in size: %llu [%s], %llu [%s]\n"),
|
||||
(unsigned long long) grub_file_size (file1), args[0],
|
||||
(unsigned long long) grub_file_size (file2), args[1]);
|
||||
if (VasEBoot_file_size (file1) != VasEBoot_file_size (file2))
|
||||
VasEBoot_printf_ (N_("Files differ in size: %llu [%s], %llu [%s]\n"),
|
||||
(unsigned long long) VasEBoot_file_size (file1), args[0],
|
||||
(unsigned long long) VasEBoot_file_size (file2), args[1]);
|
||||
else
|
||||
{
|
||||
pos = 0;
|
||||
|
||||
buf1 = grub_malloc (BUFFER_SIZE);
|
||||
buf2 = grub_malloc (BUFFER_SIZE);
|
||||
buf1 = VasEBoot_malloc (BUFFER_SIZE);
|
||||
buf2 = VasEBoot_malloc (BUFFER_SIZE);
|
||||
|
||||
if (! buf1 || ! buf2)
|
||||
goto cleanup;
|
||||
|
|
@ -68,8 +68,8 @@ grub_cmd_cmp (grub_command_t cmd __attribute__ ((unused)),
|
|||
{
|
||||
int i;
|
||||
|
||||
rd1 = grub_file_read (file1, buf1, BUFFER_SIZE);
|
||||
rd2 = grub_file_read (file2, buf2, BUFFER_SIZE);
|
||||
rd1 = VasEBoot_file_read (file1, buf1, BUFFER_SIZE);
|
||||
rd2 = VasEBoot_file_read (file2, buf2, BUFFER_SIZE);
|
||||
|
||||
if (rd1 != rd2)
|
||||
goto cleanup;
|
||||
|
|
@ -78,7 +78,7 @@ grub_cmd_cmp (grub_command_t cmd __attribute__ ((unused)),
|
|||
{
|
||||
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],
|
||||
args[0], buf2[i], args[1]);
|
||||
goto cleanup;
|
||||
|
|
@ -90,30 +90,30 @@ grub_cmd_cmp (grub_command_t cmd __attribute__ ((unused)),
|
|||
while (rd2);
|
||||
|
||||
/* TRANSLATORS: it's always exactly 2 files. */
|
||||
grub_printf_ (N_("The files are identical.\n"));
|
||||
VasEBoot_printf_ (N_("The files are identical.\n"));
|
||||
}
|
||||
|
||||
cleanup:
|
||||
|
||||
grub_free (buf1);
|
||||
grub_free (buf2);
|
||||
VasEBoot_free (buf1);
|
||||
VasEBoot_free (buf2);
|
||||
if (file1)
|
||||
grub_file_close (file1);
|
||||
VasEBoot_file_close (file1);
|
||||
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."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(cmp)
|
||||
VasEBoot_MOD_FINI(cmp)
|
||||
{
|
||||
grub_unregister_command (cmd);
|
||||
VasEBoot_unregister_command (cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,98 +1,98 @@
|
|||
/* 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.
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/term.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/normal.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/term.h>
|
||||
#include <VasEBoot/env.h>
|
||||
#include <VasEBoot/normal.h>
|
||||
#include <VasEBoot/command.h>
|
||||
#include <VasEBoot/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
VasEBoot_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_source (grub_command_t cmd, int argc, char **args)
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_source (VasEBoot_command_t cmd, int argc, char **args)
|
||||
{
|
||||
int new_env, extractor;
|
||||
|
||||
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');
|
||||
new_env = (cmd->name[extractor ? sizeof ("extract_entries_") - 1 : 0] == 'c');
|
||||
|
||||
if (new_env)
|
||||
grub_cls ();
|
||||
VasEBoot_cls ();
|
||||
|
||||
if (new_env && !extractor)
|
||||
grub_env_context_open ();
|
||||
VasEBoot_env_context_open ();
|
||||
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)
|
||||
grub_env_context_close ();
|
||||
VasEBoot_env_context_close ();
|
||||
if (extractor)
|
||||
grub_env_extractor_close (!new_env);
|
||||
VasEBoot_env_extractor_close (!new_env);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_command_t cmd_configfile, cmd_source, cmd_dot;
|
||||
static grub_command_t cmd_extractor_source, cmd_extractor_configfile;
|
||||
static VasEBoot_command_t cmd_configfile, cmd_source, cmd_dot;
|
||||
static VasEBoot_command_t cmd_extractor_source, cmd_extractor_configfile;
|
||||
|
||||
GRUB_MOD_INIT(configfile)
|
||||
VasEBoot_MOD_INIT(configfile)
|
||||
{
|
||||
cmd_configfile =
|
||||
grub_register_command ("configfile", grub_cmd_source,
|
||||
VasEBoot_register_command ("configfile", VasEBoot_cmd_source,
|
||||
N_("FILE"), N_("Load another config file."));
|
||||
cmd_source =
|
||||
grub_register_command ("source", grub_cmd_source,
|
||||
VasEBoot_register_command ("source", VasEBoot_cmd_source,
|
||||
N_("FILE"),
|
||||
N_("Load another config file without changing context.")
|
||||
);
|
||||
|
||||
cmd_extractor_source =
|
||||
grub_register_command ("extract_entries_source", grub_cmd_source,
|
||||
VasEBoot_register_command ("extract_entries_source", VasEBoot_cmd_source,
|
||||
N_("FILE"),
|
||||
N_("Load another config file without changing context but take only menu entries.")
|
||||
);
|
||||
|
||||
cmd_extractor_configfile =
|
||||
grub_register_command ("extract_entries_configfile", grub_cmd_source,
|
||||
VasEBoot_register_command ("extract_entries_configfile", VasEBoot_cmd_source,
|
||||
N_("FILE"),
|
||||
N_("Load another config file but take only menu entries.")
|
||||
);
|
||||
|
||||
cmd_dot =
|
||||
grub_register_command (".", grub_cmd_source,
|
||||
VasEBoot_register_command (".", VasEBoot_cmd_source,
|
||||
N_("FILE"),
|
||||
N_("Load another config file without changing context.")
|
||||
);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(configfile)
|
||||
VasEBoot_MOD_FINI(configfile)
|
||||
{
|
||||
grub_unregister_command (cmd_configfile);
|
||||
grub_unregister_command (cmd_source);
|
||||
grub_unregister_command (cmd_extractor_configfile);
|
||||
grub_unregister_command (cmd_extractor_source);
|
||||
grub_unregister_command (cmd_dot);
|
||||
VasEBoot_unregister_command (cmd_configfile);
|
||||
VasEBoot_unregister_command (cmd_source);
|
||||
VasEBoot_unregister_command (cmd_extractor_configfile);
|
||||
VasEBoot_unregister_command (cmd_extractor_source);
|
||||
VasEBoot_unregister_command (cmd_dot);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,60 +1,60 @@
|
|||
/* date.c - command to display/set current datetime. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/datetime.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/err.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/datetime.h>
|
||||
#include <VasEBoot/command.h>
|
||||
#include <VasEBoot/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
VasEBoot_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
#define GRUB_DATETIME_SET_YEAR 1
|
||||
#define GRUB_DATETIME_SET_MONTH 2
|
||||
#define GRUB_DATETIME_SET_DAY 4
|
||||
#define GRUB_DATETIME_SET_HOUR 8
|
||||
#define GRUB_DATETIME_SET_MINUTE 16
|
||||
#define GRUB_DATETIME_SET_SECOND 32
|
||||
#define VasEBoot_DATETIME_SET_YEAR 1
|
||||
#define VasEBoot_DATETIME_SET_MONTH 2
|
||||
#define VasEBoot_DATETIME_SET_DAY 4
|
||||
#define VasEBoot_DATETIME_SET_HOUR 8
|
||||
#define VasEBoot_DATETIME_SET_MINUTE 16
|
||||
#define VasEBoot_DATETIME_SET_SECOND 32
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_date (grub_command_t cmd __attribute__ ((unused)),
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_date (VasEBoot_command_t cmd __attribute__ ((unused)),
|
||||
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 value[6], mask;
|
||||
|
||||
if (argc == 0)
|
||||
{
|
||||
if (grub_get_datetime (&datetime))
|
||||
return grub_errno;
|
||||
if (VasEBoot_get_datetime (&datetime))
|
||||
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.hour, datetime.minute, datetime.second,
|
||||
grub_get_weekday_name (&datetime));
|
||||
VasEBoot_get_weekday_name (&datetime));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
grub_memset (&value, 0, sizeof (value));
|
||||
VasEBoot_memset (&value, 0, sizeof (value));
|
||||
mask = 0;
|
||||
|
||||
for (; argc; argc--, args++)
|
||||
|
|
@ -63,7 +63,7 @@ grub_cmd_date (grub_command_t cmd __attribute__ ((unused)),
|
|||
int m1, ofs, n, cur_mask;
|
||||
|
||||
p = args[0];
|
||||
m1 = grub_strtoul (p, &p, 10);
|
||||
m1 = VasEBoot_strtoul (p, &p, 10);
|
||||
|
||||
c = *p;
|
||||
if (c == '-')
|
||||
|
|
@ -82,7 +82,7 @@ grub_cmd_date (grub_command_t cmd __attribute__ ((unused)),
|
|||
if (*p != c)
|
||||
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));
|
||||
}
|
||||
|
||||
|
|
@ -105,44 +105,44 @@ grub_cmd_date (grub_command_t cmd __attribute__ ((unused)),
|
|||
mask |= cur_mask;
|
||||
}
|
||||
|
||||
if (grub_get_datetime (&datetime))
|
||||
return grub_errno;
|
||||
if (VasEBoot_get_datetime (&datetime))
|
||||
return VasEBoot_errno;
|
||||
|
||||
if (mask & GRUB_DATETIME_SET_YEAR)
|
||||
if (mask & VasEBoot_DATETIME_SET_YEAR)
|
||||
datetime.year = value[0];
|
||||
|
||||
if (mask & GRUB_DATETIME_SET_MONTH)
|
||||
if (mask & VasEBoot_DATETIME_SET_MONTH)
|
||||
datetime.month = value[1];
|
||||
|
||||
if (mask & GRUB_DATETIME_SET_DAY)
|
||||
if (mask & VasEBoot_DATETIME_SET_DAY)
|
||||
datetime.day = value[2];
|
||||
|
||||
if (mask & GRUB_DATETIME_SET_HOUR)
|
||||
if (mask & VasEBoot_DATETIME_SET_HOUR)
|
||||
datetime.hour = value[3];
|
||||
|
||||
if (mask & GRUB_DATETIME_SET_MINUTE)
|
||||
if (mask & VasEBoot_DATETIME_SET_MINUTE)
|
||||
datetime.minute = value[4];
|
||||
|
||||
if (mask & GRUB_DATETIME_SET_SECOND)
|
||||
if (mask & VasEBoot_DATETIME_SET_SECOND)
|
||||
datetime.second = value[5];
|
||||
|
||||
return grub_set_datetime (&datetime);
|
||||
return VasEBoot_set_datetime (&datetime);
|
||||
|
||||
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 =
|
||||
grub_register_command ("date", grub_cmd_date,
|
||||
VasEBoot_register_command ("date", VasEBoot_cmd_date,
|
||||
N_("[[year-]month-day] [hour:minute[:second]]"),
|
||||
N_("Display/set current datetime."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(date)
|
||||
VasEBoot_MOD_FINI(date)
|
||||
{
|
||||
grub_unregister_command (cmd);
|
||||
VasEBoot_unregister_command (cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,41 +1,41 @@
|
|||
/* 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.
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/term.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/extcmd.h>
|
||||
#include <VasEBoot/i18n.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, 'e', 0, N_("Enable interpretation of backslash escapes."), 0, 0},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_echo (grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
static VasEBoot_err_t
|
||||
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 i;
|
||||
|
||||
|
|
@ -47,12 +47,12 @@ grub_cmd_echo (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
{
|
||||
char *arg = *args;
|
||||
/* 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;
|
||||
args++;
|
||||
|
||||
if (!unescaped)
|
||||
return grub_errno;
|
||||
return VasEBoot_errno;
|
||||
|
||||
while (*arg)
|
||||
{
|
||||
|
|
@ -108,34 +108,34 @@ grub_cmd_echo (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
}
|
||||
|
||||
*p = '\0';
|
||||
grub_xputs (unescaped);
|
||||
grub_free (unescaped);
|
||||
VasEBoot_xputs (unescaped);
|
||||
VasEBoot_free (unescaped);
|
||||
|
||||
/* If another argument follows, insert a space. */
|
||||
if (i != argc - 1)
|
||||
grub_printf (" " );
|
||||
VasEBoot_printf (" " );
|
||||
}
|
||||
|
||||
if (newline)
|
||||
grub_printf ("\n");
|
||||
VasEBoot_printf ("\n");
|
||||
|
||||
grub_refresh ();
|
||||
VasEBoot_refresh ();
|
||||
|
||||
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,
|
||||
GRUB_COMMAND_ACCEPT_DASH
|
||||
| GRUB_COMMAND_OPTIONS_AT_START,
|
||||
cmd = VasEBoot_register_extcmd ("echo", VasEBoot_cmd_echo,
|
||||
VasEBoot_COMMAND_ACCEPT_DASH
|
||||
| VasEBoot_COMMAND_OPTIONS_AT_START,
|
||||
N_("[-e|-n] STRING"), N_("Display a line of text."),
|
||||
options);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(echo)
|
||||
VasEBoot_MOD_FINI(echo)
|
||||
{
|
||||
grub_unregister_extcmd (cmd);
|
||||
VasEBoot_unregister_extcmd (cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,90 +1,90 @@
|
|||
/* fwsetup.c - Reboot into firmware setup menu. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/efi/api.h>
|
||||
#include <grub/efi/efi.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <VasEBoot/types.h>
|
||||
#include <VasEBoot/mm.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/efi/api.h>
|
||||
#include <VasEBoot/efi/efi.h>
|
||||
#include <VasEBoot/command.h>
|
||||
#include <VasEBoot/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
VasEBoot_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_fwsetup (grub_command_t cmd __attribute__ ((unused)),
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_fwsetup (VasEBoot_command_t cmd __attribute__ ((unused)),
|
||||
int argc __attribute__ ((unused)),
|
||||
char **args __attribute__ ((unused)))
|
||||
{
|
||||
grub_efi_uint64_t *old_os_indications;
|
||||
grub_efi_uint64_t os_indications = GRUB_EFI_OS_INDICATIONS_BOOT_TO_FW_UI;
|
||||
grub_err_t status;
|
||||
grub_size_t oi_size;
|
||||
grub_efi_guid_t global = GRUB_EFI_GLOBAL_VARIABLE_GUID;
|
||||
VasEBoot_efi_uint64_t *old_os_indications;
|
||||
VasEBoot_efi_uint64_t os_indications = VasEBoot_EFI_OS_INDICATIONS_BOOT_TO_FW_UI;
|
||||
VasEBoot_err_t status;
|
||||
VasEBoot_size_t oi_size;
|
||||
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);
|
||||
|
||||
if (old_os_indications != NULL && oi_size == sizeof (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));
|
||||
if (status != GRUB_ERR_NONE)
|
||||
if (status != VasEBoot_ERR_NONE)
|
||||
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)
|
||||
{
|
||||
grub_efi_uint64_t *os_indications_supported = NULL;
|
||||
grub_size_t oi_size = 0;
|
||||
grub_efi_guid_t global = GRUB_EFI_GLOBAL_VARIABLE_GUID;
|
||||
VasEBoot_efi_uint64_t *os_indications_supported = NULL;
|
||||
VasEBoot_size_t oi_size = 0;
|
||||
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);
|
||||
|
||||
if (!os_indications_supported)
|
||||
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 0;
|
||||
}
|
||||
|
||||
GRUB_MOD_INIT (efifwsetup)
|
||||
VasEBoot_MOD_INIT (efifwsetup)
|
||||
{
|
||||
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."));
|
||||
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI (efifwsetup)
|
||||
VasEBoot_MOD_FINI (efifwsetup)
|
||||
{
|
||||
if (cmd)
|
||||
grub_unregister_command (cmd);
|
||||
VasEBoot_unregister_command (cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,39 +1,39 @@
|
|||
/* fixvideo.c - fix video problem in efi */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/pci.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/mm.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/file.h>
|
||||
#include <VasEBoot/pci.h>
|
||||
#include <VasEBoot/command.h>
|
||||
#include <VasEBoot/i18n.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;
|
||||
grub_uint32_t pci_id;
|
||||
grub_uint32_t mmio_bar;
|
||||
grub_uint32_t mmio_reg;
|
||||
grub_uint32_t mmio_old;
|
||||
VasEBoot_uint32_t pci_id;
|
||||
VasEBoot_uint32_t mmio_bar;
|
||||
VasEBoot_uint32_t mmio_reg;
|
||||
VasEBoot_uint32_t mmio_old;
|
||||
} video_patches[] =
|
||||
{
|
||||
{"Intel 945GM", 0x27a28086, 0, 0x71184, 0x1000000}, /* DSPBBASE */
|
||||
|
|
@ -42,40 +42,40 @@ static struct grub_video_patch
|
|||
};
|
||||
|
||||
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)))
|
||||
{
|
||||
grub_pci_address_t addr;
|
||||
VasEBoot_pci_address_t addr;
|
||||
|
||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_CLASS);
|
||||
if (grub_pci_read_byte (addr + 3) == 0x3)
|
||||
addr = VasEBoot_pci_make_address (dev, VasEBoot_PCI_REG_CLASS);
|
||||
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)
|
||||
{
|
||||
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;
|
||||
base = grub_pci_read (addr);
|
||||
if ((! base) || (base & GRUB_PCI_ADDR_SPACE_IO) ||
|
||||
(base & GRUB_PCI_ADDR_MEM_PREFETCH))
|
||||
grub_dprintf ("fixvideo", "Invalid MMIO bar %d\n", p->mmio_bar);
|
||||
base = VasEBoot_pci_read (addr);
|
||||
if ((! base) || (base & VasEBoot_PCI_ADDR_SPACE_IO) ||
|
||||
(base & VasEBoot_PCI_ADDR_MEM_PREFETCH))
|
||||
VasEBoot_dprintf ("fixvideo", "Invalid MMIO bar %d\n", p->mmio_bar);
|
||||
else
|
||||
{
|
||||
base &= GRUB_PCI_ADDR_MEM_MASK;
|
||||
base &= VasEBoot_PCI_ADDR_MEM_MASK;
|
||||
base += p->mmio_reg;
|
||||
|
||||
if (*((volatile grub_uint32_t *) base) != p->mmio_old)
|
||||
grub_dprintf ("fixvideo", "Old value doesn't match\n");
|
||||
if (*((volatile VasEBoot_uint32_t *) base) != p->mmio_old)
|
||||
VasEBoot_dprintf ("fixvideo", "Old value doesn't match\n");
|
||||
else
|
||||
{
|
||||
*((volatile grub_uint32_t *) base) = 0;
|
||||
if (*((volatile grub_uint32_t *) base))
|
||||
grub_dprintf ("fixvideo", "Setting MMIO fails\n");
|
||||
*((volatile VasEBoot_uint32_t *) base) = 0;
|
||||
if (*((volatile VasEBoot_uint32_t *) base))
|
||||
VasEBoot_dprintf ("fixvideo", "Setting MMIO fails\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -84,31 +84,31 @@ scan_card (grub_pci_device_t dev, grub_pci_id_t pciid,
|
|||
p++;
|
||||
}
|
||||
|
||||
grub_dprintf ("fixvideo", "Unknown graphic card: %x\n", pciid);
|
||||
VasEBoot_dprintf ("fixvideo", "Unknown graphic card: %x\n", pciid);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_fixvideo (grub_command_t cmd __attribute__ ((unused)),
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_fixvideo (VasEBoot_command_t cmd __attribute__ ((unused)),
|
||||
int argc __attribute__ ((unused)),
|
||||
char *argv[] __attribute__ ((unused)))
|
||||
{
|
||||
grub_pci_iterate (scan_card, NULL);
|
||||
VasEBoot_pci_iterate (scan_card, NULL);
|
||||
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."));
|
||||
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(fixvideo)
|
||||
VasEBoot_MOD_FINI(fixvideo)
|
||||
{
|
||||
grub_unregister_command (cmd_fixvideo);
|
||||
VasEBoot_unregister_command (cmd_fixvideo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,35 +1,35 @@
|
|||
/* getenv.c - retrieve EFI variables. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* Copyright (C) 2009 Free Software Foundation, 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/efi/efi.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
#include <VasEBoot/efi/efi.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/env.h>
|
||||
#include <VasEBoot/err.h>
|
||||
#include <VasEBoot/extcmd.h>
|
||||
#include <VasEBoot/i18n.h>
|
||||
#include <VasEBoot/misc.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,
|
||||
N_("Environment variable to query"),
|
||||
N_("VARNAME"), ARG_TYPE_STRING},
|
||||
|
|
@ -49,105 +49,105 @@ enum options_getenv
|
|||
GETENV_BINARY,
|
||||
};
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_getenv (grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
static VasEBoot_err_t
|
||||
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;
|
||||
grub_size_t datasize;
|
||||
grub_efi_guid_t efi_var_guid;
|
||||
grub_efi_boolean_t binary = state[GETENV_BINARY].set;
|
||||
VasEBoot_size_t datasize;
|
||||
VasEBoot_efi_guid_t efi_var_guid;
|
||||
VasEBoot_efi_boolean_t binary = state[GETENV_BINARY].set;
|
||||
unsigned int i;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
if (argc != 1)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("unexpected arguments"));
|
||||
VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, N_("unexpected arguments"));
|
||||
goto done;
|
||||
}
|
||||
|
||||
envvar = state[GETENV_VAR_NAME].arg;
|
||||
guid = state[GETENV_VAR_GUID].arg;
|
||||
|
||||
if (grub_strlen(guid) != 36 ||
|
||||
if (VasEBoot_strlen(guid) != 36 ||
|
||||
guid[8] != '-' ||
|
||||
guid[13] != '-' ||
|
||||
guid[18] != '-' ||
|
||||
guid[23] != '-')
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("invalid GUID"));
|
||||
VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, N_("invalid GUID"));
|
||||
goto done;
|
||||
}
|
||||
|
||||
/* Forgive me father for I have sinned */
|
||||
guid[8] = 0;
|
||||
efi_var_guid.data1 = grub_strtoul(guid, NULL, 16);
|
||||
efi_var_guid.data1 = VasEBoot_strtoul(guid, NULL, 16);
|
||||
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;
|
||||
efi_var_guid.data3 = grub_strtoul(guid + 14, NULL, 16);
|
||||
efi_var_guid.data4[7] = grub_strtoul(guid + 34, NULL, 16);
|
||||
efi_var_guid.data3 = VasEBoot_strtoul(guid + 14, NULL, 16);
|
||||
efi_var_guid.data4[7] = VasEBoot_strtoul(guid + 34, NULL, 16);
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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;
|
||||
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)
|
||||
{
|
||||
grub_error (GRUB_ERR_FILE_NOT_FOUND, N_("No such variable"));
|
||||
VasEBoot_error (VasEBoot_ERR_FILE_NOT_FOUND, N_("No such variable"));
|
||||
goto done;
|
||||
}
|
||||
|
||||
if (binary)
|
||||
{
|
||||
bindata = grub_zalloc(datasize * 2 + 1);
|
||||
bindata = VasEBoot_zalloc(datasize * 2 + 1);
|
||||
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;
|
||||
}
|
||||
else if (grub_env_set (args[0], data))
|
||||
else if (VasEBoot_env_set (args[0], data))
|
||||
{
|
||||
goto done;
|
||||
}
|
||||
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
VasEBoot_errno = VasEBoot_ERR_NONE;
|
||||
|
||||
done:
|
||||
grub_free(bindata);
|
||||
grub_free(data);
|
||||
return grub_errno;
|
||||
VasEBoot_free(bindata);
|
||||
VasEBoot_free(data);
|
||||
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_("Read a firmware environment variable"),
|
||||
options_getenv);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(getenv)
|
||||
VasEBoot_MOD_FINI(getenv)
|
||||
{
|
||||
grub_unregister_extcmd (cmd_getenv);
|
||||
VasEBoot_unregister_extcmd (cmd_getenv);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,36 +1,36 @@
|
|||
/* loadbios.c - command to load a bios dump */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/efi/efi.h>
|
||||
#include <grub/pci.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/file.h>
|
||||
#include <VasEBoot/efi/efi.h>
|
||||
#include <VasEBoot/pci.h>
|
||||
#include <VasEBoot/command.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 grub_efi_guid_t acpi2_guid = GRUB_EFI_ACPI_20_TABLE_GUID;
|
||||
static grub_efi_guid_t smbios_guid = GRUB_EFI_SMBIOS_TABLE_GUID;
|
||||
static grub_efi_guid_t smbios3_guid = GRUB_EFI_SMBIOS3_TABLE_GUID;
|
||||
static VasEBoot_efi_guid_t acpi_guid = VasEBoot_EFI_ACPI_TABLE_GUID;
|
||||
static VasEBoot_efi_guid_t acpi2_guid = VasEBoot_EFI_ACPI_20_TABLE_GUID;
|
||||
static VasEBoot_efi_guid_t smbios_guid = VasEBoot_EFI_SMBIOS_TABLE_GUID;
|
||||
static VasEBoot_efi_guid_t smbios3_guid = VasEBoot_EFI_SMBIOS3_TABLE_GUID;
|
||||
|
||||
#define EBDA_SEG_ADDR 0x40e
|
||||
#define LOW_MEM_ADDR 0x413
|
||||
|
|
@ -43,32 +43,32 @@ static grub_efi_guid_t smbios3_guid = GRUB_EFI_SMBIOS3_TABLE_GUID;
|
|||
static int
|
||||
enable_rom_area (void)
|
||||
{
|
||||
grub_pci_address_t addr;
|
||||
grub_uint32_t *rom_ptr;
|
||||
grub_pci_device_t dev = { .bus = 0, .device = 0, .function = 0};
|
||||
VasEBoot_pci_address_t addr;
|
||||
VasEBoot_uint32_t *rom_ptr;
|
||||
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)
|
||||
{
|
||||
grub_puts_ (N_("ROM image is present."));
|
||||
VasEBoot_puts_ (N_("ROM image is present."));
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* FIXME: should be macroified. */
|
||||
addr = grub_pci_make_address (dev, 144);
|
||||
grub_pci_write_byte (addr++, 0x30);
|
||||
grub_pci_write_byte (addr++, 0x33);
|
||||
grub_pci_write_byte (addr++, 0x33);
|
||||
grub_pci_write_byte (addr++, 0x33);
|
||||
grub_pci_write_byte (addr++, 0x33);
|
||||
grub_pci_write_byte (addr++, 0x33);
|
||||
grub_pci_write_byte (addr++, 0x33);
|
||||
grub_pci_write_byte (addr, 0);
|
||||
addr = VasEBoot_pci_make_address (dev, 144);
|
||||
VasEBoot_pci_write_byte (addr++, 0x30);
|
||||
VasEBoot_pci_write_byte (addr++, 0x33);
|
||||
VasEBoot_pci_write_byte (addr++, 0x33);
|
||||
VasEBoot_pci_write_byte (addr++, 0x33);
|
||||
VasEBoot_pci_write_byte (addr++, 0x33);
|
||||
VasEBoot_pci_write_byte (addr++, 0x33);
|
||||
VasEBoot_pci_write_byte (addr++, 0x33);
|
||||
VasEBoot_pci_write_byte (addr, 0);
|
||||
|
||||
*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;
|
||||
}
|
||||
|
||||
|
|
@ -78,16 +78,16 @@ enable_rom_area (void)
|
|||
static void
|
||||
lock_rom_area (void)
|
||||
{
|
||||
grub_pci_address_t addr;
|
||||
grub_pci_device_t dev = { .bus = 0, .device = 0, .function = 0};
|
||||
VasEBoot_pci_address_t addr;
|
||||
VasEBoot_pci_device_t dev = { .bus = 0, .device = 0, .function = 0};
|
||||
|
||||
/* FIXME: should be macroified. */
|
||||
addr = grub_pci_make_address (dev, 144);
|
||||
grub_pci_write_byte (addr++, 0x10);
|
||||
grub_pci_write_byte (addr++, 0x11);
|
||||
grub_pci_write_byte (addr++, 0x11);
|
||||
grub_pci_write_byte (addr++, 0x11);
|
||||
grub_pci_write_byte (addr, 0x11);
|
||||
addr = VasEBoot_pci_make_address (dev, 144);
|
||||
VasEBoot_pci_write_byte (addr++, 0x10);
|
||||
VasEBoot_pci_write_byte (addr++, 0x11);
|
||||
VasEBoot_pci_write_byte (addr++, 0x11);
|
||||
VasEBoot_pci_write_byte (addr++, 0x11);
|
||||
VasEBoot_pci_write_byte (addr, 0x11);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
@ -95,66 +95,66 @@ fake_bios_data (int use_rom)
|
|||
{
|
||||
unsigned i;
|
||||
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;
|
||||
low_mem_ptr = (grub_uint16_t *) LOW_MEM_ADDR;
|
||||
ebda_seg_ptr = (VasEBoot_uint16_t *) EBDA_SEG_ADDR;
|
||||
low_mem_ptr = (VasEBoot_uint16_t *) LOW_MEM_ADDR;
|
||||
if ((*ebda_seg_ptr) || (*low_mem_ptr))
|
||||
return;
|
||||
|
||||
acpi = 0;
|
||||
smbios = 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 =
|
||||
&grub_efi_system_table->configuration_table[i].vendor_guid;
|
||||
VasEBoot_efi_packed_guid_t *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;
|
||||
grub_dprintf ("efi", "ACPI2: %p\n", acpi);
|
||||
acpi = VasEBoot_efi_system_table->configuration_table[i].vendor_table;
|
||||
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;
|
||||
|
||||
t = grub_efi_system_table->configuration_table[i].vendor_table;
|
||||
t = VasEBoot_efi_system_table->configuration_table[i].vendor_table;
|
||||
if (! acpi)
|
||||
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;
|
||||
grub_dprintf ("efi", "SMBIOS: %p\n", smbios);
|
||||
smbios = VasEBoot_efi_system_table->configuration_table[i].vendor_table;
|
||||
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;
|
||||
grub_dprintf ("efi", "SMBIOS3: %p\n", smbios3);
|
||||
smbios3 = VasEBoot_efi_system_table->configuration_table[i].vendor_table;
|
||||
VasEBoot_dprintf ("efi", "SMBIOS3: %p\n", smbios3);
|
||||
}
|
||||
}
|
||||
|
||||
*ebda_seg_ptr = FAKE_EBDA_SEG;
|
||||
*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)
|
||||
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 (smbios)
|
||||
grub_memcpy ((char *) SBIOS_ADDR, (char *) smbios, 31);
|
||||
VasEBoot_memcpy ((char *) SBIOS_ADDR, (char *) smbios, 31);
|
||||
if (smbios3)
|
||||
grub_memcpy ((char *) SBIOS_ADDR + 32, (char *) smbios3, 24);
|
||||
VasEBoot_memcpy ((char *) SBIOS_ADDR + 32, (char *) smbios3, 24);
|
||||
}
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_fakebios (struct grub_command *cmd __attribute__ ((unused)),
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_fakebios (struct VasEBoot_command *cmd __attribute__ ((unused)),
|
||||
int argc __attribute__ ((unused)),
|
||||
char *argv[] __attribute__ ((unused)))
|
||||
{
|
||||
|
|
@ -169,66 +169,66 @@ grub_cmd_fakebios (struct grub_command *cmd __attribute__ ((unused)),
|
|||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_loadbios (grub_command_t cmd __attribute__ ((unused)),
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_loadbios (VasEBoot_command_t cmd __attribute__ ((unused)),
|
||||
int argc, char *argv[])
|
||||
{
|
||||
grub_file_t file;
|
||||
VasEBoot_file_t file;
|
||||
int size;
|
||||
|
||||
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)
|
||||
{
|
||||
file = grub_file_open (argv[1]);
|
||||
file = VasEBoot_file_open (argv[1]);
|
||||
if (! file)
|
||||
return grub_errno;
|
||||
return VasEBoot_errno;
|
||||
|
||||
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
|
||||
grub_file_read (file, (void *) 0x40, 4);
|
||||
VasEBoot_file_read (file, (void *) 0x40, 4);
|
||||
|
||||
grub_file_close (file);
|
||||
if (grub_errno)
|
||||
return grub_errno;
|
||||
VasEBoot_file_close (file);
|
||||
if (VasEBoot_errno)
|
||||
return VasEBoot_errno;
|
||||
}
|
||||
|
||||
file = grub_file_open (argv[0]);
|
||||
file = VasEBoot_file_open (argv[0]);
|
||||
if (! file)
|
||||
return grub_errno;
|
||||
return VasEBoot_errno;
|
||||
|
||||
size = file->size;
|
||||
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 ())
|
||||
{
|
||||
grub_file_read (file, (void *) VBIOS_ADDR, size);
|
||||
VasEBoot_file_read (file, (void *) VBIOS_ADDR, size);
|
||||
fake_bios_data (size <= 0x40000);
|
||||
lock_rom_area ();
|
||||
}
|
||||
|
||||
grub_file_close (file);
|
||||
return grub_errno;
|
||||
VasEBoot_file_close (file);
|
||||
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"
|
||||
" backward compatibility with"
|
||||
" 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_("Load BIOS dump."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(loadbios)
|
||||
VasEBoot_MOD_FINI(loadbios)
|
||||
{
|
||||
grub_unregister_command (cmd_fakebios);
|
||||
grub_unregister_command (cmd_loadbios);
|
||||
VasEBoot_unregister_command (cmd_fakebios);
|
||||
VasEBoot_unregister_command (cmd_loadbios);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,126 +1,126 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <grub/types.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/efi/api.h>
|
||||
#include <grub/efi/edid.h>
|
||||
#include <grub/efi/pci.h>
|
||||
#include <grub/efi/efi.h>
|
||||
#include <grub/efi/uga_draw.h>
|
||||
#include <grub/efi/graphics_output.h>
|
||||
#include <grub/efi/console_control.h>
|
||||
#include <grub/command.h>
|
||||
#include <VasEBoot/types.h>
|
||||
#include <VasEBoot/mm.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/efi/api.h>
|
||||
#include <VasEBoot/efi/edid.h>
|
||||
#include <VasEBoot/efi/pci.h>
|
||||
#include <VasEBoot/efi/efi.h>
|
||||
#include <VasEBoot/efi/uga_draw.h>
|
||||
#include <VasEBoot/efi/graphics_output.h>
|
||||
#include <VasEBoot/efi/console_control.h>
|
||||
#include <VasEBoot/command.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
VasEBoot_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
struct known_protocol
|
||||
{
|
||||
grub_efi_guid_t guid;
|
||||
VasEBoot_efi_guid_t guid;
|
||||
const char *name;
|
||||
} known_protocols[] =
|
||||
{
|
||||
{ GRUB_EFI_DISK_IO_GUID, "disk" },
|
||||
{ GRUB_EFI_BLOCK_IO_GUID, "block" },
|
||||
{ GRUB_EFI_SERIAL_IO_GUID, "serial" },
|
||||
{ GRUB_EFI_SIMPLE_NETWORK_GUID, "network" },
|
||||
{ GRUB_EFI_PXE_GUID, "pxe" },
|
||||
{ GRUB_EFI_DEVICE_PATH_GUID, "device path" },
|
||||
{ GRUB_EFI_PCI_IO_GUID, "PCI" },
|
||||
{ GRUB_EFI_PCI_ROOT_IO_GUID, "PCI root" },
|
||||
{ GRUB_EFI_EDID_ACTIVE_GUID, "active EDID" },
|
||||
{ GRUB_EFI_EDID_DISCOVERED_GUID, "discovered EDID" },
|
||||
{ GRUB_EFI_EDID_OVERRIDE_GUID, "override EDID" },
|
||||
{ GRUB_EFI_GOP_GUID, "GOP" },
|
||||
{ GRUB_EFI_UGA_DRAW_GUID, "UGA draw" },
|
||||
{ GRUB_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID, "simple text output" },
|
||||
{ GRUB_EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID, "simple text input" },
|
||||
{ GRUB_EFI_SIMPLE_POINTER_PROTOCOL_GUID, "simple pointer" },
|
||||
{ GRUB_EFI_CONSOLE_CONTROL_GUID, "console control" },
|
||||
{ GRUB_EFI_ABSOLUTE_POINTER_PROTOCOL_GUID, "absolute pointer" },
|
||||
{ GRUB_EFI_DRIVER_BINDING_PROTOCOL_GUID, "EFI driver binding" },
|
||||
{ GRUB_EFI_LOAD_FILE_PROTOCOL_GUID, "load file" },
|
||||
{ GRUB_EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID, "simple FS" },
|
||||
{ GRUB_EFI_TAPE_IO_PROTOCOL_GUID, "tape I/O" },
|
||||
{ GRUB_EFI_UNICODE_COLLATION_PROTOCOL_GUID, "unicode collation" },
|
||||
{ GRUB_EFI_SCSI_IO_PROTOCOL_GUID, "SCSI I/O" },
|
||||
{ GRUB_EFI_USB2_HC_PROTOCOL_GUID, "USB host" },
|
||||
{ GRUB_EFI_DEBUG_SUPPORT_PROTOCOL_GUID, "debug support" },
|
||||
{ GRUB_EFI_DEBUGPORT_PROTOCOL_GUID, "debug port" },
|
||||
{ GRUB_EFI_DECOMPRESS_PROTOCOL_GUID, "decompress" },
|
||||
{ GRUB_EFI_LOADED_IMAGE_PROTOCOL_GUID, "loaded image" },
|
||||
{ GRUB_EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID, "device path to text" },
|
||||
{ GRUB_EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID, "device path utilities" },
|
||||
{ GRUB_EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID, "device path from text" },
|
||||
{ GRUB_EFI_HII_CONFIG_ROUTING_PROTOCOL_GUID, "HII config routing" },
|
||||
{ GRUB_EFI_HII_DATABASE_PROTOCOL_GUID, "HII database" },
|
||||
{ GRUB_EFI_HII_STRING_PROTOCOL_GUID, "HII string" },
|
||||
{ GRUB_EFI_HII_IMAGE_PROTOCOL_GUID, "HII image" },
|
||||
{ GRUB_EFI_HII_FONT_PROTOCOL_GUID, "HII font" },
|
||||
{ GRUB_EFI_COMPONENT_NAME2_PROTOCOL_GUID, "component name 2" },
|
||||
{ GRUB_EFI_HII_CONFIGURATION_ACCESS_PROTOCOL_GUID,
|
||||
{ VasEBoot_EFI_DISK_IO_GUID, "disk" },
|
||||
{ VasEBoot_EFI_BLOCK_IO_GUID, "block" },
|
||||
{ VasEBoot_EFI_SERIAL_IO_GUID, "serial" },
|
||||
{ VasEBoot_EFI_SIMPLE_NETWORK_GUID, "network" },
|
||||
{ VasEBoot_EFI_PXE_GUID, "pxe" },
|
||||
{ VasEBoot_EFI_DEVICE_PATH_GUID, "device path" },
|
||||
{ VasEBoot_EFI_PCI_IO_GUID, "PCI" },
|
||||
{ VasEBoot_EFI_PCI_ROOT_IO_GUID, "PCI root" },
|
||||
{ VasEBoot_EFI_EDID_ACTIVE_GUID, "active EDID" },
|
||||
{ VasEBoot_EFI_EDID_DISCOVERED_GUID, "discovered EDID" },
|
||||
{ VasEBoot_EFI_EDID_OVERRIDE_GUID, "override EDID" },
|
||||
{ VasEBoot_EFI_GOP_GUID, "GOP" },
|
||||
{ VasEBoot_EFI_UGA_DRAW_GUID, "UGA draw" },
|
||||
{ VasEBoot_EFI_SIMPLE_TEXT_OUTPUT_PROTOCOL_GUID, "simple text output" },
|
||||
{ VasEBoot_EFI_SIMPLE_TEXT_INPUT_PROTOCOL_GUID, "simple text input" },
|
||||
{ VasEBoot_EFI_SIMPLE_POINTER_PROTOCOL_GUID, "simple pointer" },
|
||||
{ VasEBoot_EFI_CONSOLE_CONTROL_GUID, "console control" },
|
||||
{ VasEBoot_EFI_ABSOLUTE_POINTER_PROTOCOL_GUID, "absolute pointer" },
|
||||
{ VasEBoot_EFI_DRIVER_BINDING_PROTOCOL_GUID, "EFI driver binding" },
|
||||
{ VasEBoot_EFI_LOAD_FILE_PROTOCOL_GUID, "load file" },
|
||||
{ VasEBoot_EFI_SIMPLE_FILE_SYSTEM_PROTOCOL_GUID, "simple FS" },
|
||||
{ VasEBoot_EFI_TAPE_IO_PROTOCOL_GUID, "tape I/O" },
|
||||
{ VasEBoot_EFI_UNICODE_COLLATION_PROTOCOL_GUID, "unicode collation" },
|
||||
{ VasEBoot_EFI_SCSI_IO_PROTOCOL_GUID, "SCSI I/O" },
|
||||
{ VasEBoot_EFI_USB2_HC_PROTOCOL_GUID, "USB host" },
|
||||
{ VasEBoot_EFI_DEBUG_SUPPORT_PROTOCOL_GUID, "debug support" },
|
||||
{ VasEBoot_EFI_DEBUGPORT_PROTOCOL_GUID, "debug port" },
|
||||
{ VasEBoot_EFI_DECOMPRESS_PROTOCOL_GUID, "decompress" },
|
||||
{ VasEBoot_EFI_LOADED_IMAGE_PROTOCOL_GUID, "loaded image" },
|
||||
{ VasEBoot_EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID, "device path to text" },
|
||||
{ VasEBoot_EFI_DEVICE_PATH_UTILITIES_PROTOCOL_GUID, "device path utilities" },
|
||||
{ VasEBoot_EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID, "device path from text" },
|
||||
{ VasEBoot_EFI_HII_CONFIG_ROUTING_PROTOCOL_GUID, "HII config routing" },
|
||||
{ VasEBoot_EFI_HII_DATABASE_PROTOCOL_GUID, "HII database" },
|
||||
{ VasEBoot_EFI_HII_STRING_PROTOCOL_GUID, "HII string" },
|
||||
{ VasEBoot_EFI_HII_IMAGE_PROTOCOL_GUID, "HII image" },
|
||||
{ VasEBoot_EFI_HII_FONT_PROTOCOL_GUID, "HII font" },
|
||||
{ VasEBoot_EFI_COMPONENT_NAME2_PROTOCOL_GUID, "component name 2" },
|
||||
{ VasEBoot_EFI_HII_CONFIGURATION_ACCESS_PROTOCOL_GUID,
|
||||
"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
|
||||
grub_cmd_lsefi (grub_command_t cmd __attribute__ ((unused)),
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_lsefi (VasEBoot_command_t cmd __attribute__ ((unused)),
|
||||
int argc __attribute__ ((unused)),
|
||||
char **args __attribute__ ((unused)))
|
||||
{
|
||||
grub_efi_handle_t *handles;
|
||||
grub_efi_uintn_t num_handles;
|
||||
VasEBoot_efi_handle_t *handles;
|
||||
VasEBoot_efi_uintn_t num_handles;
|
||||
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);
|
||||
|
||||
for (i = 0; i < num_handles; i++)
|
||||
{
|
||||
grub_efi_handle_t handle = handles[i];
|
||||
grub_efi_status_t status;
|
||||
grub_efi_uintn_t num_protocols;
|
||||
grub_efi_packed_guid_t **protocols;
|
||||
grub_efi_device_path_t *dp;
|
||||
VasEBoot_efi_handle_t handle = handles[i];
|
||||
VasEBoot_efi_status_t status;
|
||||
VasEBoot_efi_uintn_t num_protocols;
|
||||
VasEBoot_efi_packed_guid_t **protocols;
|
||||
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)
|
||||
{
|
||||
grub_printf (" ");
|
||||
grub_efi_print_device_path (dp);
|
||||
VasEBoot_printf (" ");
|
||||
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);
|
||||
if (status != GRUB_EFI_SUCCESS)
|
||||
grub_printf ("Unable to retrieve protocols\n");
|
||||
if (status != VasEBoot_EFI_SUCCESS)
|
||||
VasEBoot_printf ("Unable to retrieve protocols\n");
|
||||
for (j = 0; j < num_protocols; j++)
|
||||
{
|
||||
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)
|
||||
break;
|
||||
if (k < ARRAY_SIZE (known_protocols))
|
||||
grub_printf (" %s\n", known_protocols[k].name);
|
||||
VasEBoot_printf (" %s\n", known_protocols[k].name);
|
||||
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]->data2,
|
||||
protocols[j]->data3,
|
||||
|
|
@ -139,15 +139,15 @@ grub_cmd_lsefi (grub_command_t cmd __attribute__ ((unused)),
|
|||
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.");
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(lsefi)
|
||||
VasEBoot_MOD_FINI(lsefi)
|
||||
{
|
||||
grub_unregister_command (cmd);
|
||||
VasEBoot_unregister_command (cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,55 +1,55 @@
|
|||
/* lsefimemmap.c - Display memory map. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <grub/types.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/efi/api.h>
|
||||
#include <grub/efi/efi.h>
|
||||
#include <grub/command.h>
|
||||
#include <VasEBoot/types.h>
|
||||
#include <VasEBoot/mm.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/efi/api.h>
|
||||
#include <VasEBoot/efi/efi.h>
|
||||
#include <VasEBoot/command.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
VasEBoot_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
#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
|
||||
grub_cmd_lsefimmap (grub_command_t cmd __attribute__ ((unused)),
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_lsefimmap (VasEBoot_command_t cmd __attribute__ ((unused)),
|
||||
int argc __attribute__ ((unused)),
|
||||
char **args __attribute__ ((unused)))
|
||||
{
|
||||
grub_efi_uintn_t map_size;
|
||||
grub_efi_memory_descriptor_t *memory_map;
|
||||
grub_efi_memory_descriptor_t *memory_map_end;
|
||||
grub_efi_memory_descriptor_t *desc;
|
||||
grub_efi_uintn_t desc_size;
|
||||
VasEBoot_efi_uintn_t map_size;
|
||||
VasEBoot_efi_memory_descriptor_t *memory_map;
|
||||
VasEBoot_efi_memory_descriptor_t *memory_map_end;
|
||||
VasEBoot_efi_memory_descriptor_t *desc;
|
||||
VasEBoot_efi_uintn_t desc_size;
|
||||
|
||||
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;
|
||||
|
||||
memory_map = grub_malloc (map_size);
|
||||
memory_map = VasEBoot_malloc (map_size);
|
||||
if (memory_map == NULL)
|
||||
return grub_errno;
|
||||
if (grub_efi_get_memory_map (&map_size, memory_map, NULL, &desc_size, 0) <= 0)
|
||||
return VasEBoot_errno;
|
||||
if (VasEBoot_efi_get_memory_map (&map_size, memory_map, NULL, &desc_size, 0) <= 0)
|
||||
goto fail;
|
||||
|
||||
grub_printf
|
||||
VasEBoot_printf
|
||||
("Type Physical start - end #Pages "
|
||||
" Size Attributes\n");
|
||||
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 = ADD_MEMORY_DESCRIPTOR (desc, desc_size))
|
||||
{
|
||||
grub_efi_uint64_t size;
|
||||
grub_efi_uint64_t attr;
|
||||
VasEBoot_efi_uint64_t size;
|
||||
VasEBoot_efi_uint64_t attr;
|
||||
static const char types_str[][9] =
|
||||
{
|
||||
"reserved",
|
||||
|
|
@ -78,12 +78,12 @@ grub_cmd_lsefimmap (grub_command_t cmd __attribute__ ((unused)),
|
|||
"persist ",
|
||||
};
|
||||
if (desc->type < ARRAY_SIZE (types_str))
|
||||
grub_printf ("%s ", types_str[desc->type]);
|
||||
VasEBoot_printf ("%s ", types_str[desc->type]);
|
||||
else
|
||||
grub_printf ("Unk %02x ", desc->type);
|
||||
VasEBoot_printf ("Unk %02x ", desc->type);
|
||||
|
||||
grub_printf (" %016" PRIxGRUB_UINT64_T "-%016" PRIxGRUB_UINT64_T
|
||||
" %08" PRIxGRUB_UINT64_T,
|
||||
VasEBoot_printf (" %016" PRIxVasEBoot_UINT64_T "-%016" PRIxVasEBoot_UINT64_T
|
||||
" %08" PRIxVasEBoot_UINT64_T,
|
||||
desc->physical_start,
|
||||
desc->physical_start + (desc->num_pages << 12) - 1,
|
||||
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.
|
||||
*/
|
||||
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)
|
||||
grub_printf (" %6" PRIuGRUB_UINT64_T "MiB", size >> 20);
|
||||
VasEBoot_printf (" %6" PRIuVasEBoot_UINT64_T "MiB", size >> 20);
|
||||
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)
|
||||
grub_printf (" %6" PRIuGRUB_UINT64_T "TiB", size >> 40);
|
||||
VasEBoot_printf (" %6" PRIuVasEBoot_UINT64_T "TiB", size >> 40);
|
||||
else if (size & 0xfffffffffffffff)
|
||||
grub_printf (" %6" PRIuGRUB_UINT64_T "PiB", size >> 50);
|
||||
VasEBoot_printf (" %6" PRIuVasEBoot_UINT64_T "PiB", size >> 50);
|
||||
else
|
||||
grub_printf (" %6" PRIuGRUB_UINT64_T "EiB", size >> 60);
|
||||
VasEBoot_printf (" %6" PRIuVasEBoot_UINT64_T "EiB", size >> 60);
|
||||
|
||||
attr = desc->attribute;
|
||||
if (attr & GRUB_EFI_MEMORY_RUNTIME)
|
||||
grub_printf (" RT");
|
||||
if (attr & GRUB_EFI_MEMORY_UC)
|
||||
grub_printf (" UC");
|
||||
if (attr & GRUB_EFI_MEMORY_WC)
|
||||
grub_printf (" WC");
|
||||
if (attr & GRUB_EFI_MEMORY_WT)
|
||||
grub_printf (" WT");
|
||||
if (attr & GRUB_EFI_MEMORY_WB)
|
||||
grub_printf (" WB");
|
||||
if (attr & GRUB_EFI_MEMORY_UCE)
|
||||
grub_printf (" UCE");
|
||||
if (attr & GRUB_EFI_MEMORY_WP)
|
||||
grub_printf (" WP");
|
||||
if (attr & GRUB_EFI_MEMORY_RP)
|
||||
grub_printf (" RP");
|
||||
if (attr & GRUB_EFI_MEMORY_XP)
|
||||
grub_printf (" XP");
|
||||
if (attr & GRUB_EFI_MEMORY_NV)
|
||||
grub_printf (" NV");
|
||||
if (attr & GRUB_EFI_MEMORY_MORE_RELIABLE)
|
||||
grub_printf (" MR");
|
||||
if (attr & GRUB_EFI_MEMORY_RO)
|
||||
grub_printf (" RO");
|
||||
if (attr & VasEBoot_EFI_MEMORY_RUNTIME)
|
||||
VasEBoot_printf (" RT");
|
||||
if (attr & VasEBoot_EFI_MEMORY_UC)
|
||||
VasEBoot_printf (" UC");
|
||||
if (attr & VasEBoot_EFI_MEMORY_WC)
|
||||
VasEBoot_printf (" WC");
|
||||
if (attr & VasEBoot_EFI_MEMORY_WT)
|
||||
VasEBoot_printf (" WT");
|
||||
if (attr & VasEBoot_EFI_MEMORY_WB)
|
||||
VasEBoot_printf (" WB");
|
||||
if (attr & VasEBoot_EFI_MEMORY_UCE)
|
||||
VasEBoot_printf (" UCE");
|
||||
if (attr & VasEBoot_EFI_MEMORY_WP)
|
||||
VasEBoot_printf (" WP");
|
||||
if (attr & VasEBoot_EFI_MEMORY_RP)
|
||||
VasEBoot_printf (" RP");
|
||||
if (attr & VasEBoot_EFI_MEMORY_XP)
|
||||
VasEBoot_printf (" XP");
|
||||
if (attr & VasEBoot_EFI_MEMORY_NV)
|
||||
VasEBoot_printf (" NV");
|
||||
if (attr & VasEBoot_EFI_MEMORY_MORE_RELIABLE)
|
||||
VasEBoot_printf (" MR");
|
||||
if (attr & VasEBoot_EFI_MEMORY_RO)
|
||||
VasEBoot_printf (" RO");
|
||||
|
||||
grub_printf ("\n");
|
||||
VasEBoot_printf ("\n");
|
||||
}
|
||||
|
||||
fail:
|
||||
grub_free (memory_map);
|
||||
VasEBoot_free (memory_map);
|
||||
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.");
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(lsefimmap)
|
||||
VasEBoot_MOD_FINI(lsefimmap)
|
||||
{
|
||||
grub_unregister_command (cmd);
|
||||
VasEBoot_unregister_command (cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,122 +1,122 @@
|
|||
/* lsefisystab.c - Display EFI systab. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <grub/types.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/normal.h>
|
||||
#include <grub/charset.h>
|
||||
#include <grub/efi/api.h>
|
||||
#include <grub/efi/efi.h>
|
||||
#include <VasEBoot/types.h>
|
||||
#include <VasEBoot/mm.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/normal.h>
|
||||
#include <VasEBoot/charset.h>
|
||||
#include <VasEBoot/efi/api.h>
|
||||
#include <VasEBoot/efi/efi.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
VasEBoot_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
struct guid_mapping
|
||||
{
|
||||
grub_efi_guid_t guid;
|
||||
VasEBoot_efi_guid_t guid;
|
||||
const char *name;
|
||||
};
|
||||
|
||||
static const struct guid_mapping guid_mappings[] =
|
||||
{
|
||||
{ GRUB_EFI_ACPI_20_TABLE_GUID, "ACPI-2.0"},
|
||||
{ GRUB_EFI_ACPI_TABLE_GUID, "ACPI-1.0"},
|
||||
{ GRUB_EFI_CRC32_GUIDED_SECTION_EXTRACTION_GUID,
|
||||
{ VasEBoot_EFI_ACPI_20_TABLE_GUID, "ACPI-2.0"},
|
||||
{ VasEBoot_EFI_ACPI_TABLE_GUID, "ACPI-1.0"},
|
||||
{ VasEBoot_EFI_CRC32_GUIDED_SECTION_EXTRACTION_GUID,
|
||||
"CRC32 GUIDED SECTION EXTRACTION"},
|
||||
{ GRUB_EFI_DEBUG_IMAGE_INFO_TABLE_GUID, "DEBUG IMAGE INFO"},
|
||||
{ GRUB_EFI_DXE_SERVICES_TABLE_GUID, "DXE SERVICES"},
|
||||
{ GRUB_EFI_HCDP_TABLE_GUID, "HCDP"},
|
||||
{ GRUB_EFI_HOB_LIST_GUID, "HOB LIST"},
|
||||
{ GRUB_EFI_LZMA_CUSTOM_DECOMPRESS_GUID, "LZMA CUSTOM DECOMPRESS"},
|
||||
{ GRUB_EFI_MEMORY_TYPE_INFORMATION_GUID, "MEMORY TYPE INFO"},
|
||||
{ GRUB_EFI_MPS_TABLE_GUID, "MPS"},
|
||||
{ GRUB_EFI_SAL_TABLE_GUID, "SAL"},
|
||||
{ GRUB_EFI_SMBIOS_TABLE_GUID, "SMBIOS"},
|
||||
{ GRUB_EFI_SMBIOS3_TABLE_GUID, "SMBIOS3"},
|
||||
{ GRUB_EFI_SYSTEM_RESOURCE_TABLE_GUID, "SYSTEM RESOURCE TABLE"},
|
||||
{ GRUB_EFI_TIANO_CUSTOM_DECOMPRESS_GUID, "TIANO CUSTOM DECOMPRESS"},
|
||||
{ GRUB_EFI_TSC_FREQUENCY_GUID, "TSC FREQUENCY"},
|
||||
{ VasEBoot_EFI_DEBUG_IMAGE_INFO_TABLE_GUID, "DEBUG IMAGE INFO"},
|
||||
{ VasEBoot_EFI_DXE_SERVICES_TABLE_GUID, "DXE SERVICES"},
|
||||
{ VasEBoot_EFI_HCDP_TABLE_GUID, "HCDP"},
|
||||
{ VasEBoot_EFI_HOB_LIST_GUID, "HOB LIST"},
|
||||
{ VasEBoot_EFI_LZMA_CUSTOM_DECOMPRESS_GUID, "LZMA CUSTOM DECOMPRESS"},
|
||||
{ VasEBoot_EFI_MEMORY_TYPE_INFORMATION_GUID, "MEMORY TYPE INFO"},
|
||||
{ VasEBoot_EFI_MPS_TABLE_GUID, "MPS"},
|
||||
{ VasEBoot_EFI_SAL_TABLE_GUID, "SAL"},
|
||||
{ VasEBoot_EFI_SMBIOS_TABLE_GUID, "SMBIOS"},
|
||||
{ VasEBoot_EFI_SMBIOS3_TABLE_GUID, "SMBIOS3"},
|
||||
{ VasEBoot_EFI_SYSTEM_RESOURCE_TABLE_GUID, "SYSTEM RESOURCE TABLE"},
|
||||
{ VasEBoot_EFI_TIANO_CUSTOM_DECOMPRESS_GUID, "TIANO CUSTOM DECOMPRESS"},
|
||||
{ VasEBoot_EFI_TSC_FREQUENCY_GUID, "TSC FREQUENCY"},
|
||||
};
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_lsefisystab (struct grub_command *cmd __attribute__ ((unused)),
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_lsefisystab (struct VasEBoot_command *cmd __attribute__ ((unused)),
|
||||
int argc __attribute__ ((unused)),
|
||||
char **args __attribute__ ((unused)))
|
||||
{
|
||||
const grub_efi_system_table_t *st = grub_efi_system_table;
|
||||
grub_efi_configuration_table_t *t;
|
||||
const VasEBoot_efi_system_table_t *st = VasEBoot_efi_system_table;
|
||||
VasEBoot_efi_configuration_table_t *t;
|
||||
unsigned int i;
|
||||
|
||||
grub_printf ("Address: %p\n", st);
|
||||
grub_printf ("Signature: %016" PRIxGRUB_UINT64_T " revision: %08x\n",
|
||||
VasEBoot_printf ("Address: %p\n", st);
|
||||
VasEBoot_printf ("Signature: %016" PRIxVasEBoot_UINT64_T " revision: %08x\n",
|
||||
st->hdr.signature, st->hdr.revision);
|
||||
{
|
||||
char *vendor;
|
||||
grub_uint16_t *vendor_utf16;
|
||||
grub_printf ("Vendor: ");
|
||||
VasEBoot_uint16_t *vendor_utf16;
|
||||
VasEBoot_printf ("Vendor: ");
|
||||
|
||||
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)
|
||||
return grub_errno;
|
||||
*grub_utf16_to_utf8 ((grub_uint8_t *) vendor, st->firmware_vendor,
|
||||
return VasEBoot_errno;
|
||||
*VasEBoot_utf16_to_utf8 ((VasEBoot_uint8_t *) vendor, st->firmware_vendor,
|
||||
vendor_utf16 - st->firmware_vendor) = 0;
|
||||
grub_printf ("%s", vendor);
|
||||
grub_free (vendor);
|
||||
VasEBoot_printf ("%s", 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;
|
||||
for (i = 0; i < st->num_table_entries; i++)
|
||||
{
|
||||
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.data3);
|
||||
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++)
|
||||
if (grub_memcmp (&guid_mappings[j].guid, &t->vendor_guid,
|
||||
sizeof (grub_efi_guid_t)) == 0)
|
||||
grub_printf (" %s", guid_mappings[j].name);
|
||||
if (VasEBoot_memcmp (&guid_mappings[j].guid, &t->vendor_guid,
|
||||
sizeof (VasEBoot_efi_guid_t)) == 0)
|
||||
VasEBoot_printf (" %s", guid_mappings[j].name);
|
||||
|
||||
grub_printf ("\n");
|
||||
VasEBoot_printf ("\n");
|
||||
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.");
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(lsefisystab)
|
||||
VasEBoot_MOD_FINI(lsefisystab)
|
||||
{
|
||||
grub_unregister_command (cmd);
|
||||
VasEBoot_unregister_command (cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,169 +1,169 @@
|
|||
/* lssal.c - Display EFI SAL systab. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#include <grub/types.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/normal.h>
|
||||
#include <grub/charset.h>
|
||||
#include <grub/efi/api.h>
|
||||
#include <grub/efi/efi.h>
|
||||
#include <grub/dl.h>
|
||||
#include <VasEBoot/types.h>
|
||||
#include <VasEBoot/mm.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/normal.h>
|
||||
#include <VasEBoot/charset.h>
|
||||
#include <VasEBoot/efi/api.h>
|
||||
#include <VasEBoot/efi/efi.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
VasEBoot_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static void
|
||||
disp_sal (void *table)
|
||||
{
|
||||
struct grub_efi_sal_system_table *t = table;
|
||||
struct VasEBoot_efi_sal_system_table *t = table;
|
||||
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);
|
||||
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->sal_a_version, t->sal_b_version);
|
||||
grub_printf ("OEM-ID: %-32s\n", t->oem_id);
|
||||
grub_printf ("Product-ID: %-32s\n", t->product_id);
|
||||
VasEBoot_printf ("OEM-ID: %-32s\n", t->oem_id);
|
||||
VasEBoot_printf ("Product-ID: %-32s\n", t->product_id);
|
||||
|
||||
desc = t->entries;
|
||||
len = t->total_table_len - sizeof (struct grub_efi_sal_system_table);
|
||||
if (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 VasEBoot_efi_sal_system_table))
|
||||
return;
|
||||
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);
|
||||
grub_printf (" Entry point: PAL=%016" PRIxGRUB_UINT64_T
|
||||
" SAL=%016" PRIxGRUB_UINT64_T " GP=%016"
|
||||
PRIxGRUB_UINT64_T "\n",
|
||||
VasEBoot_printf (" Entry point: PAL=%016" PRIxVasEBoot_UINT64_T
|
||||
" SAL=%016" PRIxVasEBoot_UINT64_T " GP=%016"
|
||||
PRIxVasEBoot_UINT64_T "\n",
|
||||
c->pal_proc_addr, c->sal_proc_addr,
|
||||
c->global_data_ptr);
|
||||
}
|
||||
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);
|
||||
grub_printf (" Memory descriptor entry addr=%016" PRIxGRUB_UINT64_T
|
||||
" len=%" PRIuGRUB_UINT64_T "KB\n",
|
||||
VasEBoot_printf (" Memory descriptor entry addr=%016" PRIxVasEBoot_UINT64_T
|
||||
" len=%" PRIuVasEBoot_UINT64_T "KB\n",
|
||||
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",
|
||||
c->sal_used, c->attr, c->ar, c->attr_mask, c->mem_type,
|
||||
c->usage);
|
||||
}
|
||||
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);
|
||||
grub_printf (" Platform features: %02x", c->flags);
|
||||
if (c->flags & GRUB_EFI_SAL_SYSTEM_TABLE_PLATFORM_FEATURE_BUSLOCK)
|
||||
grub_printf (" BusLock");
|
||||
if (c->flags & GRUB_EFI_SAL_SYSTEM_TABLE_PLATFORM_FEATURE_IRQREDIRECT)
|
||||
grub_printf (" IrqRedirect");
|
||||
if (c->flags & GRUB_EFI_SAL_SYSTEM_TABLE_PLATFORM_FEATURE_IPIREDIRECT)
|
||||
VasEBoot_printf (" Platform features: %02x", c->flags);
|
||||
if (c->flags & VasEBoot_EFI_SAL_SYSTEM_TABLE_PLATFORM_FEATURE_BUSLOCK)
|
||||
VasEBoot_printf (" BusLock");
|
||||
if (c->flags & VasEBoot_EFI_SAL_SYSTEM_TABLE_PLATFORM_FEATURE_IRQREDIRECT)
|
||||
VasEBoot_printf (" IrqRedirect");
|
||||
if (c->flags & VasEBoot_EFI_SAL_SYSTEM_TABLE_PLATFORM_FEATURE_IPIREDIRECT)
|
||||
|
||||
grub_printf (" IPIRedirect");
|
||||
if (c->flags & GRUB_EFI_SAL_SYSTEM_TABLE_PLATFORM_FEATURE_ITCDRIFT)
|
||||
VasEBoot_printf (" IPIRedirect");
|
||||
if (c->flags & VasEBoot_EFI_SAL_SYSTEM_TABLE_PLATFORM_FEATURE_ITCDRIFT)
|
||||
|
||||
grub_printf (" ITCDrift");
|
||||
grub_printf ("\n");
|
||||
VasEBoot_printf (" ITCDrift");
|
||||
VasEBoot_printf ("\n");
|
||||
}
|
||||
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;
|
||||
l = sizeof (*c);
|
||||
grub_printf (" TR type=%d num=%d va=%016" PRIxGRUB_UINT64_T
|
||||
" pte=%016" PRIxGRUB_UINT64_T "\n",
|
||||
VasEBoot_printf (" TR type=%d num=%d va=%016" PRIxVasEBoot_UINT64_T
|
||||
" pte=%016" PRIxVasEBoot_UINT64_T "\n",
|
||||
c->register_type, c->register_number,
|
||||
c->addr, c->page_size);
|
||||
}
|
||||
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;
|
||||
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);
|
||||
}
|
||||
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);
|
||||
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);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
grub_printf (" unknown entry 0x%x\n", *(grub_uint8_t *)desc);
|
||||
VasEBoot_printf (" unknown entry 0x%x\n", *(VasEBoot_uint8_t *)desc);
|
||||
return;
|
||||
}
|
||||
desc = (grub_uint8_t *)desc + l;
|
||||
desc = (VasEBoot_uint8_t *)desc + l;
|
||||
if (len <= l)
|
||||
return;
|
||||
len -= l;
|
||||
}
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_lssal (struct grub_command *cmd __attribute__ ((unused)),
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_lssal (struct VasEBoot_command *cmd __attribute__ ((unused)),
|
||||
int argc __attribute__ ((unused)),
|
||||
char **args __attribute__ ((unused)))
|
||||
{
|
||||
const grub_efi_system_table_t *st = grub_efi_system_table;
|
||||
grub_efi_configuration_table_t *t = st->configuration_table;
|
||||
const VasEBoot_efi_system_table_t *st = VasEBoot_efi_system_table;
|
||||
VasEBoot_efi_configuration_table_t *t = st->configuration_table;
|
||||
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++)
|
||||
{
|
||||
if (grub_memcmp (&guid, &t->vendor_guid,
|
||||
sizeof (grub_efi_packed_guid_t)) == 0)
|
||||
if (VasEBoot_memcmp (&guid, &t->vendor_guid,
|
||||
sizeof (VasEBoot_efi_packed_guid_t)) == 0)
|
||||
{
|
||||
disp_sal (t->vendor_table);
|
||||
return GRUB_ERR_NONE;
|
||||
return VasEBoot_ERR_NONE;
|
||||
}
|
||||
t++;
|
||||
}
|
||||
grub_printf ("SAL not found\n");
|
||||
return GRUB_ERR_NONE;
|
||||
VasEBoot_printf ("SAL not found\n");
|
||||
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.");
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(lssal)
|
||||
VasEBoot_MOD_FINI(lssal)
|
||||
{
|
||||
grub_unregister_command (cmd);
|
||||
VasEBoot_unregister_command (cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,59 +1,59 @@
|
|||
/* smbios.c - get smbios tables. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/smbios.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/efi/efi.h>
|
||||
#include <grub/efi/api.h>
|
||||
#include <VasEBoot/smbios.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/efi/efi.h>
|
||||
#include <VasEBoot/efi/api.h>
|
||||
|
||||
struct grub_smbios_eps *
|
||||
grub_machine_smbios_get_eps (void)
|
||||
struct VasEBoot_smbios_eps *
|
||||
VasEBoot_machine_smbios_get_eps (void)
|
||||
{
|
||||
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 =
|
||||
&grub_efi_system_table->configuration_table[i].vendor_guid;
|
||||
VasEBoot_efi_packed_guid_t *guid =
|
||||
&VasEBoot_efi_system_table->configuration_table[i].vendor_guid;
|
||||
|
||||
if (! grub_memcmp (guid, &smbios_guid, sizeof (grub_efi_packed_guid_t)))
|
||||
return (struct grub_smbios_eps *)
|
||||
grub_efi_system_table->configuration_table[i].vendor_table;
|
||||
if (! VasEBoot_memcmp (guid, &smbios_guid, sizeof (VasEBoot_efi_packed_guid_t)))
|
||||
return (struct VasEBoot_smbios_eps *)
|
||||
VasEBoot_efi_system_table->configuration_table[i].vendor_table;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct grub_smbios_eps3 *
|
||||
grub_machine_smbios_get_eps3 (void)
|
||||
struct VasEBoot_smbios_eps3 *
|
||||
VasEBoot_machine_smbios_get_eps3 (void)
|
||||
{
|
||||
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 =
|
||||
&grub_efi_system_table->configuration_table[i].vendor_guid;
|
||||
VasEBoot_efi_packed_guid_t *guid =
|
||||
&VasEBoot_efi_system_table->configuration_table[i].vendor_guid;
|
||||
|
||||
if (! grub_memcmp (guid, &smbios3_guid, sizeof (grub_efi_packed_guid_t)))
|
||||
return (struct grub_smbios_eps3 *)
|
||||
grub_efi_system_table->configuration_table[i].vendor_table;
|
||||
if (! VasEBoot_memcmp (guid, &smbios3_guid, sizeof (VasEBoot_efi_packed_guid_t)))
|
||||
return (struct VasEBoot_smbios_eps3 *)
|
||||
VasEBoot_efi_system_table->configuration_table[i].vendor_table;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,71 +1,71 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/script_sh.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/term.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/script_sh.h>
|
||||
#include <VasEBoot/command.h>
|
||||
#include <VasEBoot/i18n.h>
|
||||
#include <VasEBoot/term.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
VasEBoot_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_eval (grub_command_t cmd __attribute__((__unused__)),
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_eval (VasEBoot_command_t cmd __attribute__((__unused__)),
|
||||
int argc, char *argv[])
|
||||
{
|
||||
int i;
|
||||
grub_size_t size = argc; /* +1 for final zero */
|
||||
VasEBoot_size_t size = argc; /* +1 for final zero */
|
||||
char *str, *p;
|
||||
grub_err_t ret;
|
||||
VasEBoot_err_t ret;
|
||||
|
||||
if (argc == 0)
|
||||
return GRUB_ERR_NONE;
|
||||
return VasEBoot_ERR_NONE;
|
||||
|
||||
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)
|
||||
return grub_errno;
|
||||
return VasEBoot_errno;
|
||||
|
||||
for (i = 0; i < argc; i++)
|
||||
{
|
||||
p = grub_stpcpy (p, argv[i]);
|
||||
p = VasEBoot_stpcpy (p, argv[i]);
|
||||
*p++ = ' ';
|
||||
}
|
||||
*--p = '\0';
|
||||
|
||||
ret = grub_script_execute_sourcecode (str);
|
||||
grub_free (str);
|
||||
ret = VasEBoot_script_execute_sourcecode (str);
|
||||
VasEBoot_free (str);
|
||||
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 ..."),
|
||||
N_("Evaluate arguments as GRUB commands"));
|
||||
cmd = VasEBoot_register_command ("eval", VasEBoot_cmd_eval, N_("STRING ..."),
|
||||
N_("Evaluate arguments as VasEBoot commands"));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(eval)
|
||||
VasEBoot_MOD_FINI(eval)
|
||||
{
|
||||
grub_unregister_command (cmd);
|
||||
VasEBoot_unregister_command (cmd);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,41 +1,41 @@
|
|||
/* extcmd.c - support extended command */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/mm.h>
|
||||
#include <grub/list.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/script_sh.h>
|
||||
#include <grub/dl.h>
|
||||
#include <VasEBoot/mm.h>
|
||||
#include <VasEBoot/list.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/extcmd.h>
|
||||
#include <VasEBoot/script_sh.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
VasEBoot_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
grub_err_t
|
||||
grub_extcmd_dispatcher (struct grub_command *cmd, int argc, char **args,
|
||||
struct grub_script *script)
|
||||
VasEBoot_err_t
|
||||
VasEBoot_extcmd_dispatcher (struct VasEBoot_command *cmd, int argc, char **args,
|
||||
struct VasEBoot_script *script)
|
||||
{
|
||||
int new_argc;
|
||||
char **new_args;
|
||||
struct grub_arg_list *state;
|
||||
struct grub_extcmd_context context;
|
||||
grub_err_t ret;
|
||||
grub_extcmd_t ext = cmd->data;
|
||||
struct VasEBoot_arg_list *state;
|
||||
struct VasEBoot_extcmd_context context;
|
||||
VasEBoot_err_t ret;
|
||||
VasEBoot_extcmd_t ext = cmd->data;
|
||||
|
||||
context.state = 0;
|
||||
context.extcmd = ext;
|
||||
|
|
@ -47,49 +47,49 @@ grub_extcmd_dispatcher (struct grub_command *cmd, int argc, char **args,
|
|||
return ret;
|
||||
}
|
||||
|
||||
state = grub_arg_list_alloc (ext, argc, args);
|
||||
if (grub_arg_parse (ext, argc, args, state, &new_args, &new_argc))
|
||||
state = VasEBoot_arg_list_alloc (ext, argc, args);
|
||||
if (VasEBoot_arg_parse (ext, argc, args, state, &new_args, &new_argc))
|
||||
{
|
||||
context.state = state;
|
||||
ret = (ext->func) (&context, new_argc, new_args);
|
||||
grub_free (new_args);
|
||||
grub_free (state);
|
||||
VasEBoot_free (new_args);
|
||||
VasEBoot_free (state);
|
||||
return ret;
|
||||
}
|
||||
|
||||
grub_free (state);
|
||||
return grub_errno;
|
||||
VasEBoot_free (state);
|
||||
return VasEBoot_errno;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_extcmd_dispatch (struct grub_command *cmd, int argc, char **args)
|
||||
static VasEBoot_err_t
|
||||
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
|
||||
grub_register_extcmd_prio (const char *name, grub_extcmd_func_t func,
|
||||
grub_command_flags_t flags, const char *summary,
|
||||
VasEBoot_extcmd_t
|
||||
VasEBoot_register_extcmd_prio (const char *name, VasEBoot_extcmd_func_t func,
|
||||
VasEBoot_command_flags_t flags, const char *summary,
|
||||
const char *description,
|
||||
const struct grub_arg_option *parser,
|
||||
const struct VasEBoot_arg_option *parser,
|
||||
int prio)
|
||||
{
|
||||
grub_extcmd_t ext;
|
||||
grub_command_t cmd;
|
||||
VasEBoot_extcmd_t ext;
|
||||
VasEBoot_command_t cmd;
|
||||
|
||||
ext = (grub_extcmd_t) grub_malloc (sizeof (*ext));
|
||||
ext = (VasEBoot_extcmd_t) VasEBoot_malloc (sizeof (*ext));
|
||||
if (! ext)
|
||||
return 0;
|
||||
|
||||
cmd = grub_register_command_prio (name, grub_extcmd_dispatch,
|
||||
cmd = VasEBoot_register_command_prio (name, VasEBoot_extcmd_dispatch,
|
||||
summary, description, prio);
|
||||
if (! cmd)
|
||||
{
|
||||
grub_free (ext);
|
||||
VasEBoot_free (ext);
|
||||
return 0;
|
||||
}
|
||||
|
||||
cmd->flags = (flags | GRUB_COMMAND_FLAG_EXTCMD);
|
||||
cmd->flags = (flags | VasEBoot_COMMAND_FLAG_EXTCMD);
|
||||
cmd->data = ext;
|
||||
|
||||
ext->cmd = cmd;
|
||||
|
|
@ -100,19 +100,19 @@ grub_register_extcmd_prio (const char *name, grub_extcmd_func_t func,
|
|||
return ext;
|
||||
}
|
||||
|
||||
grub_extcmd_t
|
||||
grub_register_extcmd (const char *name, grub_extcmd_func_t func,
|
||||
grub_command_flags_t flags, const char *summary,
|
||||
VasEBoot_extcmd_t
|
||||
VasEBoot_register_extcmd (const char *name, VasEBoot_extcmd_func_t func,
|
||||
VasEBoot_command_flags_t flags, const char *summary,
|
||||
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);
|
||||
}
|
||||
|
||||
void
|
||||
grub_unregister_extcmd (grub_extcmd_t ext)
|
||||
VasEBoot_unregister_extcmd (VasEBoot_extcmd_t ext)
|
||||
{
|
||||
grub_unregister_command (ext->cmd);
|
||||
grub_free (ext);
|
||||
VasEBoot_unregister_command (ext->cmd);
|
||||
VasEBoot_free (ext);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,40 +1,40 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/elf.h>
|
||||
#include <grub/xen_file.h>
|
||||
#include <grub/efi/pe32.h>
|
||||
#include <grub/i386/linux.h>
|
||||
#include <grub/xnu.h>
|
||||
#include <grub/machoload.h>
|
||||
#include <grub/fileid.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/mm.h>
|
||||
#include <VasEBoot/env.h>
|
||||
#include <VasEBoot/command.h>
|
||||
#include <VasEBoot/extcmd.h>
|
||||
#include <VasEBoot/i18n.h>
|
||||
#include <VasEBoot/file.h>
|
||||
#include <VasEBoot/elf.h>
|
||||
#include <VasEBoot/xen_file.h>
|
||||
#include <VasEBoot/efi/pe32.h>
|
||||
#include <VasEBoot/i386/linux.h>
|
||||
#include <VasEBoot/xnu.h>
|
||||
#include <VasEBoot/machoload.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,
|
||||
N_("Check if FILE can be booted as i386 PAE Xen unprivileged guest kernel"),
|
||||
0, 0},
|
||||
|
|
@ -138,18 +138,18 @@ enum
|
|||
};
|
||||
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_file (VasEBoot_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
grub_file_t file = 0;
|
||||
grub_elf_t elf = 0;
|
||||
grub_err_t err;
|
||||
VasEBoot_file_t file = 0;
|
||||
VasEBoot_elf_t elf = 0;
|
||||
VasEBoot_err_t err;
|
||||
int type = -1, i;
|
||||
int ret = 0;
|
||||
grub_macho_t macho = 0;
|
||||
VasEBoot_macho_t macho = 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++)
|
||||
if (ctxt->state[i].set)
|
||||
{
|
||||
|
|
@ -158,26 +158,26 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
type = i;
|
||||
continue;
|
||||
}
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "multiple types specified");
|
||||
return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, "multiple types specified");
|
||||
}
|
||||
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)
|
||||
return grub_errno;
|
||||
return VasEBoot_errno;
|
||||
switch (type)
|
||||
{
|
||||
case IS_BIOS_BOOTSECTOR:
|
||||
{
|
||||
grub_uint16_t sig;
|
||||
if (grub_file_size (file) != 512)
|
||||
VasEBoot_uint16_t sig;
|
||||
if (VasEBoot_file_size (file) != 512)
|
||||
break;
|
||||
if (grub_file_seek (file, 510) == (grub_size_t) -1)
|
||||
if (VasEBoot_file_seek (file, 510) == (VasEBoot_size_t) -1)
|
||||
break;
|
||||
if (grub_file_read (file, &sig, 2) != 2)
|
||||
if (VasEBoot_file_read (file, &sig, 2) != 2)
|
||||
break;
|
||||
if (sig != grub_cpu_to_le16_compile_time (0xaa55))
|
||||
if (sig != VasEBoot_cpu_to_le16_compile_time (0xaa55))
|
||||
break;
|
||||
ret = 1;
|
||||
break;
|
||||
|
|
@ -186,7 +186,7 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
{
|
||||
Elf64_Ehdr ehdr;
|
||||
|
||||
if (grub_file_read (file, &ehdr, sizeof (ehdr)) != sizeof (ehdr))
|
||||
if (VasEBoot_file_read (file, &ehdr, sizeof (ehdr)) != sizeof (ehdr))
|
||||
break;
|
||||
|
||||
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
|
||||
|| 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;
|
||||
|
||||
ret = 1;
|
||||
|
|
@ -211,7 +211,7 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
{
|
||||
Elf64_Ehdr ehdr;
|
||||
|
||||
if (grub_file_read (file, &ehdr, sizeof (ehdr)) != sizeof (ehdr))
|
||||
if (VasEBoot_file_read (file, &ehdr, sizeof (ehdr)) != sizeof (ehdr))
|
||||
break;
|
||||
|
||||
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)
|
||||
break;
|
||||
|
||||
if (ehdr.e_machine != grub_cpu_to_le16_compile_time (EM_SPARCV9)
|
||||
|| ehdr.e_type != grub_cpu_to_be16_compile_time (ET_EXEC))
|
||||
if (ehdr.e_machine != VasEBoot_cpu_to_le16_compile_time (EM_SPARCV9)
|
||||
|| ehdr.e_type != VasEBoot_cpu_to_be16_compile_time (ET_EXEC))
|
||||
break;
|
||||
|
||||
ret = 1;
|
||||
|
|
@ -239,7 +239,7 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
{
|
||||
Elf32_Ehdr ehdr;
|
||||
|
||||
if (grub_file_read (file, &ehdr, sizeof (ehdr)) != sizeof (ehdr))
|
||||
if (VasEBoot_file_read (file, &ehdr, sizeof (ehdr)) != sizeof (ehdr))
|
||||
break;
|
||||
|
||||
if (ehdr.e_ident[EI_MAG0] != ELFMAG0
|
||||
|
|
@ -251,13 +251,13 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
break;
|
||||
|
||||
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 !=
|
||||
grub_cpu_to_le16_compile_time (EM_PPC64)))
|
||||
VasEBoot_cpu_to_le16_compile_time (EM_PPC64)))
|
||||
break;
|
||||
|
||||
if (ehdr.e_type != grub_cpu_to_be16_compile_time (ET_EXEC)
|
||||
&& ehdr.e_type != grub_cpu_to_be16_compile_time (ET_DYN))
|
||||
if (ehdr.e_type != VasEBoot_cpu_to_be16_compile_time (ET_EXEC)
|
||||
&& ehdr.e_type != VasEBoot_cpu_to_be16_compile_time (ET_DYN))
|
||||
break;
|
||||
|
||||
ret = 1;
|
||||
|
|
@ -269,7 +269,7 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
{
|
||||
Elf32_Ehdr ehdr;
|
||||
|
||||
if (grub_file_read (file, &ehdr, sizeof (ehdr)) != sizeof (ehdr))
|
||||
if (VasEBoot_file_read (file, &ehdr, sizeof (ehdr)) != sizeof (ehdr))
|
||||
break;
|
||||
|
||||
if (ehdr.e_ident[EI_MAG0] != ELFMAG0
|
||||
|
|
@ -281,8 +281,8 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
break;
|
||||
|
||||
if (ehdr.e_ident[EI_DATA] != ELFDATA2MSB
|
||||
|| ehdr.e_machine != grub_cpu_to_be16_compile_time (EM_MIPS)
|
||||
|| ehdr.e_type != grub_cpu_to_be16_compile_time (ET_EXEC))
|
||||
|| ehdr.e_machine != VasEBoot_cpu_to_be16_compile_time (EM_MIPS)
|
||||
|| ehdr.e_type != VasEBoot_cpu_to_be16_compile_time (ET_EXEC))
|
||||
break;
|
||||
|
||||
ret = 1;
|
||||
|
|
@ -296,14 +296,14 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
{
|
||||
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)
|
||||
break;
|
||||
|
||||
is32 = grub_elf_is_elf32 (elf);
|
||||
is64 = grub_elf_is_elf64 (elf);
|
||||
is32 = VasEBoot_elf_is_elf32 (elf);
|
||||
is64 = VasEBoot_elf_is_elf64 (elf);
|
||||
if (!is32 && !is64)
|
||||
break;
|
||||
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)
|
||||
break;
|
||||
if (is64)
|
||||
ret = grub_file_check_netbsd64 (elf);
|
||||
ret = VasEBoot_file_check_netbsd64 (elf);
|
||||
if (is32)
|
||||
ret = grub_file_check_netbsd32 (elf);
|
||||
ret = VasEBoot_file_check_netbsd32 (elf);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -324,7 +324,7 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
Elf32_Ehdr ehdr;
|
||||
int is32, is64;
|
||||
|
||||
if (grub_file_read (file, &ehdr, sizeof (ehdr)) != sizeof (ehdr))
|
||||
if (VasEBoot_file_read (file, &ehdr, sizeof (ehdr)) != sizeof (ehdr))
|
||||
break;
|
||||
|
||||
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)
|
||||
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)
|
||||
break;
|
||||
|
||||
if (ehdr.e_ident[EI_OSABI] != ELFOSABI_FREEBSD)
|
||||
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);
|
||||
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);
|
||||
if (!is32 && !is64)
|
||||
break;
|
||||
|
|
@ -362,7 +362,7 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
{
|
||||
Elf32_Ehdr ehdr;
|
||||
|
||||
if (grub_file_read (file, &ehdr, sizeof (ehdr)) != sizeof (ehdr))
|
||||
if (VasEBoot_file_read (file, &ehdr, sizeof (ehdr)) != sizeof (ehdr))
|
||||
break;
|
||||
|
||||
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)
|
||||
break;
|
||||
|
||||
if (ehdr.e_machine != grub_cpu_to_le16_compile_time (EM_MIPS)
|
||||
|| ehdr.e_type != grub_cpu_to_le16_compile_time (ET_EXEC))
|
||||
if (ehdr.e_machine != VasEBoot_cpu_to_le16_compile_time (EM_MIPS)
|
||||
|| ehdr.e_type != VasEBoot_cpu_to_le16_compile_time (ET_EXEC))
|
||||
break;
|
||||
|
||||
ret = 1;
|
||||
|
|
@ -383,21 +383,21 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
}
|
||||
case IS_ARM_LINUX:
|
||||
{
|
||||
grub_uint32_t sig, sig_pi;
|
||||
if (grub_file_read (file, &sig_pi, 4) != 4)
|
||||
VasEBoot_uint32_t sig, sig_pi;
|
||||
if (VasEBoot_file_read (file, &sig_pi, 4) != 4)
|
||||
break;
|
||||
/* Raspberry pi. */
|
||||
if (sig_pi == grub_cpu_to_le32_compile_time (0xea000006))
|
||||
if (sig_pi == VasEBoot_cpu_to_le32_compile_time (0xea000006))
|
||||
{
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
if (grub_file_seek (file, 0x24) == (grub_size_t) -1)
|
||||
if (VasEBoot_file_seek (file, 0x24) == (VasEBoot_size_t) -1)
|
||||
break;
|
||||
if (grub_file_read (file, &sig, 4) != 4)
|
||||
if (VasEBoot_file_read (file, &sig, 4) != 4)
|
||||
break;
|
||||
if (sig == grub_cpu_to_le32_compile_time (0x016f2818))
|
||||
if (sig == VasEBoot_cpu_to_le32_compile_time (0x016f2818))
|
||||
{
|
||||
ret = 1;
|
||||
break;
|
||||
|
|
@ -406,13 +406,13 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
}
|
||||
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;
|
||||
if (grub_file_read (file, &sig, 4) != 4)
|
||||
if (VasEBoot_file_read (file, &sig, 4) != 4)
|
||||
break;
|
||||
if (sig == grub_cpu_to_le32_compile_time (0x644d5241))
|
||||
if (sig == VasEBoot_cpu_to_le32_compile_time (0x644d5241))
|
||||
{
|
||||
ret = 1;
|
||||
break;
|
||||
|
|
@ -421,54 +421,54 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
}
|
||||
case IS_PAE_DOMU ... IS_DOM0:
|
||||
{
|
||||
struct grub_xen_file_info xen_inf;
|
||||
elf = grub_xen_file (file);
|
||||
struct VasEBoot_xen_file_info xen_inf;
|
||||
elf = VasEBoot_xen_file (file);
|
||||
if (!elf)
|
||||
break;
|
||||
err = grub_xen_get_info (elf, &xen_inf);
|
||||
err = VasEBoot_xen_get_info (elf, &xen_inf);
|
||||
if (err)
|
||||
break;
|
||||
/* Unfortuntely no way to check if kernel supports dom0. */
|
||||
if (type == IS_DOM0)
|
||||
ret = 1;
|
||||
if (type == IS_PAE_DOMU)
|
||||
ret = (xen_inf.arch == GRUB_XEN_FILE_I386_PAE
|
||||
|| xen_inf.arch == GRUB_XEN_FILE_I386_PAE_BIMODE);
|
||||
ret = (xen_inf.arch == VasEBoot_XEN_FILE_I386_PAE
|
||||
|| xen_inf.arch == VasEBoot_XEN_FILE_I386_PAE_BIMODE);
|
||||
if (type == IS_64_DOMU)
|
||||
ret = (xen_inf.arch == GRUB_XEN_FILE_X86_64);
|
||||
ret = (xen_inf.arch == VasEBoot_XEN_FILE_X86_64);
|
||||
break;
|
||||
}
|
||||
case IS_MULTIBOOT:
|
||||
case IS_MULTIBOOT2:
|
||||
{
|
||||
grub_uint32_t *buffer;
|
||||
grub_ssize_t len;
|
||||
grub_size_t search_size;
|
||||
grub_uint32_t *header;
|
||||
grub_uint32_t magic;
|
||||
grub_size_t step;
|
||||
VasEBoot_uint32_t *buffer;
|
||||
VasEBoot_ssize_t len;
|
||||
VasEBoot_size_t search_size;
|
||||
VasEBoot_uint32_t *header;
|
||||
VasEBoot_uint32_t magic;
|
||||
VasEBoot_size_t step;
|
||||
|
||||
if (type == IS_MULTIBOOT2)
|
||||
{
|
||||
search_size = 32768;
|
||||
magic = grub_cpu_to_le32_compile_time (0xe85250d6);
|
||||
magic = VasEBoot_cpu_to_le32_compile_time (0xe85250d6);
|
||||
step = 2;
|
||||
}
|
||||
else
|
||||
{
|
||||
search_size = 8192;
|
||||
magic = grub_cpu_to_le32_compile_time (0x1BADB002);
|
||||
magic = VasEBoot_cpu_to_le32_compile_time (0x1BADB002);
|
||||
step = 1;
|
||||
}
|
||||
|
||||
buffer = grub_malloc (search_size);
|
||||
buffer = VasEBoot_malloc (search_size);
|
||||
if (!buffer)
|
||||
break;
|
||||
|
||||
len = grub_file_read (file, buffer, search_size);
|
||||
len = VasEBoot_file_read (file, buffer, search_size);
|
||||
if (len < 32)
|
||||
{
|
||||
grub_free (buffer);
|
||||
VasEBoot_free (buffer);
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -480,36 +480,36 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
header += step)
|
||||
{
|
||||
if (header[0] == magic
|
||||
&& !(grub_le_to_cpu32 (header[0])
|
||||
+ grub_le_to_cpu32 (header[1])
|
||||
+ grub_le_to_cpu32 (header[2])
|
||||
&& !(VasEBoot_le_to_cpu32 (header[0])
|
||||
+ VasEBoot_le_to_cpu32 (header[1])
|
||||
+ VasEBoot_le_to_cpu32 (header[2])
|
||||
+ (type == IS_MULTIBOOT2
|
||||
? grub_le_to_cpu32 (header[3]) : 0)))
|
||||
? VasEBoot_le_to_cpu32 (header[3]) : 0)))
|
||||
{
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
grub_free (buffer);
|
||||
VasEBoot_free (buffer);
|
||||
break;
|
||||
}
|
||||
case IS_X86_LINUX32:
|
||||
case IS_X86_LINUX:
|
||||
{
|
||||
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;
|
||||
if (lh.boot_flag != grub_cpu_to_le16_compile_time (0xaa55))
|
||||
if (lh.boot_flag != VasEBoot_cpu_to_le16_compile_time (0xaa55))
|
||||
break;
|
||||
|
||||
if (lh.setup_sects > GRUB_LINUX_MAX_SETUP_SECTS)
|
||||
if (lh.setup_sects > VasEBoot_LINUX_MAX_SETUP_SECTS)
|
||||
break;
|
||||
|
||||
/* FIXME: some really old kernels (< 1.3.73) will fail this. */
|
||||
if (lh.header !=
|
||||
grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE)
|
||||
|| grub_le_to_cpu16 (lh.version) < 0x0200)
|
||||
VasEBoot_cpu_to_le32_compile_time (VasEBoot_LINUX_MAGIC_SIGNATURE)
|
||||
|| VasEBoot_le_to_cpu16 (lh.version) < 0x0200)
|
||||
break;
|
||||
|
||||
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
|
||||
still not support 32-bit boot. */
|
||||
if (lh.header !=
|
||||
grub_cpu_to_le32_compile_time (GRUB_LINUX_MAGIC_SIGNATURE)
|
||||
|| grub_le_to_cpu16 (lh.version) < 0x0203)
|
||||
VasEBoot_cpu_to_le32_compile_time (VasEBoot_LINUX_MAGIC_SIGNATURE)
|
||||
|| VasEBoot_le_to_cpu16 (lh.version) < 0x0203)
|
||||
break;
|
||||
|
||||
if (!(lh.loadflags & GRUB_LINUX_FLAG_BIG_KERNEL))
|
||||
if (!(lh.loadflags & VasEBoot_LINUX_FLAG_BIG_KERNEL))
|
||||
break;
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
case IS_HIBERNATED:
|
||||
{
|
||||
grub_uint8_t hibr_file_magic[4];
|
||||
if (grub_file_read (file, &hibr_file_magic, sizeof (hibr_file_magic))
|
||||
VasEBoot_uint8_t hibr_file_magic[4];
|
||||
if (VasEBoot_file_read (file, &hibr_file_magic, sizeof (hibr_file_magic))
|
||||
!= sizeof (hibr_file_magic))
|
||||
break;
|
||||
if (grub_memcmp ("hibr", hibr_file_magic, sizeof (hibr_file_magic)) ==
|
||||
if (VasEBoot_memcmp ("hibr", hibr_file_magic, sizeof (hibr_file_magic)) ==
|
||||
0
|
||||
|| grub_memcmp ("HIBR", hibr_file_magic,
|
||||
|| VasEBoot_memcmp ("HIBR", hibr_file_magic,
|
||||
sizeof (hibr_file_magic)) == 0)
|
||||
ret = 1;
|
||||
break;
|
||||
|
|
@ -546,7 +546,7 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
case IS_XNU64:
|
||||
case IS_XNU32:
|
||||
{
|
||||
macho = grub_macho_open (args[0], (type == IS_XNU64));
|
||||
macho = VasEBoot_macho_open (args[0], (type == IS_XNU64));
|
||||
if (!macho)
|
||||
break;
|
||||
/* FIXME: more checks? */
|
||||
|
|
@ -555,12 +555,12 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
}
|
||||
case IS_XNU_HIBR:
|
||||
{
|
||||
struct grub_xnu_hibernate_header hibhead;
|
||||
if (grub_file_read (file, &hibhead, sizeof (hibhead))
|
||||
struct VasEBoot_xnu_hibernate_header hibhead;
|
||||
if (VasEBoot_file_read (file, &hibhead, sizeof (hibhead))
|
||||
!= sizeof (hibhead))
|
||||
break;
|
||||
if (hibhead.magic !=
|
||||
grub_cpu_to_le32_compile_time (GRUB_XNU_HIBERNATE_MAGIC))
|
||||
VasEBoot_cpu_to_le32_compile_time (VasEBoot_XNU_HIBERNATE_MAGIC))
|
||||
break;
|
||||
ret = 1;
|
||||
break;
|
||||
|
|
@ -572,75 +572,75 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
case IS_ARM_EFI:
|
||||
{
|
||||
char signature[4];
|
||||
grub_uint32_t pe_offset;
|
||||
struct grub_pe32_coff_header coff_head;
|
||||
VasEBoot_uint32_t pe_offset;
|
||||
struct VasEBoot_pe32_coff_header coff_head;
|
||||
|
||||
if (grub_file_read (file, signature, 2) != 2)
|
||||
if (VasEBoot_file_read (file, signature, 2) != 2)
|
||||
break;
|
||||
if (signature[0] != 'M' || signature[1] != 'Z')
|
||||
break;
|
||||
if ((grub_ssize_t) grub_file_seek (file, 0x3c) == -1)
|
||||
if ((VasEBoot_ssize_t) VasEBoot_file_seek (file, 0x3c) == -1)
|
||||
break;
|
||||
if (grub_file_read (file, &pe_offset, 4) != 4)
|
||||
if (VasEBoot_file_read (file, &pe_offset, 4) != 4)
|
||||
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)
|
||||
break;
|
||||
if (grub_file_read (file, signature, 4) != 4)
|
||||
if (VasEBoot_file_read (file, signature, 4) != 4)
|
||||
break;
|
||||
if (signature[0] != 'P' || signature[1] != 'E'
|
||||
|| signature[2] != '\0' || signature[3] != '\0')
|
||||
break;
|
||||
|
||||
if (grub_file_read (file, &coff_head, sizeof (coff_head))
|
||||
if (VasEBoot_file_read (file, &coff_head, sizeof (coff_head))
|
||||
!= sizeof (coff_head))
|
||||
break;
|
||||
if (type == IS_32_EFI
|
||||
&& coff_head.machine !=
|
||||
grub_cpu_to_le16_compile_time (GRUB_PE32_MACHINE_I386))
|
||||
VasEBoot_cpu_to_le16_compile_time (VasEBoot_PE32_MACHINE_I386))
|
||||
break;
|
||||
if (type == IS_64_EFI
|
||||
&& 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;
|
||||
if (type == IS_IA_EFI
|
||||
&& coff_head.machine !=
|
||||
grub_cpu_to_le16_compile_time (GRUB_PE32_MACHINE_IA64))
|
||||
VasEBoot_cpu_to_le16_compile_time (VasEBoot_PE32_MACHINE_IA64))
|
||||
break;
|
||||
if (type == IS_ARM64_EFI
|
||||
&& coff_head.machine !=
|
||||
grub_cpu_to_le16_compile_time (GRUB_PE32_MACHINE_ARM64))
|
||||
VasEBoot_cpu_to_le16_compile_time (VasEBoot_PE32_MACHINE_ARM64))
|
||||
break;
|
||||
if (type == IS_ARM_EFI
|
||||
&& 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;
|
||||
if (type == IS_IA_EFI || type == IS_64_EFI || type == IS_ARM64_EFI)
|
||||
{
|
||||
struct grub_pe64_optional_header o64;
|
||||
if (grub_file_read (file, &o64, sizeof (o64)) != sizeof (o64))
|
||||
struct VasEBoot_pe64_optional_header o64;
|
||||
if (VasEBoot_file_read (file, &o64, sizeof (o64)) != sizeof (o64))
|
||||
break;
|
||||
if (o64.magic !=
|
||||
grub_cpu_to_le16_compile_time (GRUB_PE32_PE64_MAGIC))
|
||||
VasEBoot_cpu_to_le16_compile_time (VasEBoot_PE32_PE64_MAGIC))
|
||||
break;
|
||||
if (o64.subsystem !=
|
||||
grub_cpu_to_le16_compile_time
|
||||
(GRUB_PE32_SUBSYSTEM_EFI_APPLICATION))
|
||||
VasEBoot_cpu_to_le16_compile_time
|
||||
(VasEBoot_PE32_SUBSYSTEM_EFI_APPLICATION))
|
||||
break;
|
||||
ret = 1;
|
||||
break;
|
||||
}
|
||||
if (type == IS_32_EFI || type == IS_ARM_EFI)
|
||||
{
|
||||
struct grub_pe32_optional_header o32;
|
||||
if (grub_file_read (file, &o32, sizeof (o32)) != sizeof (o32))
|
||||
struct VasEBoot_pe32_optional_header o32;
|
||||
if (VasEBoot_file_read (file, &o32, sizeof (o32)) != sizeof (o32))
|
||||
break;
|
||||
if (o32.magic !=
|
||||
grub_cpu_to_le16_compile_time (GRUB_PE32_PE32_MAGIC))
|
||||
VasEBoot_cpu_to_le16_compile_time (VasEBoot_PE32_PE32_MAGIC))
|
||||
break;
|
||||
if (o32.subsystem !=
|
||||
grub_cpu_to_le16_compile_time
|
||||
(GRUB_PE32_SUBSYSTEM_EFI_APPLICATION))
|
||||
VasEBoot_cpu_to_le16_compile_time
|
||||
(VasEBoot_PE32_SUBSYSTEM_EFI_APPLICATION))
|
||||
break;
|
||||
ret = 1;
|
||||
break;
|
||||
|
|
@ -650,30 +650,30 @@ grub_cmd_file (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
}
|
||||
|
||||
if (elf)
|
||||
grub_elf_close (elf);
|
||||
VasEBoot_elf_close (elf);
|
||||
else if (macho)
|
||||
grub_macho_close (macho);
|
||||
VasEBoot_macho_close (macho);
|
||||
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,
|
||||
opposite of "true". */
|
||||
grub_error (GRUB_ERR_TEST_FAILURE, N_("false"));
|
||||
return grub_errno;
|
||||
VasEBoot_error (VasEBoot_ERR_TEST_FAILURE, N_("false"));
|
||||
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_("Check if FILE is of specified type."),
|
||||
options);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(file)
|
||||
VasEBoot_MOD_FINI(file)
|
||||
{
|
||||
grub_unregister_extcmd (cmd);
|
||||
VasEBoot_unregister_extcmd (cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#define GRUB_TARGET_WORDSIZE 32
|
||||
#define VasEBoot_TARGET_WORDSIZE 32
|
||||
#define XX 32
|
||||
#define ehdrXX ehdr32
|
||||
#define grub_file_check_netbsdXX grub_file_check_netbsd32
|
||||
#define VasEBoot_file_check_netbsdXX VasEBoot_file_check_netbsd32
|
||||
#include "fileXX.c"
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
#define GRUB_TARGET_WORDSIZE 64
|
||||
#define VasEBoot_TARGET_WORDSIZE 64
|
||||
#define XX 64
|
||||
#define ehdrXX ehdr64
|
||||
#define grub_file_check_netbsdXX grub_file_check_netbsd64
|
||||
#define VasEBoot_file_check_netbsdXX VasEBoot_file_check_netbsd64
|
||||
#include "fileXX.c"
|
||||
|
|
|
|||
|
|
@ -1,48 +1,48 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/fileid.h>
|
||||
#include <grub/elfload.h>
|
||||
#include <grub/misc.h>
|
||||
#include <VasEBoot/fileid.h>
|
||||
#include <VasEBoot/elfload.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
|
||||
#pragma GCC diagnostic ignored "-Wcast-align"
|
||||
|
||||
int
|
||||
grub_file_check_netbsdXX (grub_elf_t elf)
|
||||
VasEBoot_file_check_netbsdXX (VasEBoot_elf_t elf)
|
||||
{
|
||||
Elf_Shdr *s, *s0;
|
||||
|
||||
grub_size_t shnum = elf->ehdr.ehdrXX.e_shnum;
|
||||
grub_size_t shentsize = elf->ehdr.ehdrXX.e_shentsize;
|
||||
grub_size_t shsize = shnum * shentsize;
|
||||
grub_off_t stroff;
|
||||
VasEBoot_size_t shnum = elf->ehdr.ehdrXX.e_shnum;
|
||||
VasEBoot_size_t shentsize = elf->ehdr.ehdrXX.e_shentsize;
|
||||
VasEBoot_size_t shsize = shnum * shentsize;
|
||||
VasEBoot_off_t stroff;
|
||||
|
||||
if (!shnum || !shentsize)
|
||||
return 0;
|
||||
|
||||
s0 = grub_malloc (shsize);
|
||||
s0 = VasEBoot_malloc (shsize);
|
||||
if (!s0)
|
||||
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;
|
||||
|
||||
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;
|
||||
|
||||
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))
|
||||
{
|
||||
char name[sizeof(".note.netbsd.ident")];
|
||||
grub_memset (name, 0, sizeof (name));
|
||||
if (grub_file_seek (elf->file, stroff + s->sh_name) == (grub_off_t) -1)
|
||||
VasEBoot_memset (name, 0, sizeof (name));
|
||||
if (VasEBoot_file_seek (elf->file, stroff + s->sh_name) == (VasEBoot_off_t) -1)
|
||||
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;
|
||||
continue;
|
||||
}
|
||||
if (grub_memcmp (name, ".note.netbsd.ident",
|
||||
if (VasEBoot_memcmp (name, ".note.netbsd.ident",
|
||||
sizeof(".note.netbsd.ident")) != 0)
|
||||
continue;
|
||||
grub_free (s0);
|
||||
VasEBoot_free (s0);
|
||||
return 1;
|
||||
}
|
||||
fail:
|
||||
grub_free (s0);
|
||||
VasEBoot_free (s0);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,31 +1,31 @@
|
|||
/* fwconfig.c - command to read config from qemu fwconfig */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/cpu/io.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/mm.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/extcmd.h>
|
||||
#include <VasEBoot/env.h>
|
||||
#include <VasEBoot/cpu/io.h>
|
||||
#include <VasEBoot/i18n.h>
|
||||
#include <VasEBoot/mm.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
VasEBoot_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
#define SELECTOR 0x510
|
||||
#define DATA 0x511
|
||||
|
|
@ -33,90 +33,90 @@ GRUB_MOD_LICENSE ("GPLv3+");
|
|||
#define SIGNATURE_INDEX 0x00
|
||||
#define DIRECTORY_INDEX 0x19
|
||||
|
||||
static grub_extcmd_t cmd_read_fwconfig;
|
||||
static VasEBoot_extcmd_t cmd_read_fwconfig;
|
||||
|
||||
struct grub_qemu_fwcfgfile {
|
||||
grub_uint32_t size;
|
||||
grub_uint16_t select;
|
||||
grub_uint16_t reserved;
|
||||
struct VasEBoot_qemu_fwcfgfile {
|
||||
VasEBoot_uint32_t size;
|
||||
VasEBoot_uint16_t select;
|
||||
VasEBoot_uint16_t reserved;
|
||||
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."),
|
||||
N_("VARNAME"), ARG_TYPE_STRING},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_fwconfig (grub_extcmd_context_t ctxt __attribute__ ((unused)),
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_fwconfig (VasEBoot_extcmd_context_t ctxt __attribute__ ((unused)),
|
||||
int argc, char **argv)
|
||||
{
|
||||
grub_uint32_t i, j, value = 0;
|
||||
struct grub_qemu_fwcfgfile file;
|
||||
VasEBoot_uint32_t i, j, value = 0;
|
||||
struct VasEBoot_qemu_fwcfgfile file;
|
||||
char fwsig[4], signature[4] = { 'Q', 'E', 'M', 'U' };
|
||||
|
||||
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 */
|
||||
grub_outw(SIGNATURE_INDEX, SELECTOR);
|
||||
VasEBoot_outw(SIGNATURE_INDEX, SELECTOR);
|
||||
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)
|
||||
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]);
|
||||
if (VasEBoot_memcmp(fwsig, signature, sizeof(signature)) != 0)
|
||||
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 */
|
||||
grub_outw(DIRECTORY_INDEX, SELECTOR);
|
||||
value = grub_inb(DATA) | grub_inb(DATA) << 8 | grub_inb(DATA) << 16 | grub_inb(DATA) << 24;
|
||||
value = grub_be_to_cpu32(value);
|
||||
VasEBoot_outw(DIRECTORY_INDEX, SELECTOR);
|
||||
value = VasEBoot_inb(DATA) | VasEBoot_inb(DATA) << 8 | VasEBoot_inb(DATA) << 16 | VasEBoot_inb(DATA) << 24;
|
||||
value = VasEBoot_be_to_cpu32(value);
|
||||
/* Read the file description for each file */
|
||||
for (i=0; i<value; i++)
|
||||
{
|
||||
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 */
|
||||
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);
|
||||
grub_uint16_t location = grub_be_to_cpu16(file.select);
|
||||
char *data = grub_malloc(filesize+1);
|
||||
VasEBoot_uint32_t filesize = VasEBoot_be_to_cpu32(file.size);
|
||||
VasEBoot_uint16_t location = VasEBoot_be_to_cpu16(file.select);
|
||||
char *data = VasEBoot_malloc(filesize+1);
|
||||
|
||||
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++)
|
||||
{
|
||||
data[j] = grub_inb(DATA);
|
||||
data[j] = VasEBoot_inb(DATA);
|
||||
}
|
||||
|
||||
data[filesize] = '\0';
|
||||
|
||||
grub_env_set (argv[1], data);
|
||||
VasEBoot_env_set (argv[1], data);
|
||||
|
||||
grub_free(data);
|
||||
VasEBoot_free(data);
|
||||
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 =
|
||||
grub_register_extcmd ("fwconfig", grub_cmd_fwconfig, 0,
|
||||
VasEBoot_register_extcmd ("fwconfig", VasEBoot_cmd_fwconfig, 0,
|
||||
N_("PATH VAR"),
|
||||
N_("Set VAR to the contents of fwconfig PATH"),
|
||||
options);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(fwconfig)
|
||||
VasEBoot_MOD_FINI(fwconfig)
|
||||
{
|
||||
grub_unregister_extcmd (cmd_read_fwconfig);
|
||||
VasEBoot_unregister_extcmd (cmd_read_fwconfig);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,34 +1,34 @@
|
|||
/* gptprio.c - manage priority based partition selection. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* Copyright (C) 2009 Free Software Foundation, 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/device.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/gpt_partition.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/misc.h>
|
||||
#include <VasEBoot/device.h>
|
||||
#include <VasEBoot/env.h>
|
||||
#include <VasEBoot/err.h>
|
||||
#include <VasEBoot/extcmd.h>
|
||||
#include <VasEBoot/gpt_partition.h>
|
||||
#include <VasEBoot/i18n.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,
|
||||
N_("Set a variable to the name of selected partition."),
|
||||
N_("VARNAME"), ARG_TYPE_STRING},
|
||||
|
|
@ -45,67 +45,67 @@ enum options_next
|
|||
};
|
||||
|
||||
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
|
||||
(entry, GRUB_GPT_PART_ATTR_OFFSET_GPTPRIO_PRIORITY, 4);
|
||||
return (unsigned int) VasEBoot_gpt_entry_attribute
|
||||
(entry, VasEBoot_GPT_PART_ATTR_OFFSET_GPTPRIO_PRIORITY, 4);
|
||||
}
|
||||
|
||||
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
|
||||
(entry, GRUB_GPT_PART_ATTR_OFFSET_GPTPRIO_TRIES_LEFT, 4);
|
||||
return (unsigned int) VasEBoot_gpt_entry_attribute
|
||||
(entry, VasEBoot_GPT_PART_ATTR_OFFSET_GPTPRIO_TRIES_LEFT, 4);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
grub_gpt_entry_set_attribute
|
||||
(entry, tries_left, GRUB_GPT_PART_ATTR_OFFSET_GPTPRIO_TRIES_LEFT, 4);
|
||||
VasEBoot_gpt_entry_set_attribute
|
||||
(entry, tries_left, VasEBoot_GPT_PART_ATTR_OFFSET_GPTPRIO_TRIES_LEFT, 4);
|
||||
}
|
||||
|
||||
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
|
||||
(entry, GRUB_GPT_PART_ATTR_OFFSET_GPTPRIO_SUCCESSFUL, 1);
|
||||
return (unsigned int) VasEBoot_gpt_entry_attribute
|
||||
(entry, VasEBoot_GPT_PART_ATTR_OFFSET_GPTPRIO_SUCCESSFUL, 1);
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_find_next (const char *disk_name,
|
||||
const grub_gpt_part_type_t *part_type,
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_find_next (const char *disk_name,
|
||||
const VasEBoot_gpt_part_type_t *part_type,
|
||||
char **part_name, char **part_guid)
|
||||
{
|
||||
struct grub_gpt_partentry *part, *part_found = NULL;
|
||||
grub_device_t dev = NULL;
|
||||
grub_gpt_t gpt = NULL;
|
||||
grub_uint32_t i, part_index;
|
||||
struct VasEBoot_gpt_partentry *part, *part_found = NULL;
|
||||
VasEBoot_device_t dev = NULL;
|
||||
VasEBoot_gpt_t gpt = NULL;
|
||||
VasEBoot_uint32_t i, part_index;
|
||||
|
||||
dev = grub_device_open (disk_name);
|
||||
dev = VasEBoot_device_open (disk_name);
|
||||
if (!dev)
|
||||
goto done;
|
||||
|
||||
gpt = grub_gpt_read (dev->disk);
|
||||
gpt = VasEBoot_gpt_read (dev->disk);
|
||||
if (!gpt)
|
||||
goto done;
|
||||
|
||||
if (grub_gpt_repair (dev->disk, gpt))
|
||||
if (VasEBoot_gpt_repair (dev->disk, gpt))
|
||||
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;
|
||||
|
||||
priority = grub_gptprio_priority (part);
|
||||
tries_left = grub_gptprio_tries_left (part);
|
||||
successful = grub_gptprio_successful (part);
|
||||
priority = VasEBoot_gptprio_priority (part);
|
||||
tries_left = VasEBoot_gptprio_tries_left (part);
|
||||
successful = VasEBoot_gptprio_successful (part);
|
||||
|
||||
if (part_found)
|
||||
old_priority = grub_gptprio_priority (part_found);
|
||||
old_priority = VasEBoot_gptprio_priority (part_found);
|
||||
|
||||
if ((tries_left || successful) && priority > old_priority)
|
||||
{
|
||||
|
|
@ -117,66 +117,66 @@ grub_find_next (const char *disk_name,
|
|||
|
||||
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;
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
if (grub_gpt_write (dev->disk, gpt))
|
||||
if (VasEBoot_gpt_write (dev->disk, gpt))
|
||||
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)
|
||||
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)
|
||||
goto done;
|
||||
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
VasEBoot_errno = VasEBoot_ERR_NONE;
|
||||
|
||||
done:
|
||||
grub_gpt_free (gpt);
|
||||
VasEBoot_gpt_free (gpt);
|
||||
|
||||
if (dev)
|
||||
grub_device_close (dev);
|
||||
VasEBoot_device_close (dev);
|
||||
|
||||
return grub_errno;
|
||||
return VasEBoot_errno;
|
||||
}
|
||||
|
||||
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_next (grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
static VasEBoot_err_t
|
||||
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;
|
||||
|
||||
/* 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)
|
||||
{
|
||||
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;
|
||||
}
|
||||
|
||||
if (argc == 0)
|
||||
root = grub_strdup (grub_env_get ("root"));
|
||||
root = VasEBoot_strdup (VasEBoot_env_get ("root"));
|
||||
else if (argc == 1)
|
||||
root = grub_strdup (args[0]);
|
||||
root = VasEBoot_strdup (args[0]);
|
||||
else
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("unexpected arguments"));
|
||||
VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, N_("unexpected arguments"));
|
||||
goto done;
|
||||
}
|
||||
|
||||
|
|
@ -184,40 +184,40 @@ grub_cmd_next (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
goto done;
|
||||
|
||||
/* To make using $root practical strip off the partition name. */
|
||||
p = grub_strchr (root, ',');
|
||||
p = VasEBoot_strchr (root, ',');
|
||||
if (p)
|
||||
*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;
|
||||
|
||||
if (grub_env_set (state[NEXT_SET_DEVICE].arg, part_name))
|
||||
if (VasEBoot_env_set (state[NEXT_SET_DEVICE].arg, part_name))
|
||||
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;
|
||||
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
VasEBoot_errno = VasEBoot_ERR_NONE;
|
||||
|
||||
done:
|
||||
grub_free (root);
|
||||
grub_free (part_name);
|
||||
grub_free (part_guid);
|
||||
VasEBoot_free (root);
|
||||
VasEBoot_free (part_name);
|
||||
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_("Select next partition to boot."),
|
||||
options_next);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(gptprio)
|
||||
VasEBoot_MOD_FINI(gptprio)
|
||||
{
|
||||
grub_unregister_extcmd (cmd_next);
|
||||
VasEBoot_unregister_extcmd (cmd_next);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,36 +1,36 @@
|
|||
/* 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) 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/command.h>
|
||||
#include <grub/device.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/gpt_partition.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/misc.h>
|
||||
#include <VasEBoot/command.h>
|
||||
#include <VasEBoot/device.h>
|
||||
#include <VasEBoot/err.h>
|
||||
#include <VasEBoot/gpt_partition.h>
|
||||
#include <VasEBoot/i18n.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
VasEBoot_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static char *
|
||||
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] == ')')
|
||||
{
|
||||
name[len - 1] = '\0';
|
||||
|
|
@ -39,72 +39,72 @@ trim_dev_name (char *name)
|
|||
return name;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_gptrepair (grub_command_t cmd __attribute__ ((unused)),
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_gptrepair (VasEBoot_command_t cmd __attribute__ ((unused)),
|
||||
int argc, char **args)
|
||||
{
|
||||
grub_device_t dev = NULL;
|
||||
grub_gpt_t gpt = NULL;
|
||||
VasEBoot_device_t dev = NULL;
|
||||
VasEBoot_gpt_t gpt = NULL;
|
||||
char *dev_name;
|
||||
|
||||
if (argc != 1 || !grub_strlen(args[0]))
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "device name required");
|
||||
if (argc != 1 || !VasEBoot_strlen(args[0]))
|
||||
return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, "device name required");
|
||||
|
||||
dev_name = trim_dev_name (args[0]);
|
||||
dev = grub_device_open (dev_name);
|
||||
dev = VasEBoot_device_open (dev_name);
|
||||
if (!dev)
|
||||
goto done;
|
||||
|
||||
if (!dev->disk)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "not a disk");
|
||||
VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, "not a disk");
|
||||
goto done;
|
||||
}
|
||||
|
||||
gpt = grub_gpt_read (dev->disk);
|
||||
gpt = VasEBoot_gpt_read (dev->disk);
|
||||
if (!gpt)
|
||||
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;
|
||||
}
|
||||
|
||||
if (!grub_gpt_primary_valid (gpt))
|
||||
grub_printf_ (N_("Found invalid primary GPT on %s\n"), dev_name);
|
||||
if (!VasEBoot_gpt_primary_valid (gpt))
|
||||
VasEBoot_printf_ (N_("Found invalid primary GPT on %s\n"), dev_name);
|
||||
|
||||
if (!grub_gpt_backup_valid (gpt))
|
||||
grub_printf_ (N_("Found invalid backup GPT on %s\n"), dev_name);
|
||||
if (!VasEBoot_gpt_backup_valid (gpt))
|
||||
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;
|
||||
|
||||
if (grub_gpt_write (dev->disk, gpt))
|
||||
if (VasEBoot_gpt_write (dev->disk, gpt))
|
||||
goto done;
|
||||
|
||||
grub_printf_ (N_("Repaired GPT on %s\n"), dev_name);
|
||||
VasEBoot_printf_ (N_("Repaired GPT on %s\n"), dev_name);
|
||||
|
||||
done:
|
||||
if (gpt)
|
||||
grub_gpt_free (gpt);
|
||||
VasEBoot_gpt_free (gpt);
|
||||
|
||||
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_("Verify and repair GPT on drive DEVICE."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(gptrepair)
|
||||
VasEBoot_MOD_FINI(gptrepair)
|
||||
{
|
||||
grub_unregister_command (cmd);
|
||||
VasEBoot_unregister_command (cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,47 +1,47 @@
|
|||
/* gptsync.c - fill the mbr based on gpt entries */
|
||||
/* 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.
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/command.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/device.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/msdos_partition.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/fs.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <VasEBoot/command.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/device.h>
|
||||
#include <VasEBoot/disk.h>
|
||||
#include <VasEBoot/msdos_partition.h>
|
||||
#include <VasEBoot/partition.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/mm.h>
|
||||
#include <VasEBoot/fs.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. */
|
||||
/* Taken from grub1. */
|
||||
/* Taken from VasEBoot1. */
|
||||
/* XXX: use hardcoded geometry of C = 1024, H = 255, S = 63.
|
||||
Is it a problem?
|
||||
*/
|
||||
static void
|
||||
lba_to_chs (grub_uint32_t lba, grub_uint8_t *cl, grub_uint8_t *ch,
|
||||
grub_uint8_t *dh)
|
||||
lba_to_chs (VasEBoot_uint32_t lba, VasEBoot_uint8_t *cl, VasEBoot_uint8_t *ch,
|
||||
VasEBoot_uint8_t *dh)
|
||||
{
|
||||
grub_uint32_t cylinder, head, sector;
|
||||
grub_uint32_t sectors = 63, heads = 255, cylinders = 1024;
|
||||
VasEBoot_uint32_t cylinder, head, sector;
|
||||
VasEBoot_uint32_t sectors = 63, heads = 255, cylinders = 1024;
|
||||
|
||||
sector = lba % sectors + 1;
|
||||
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;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)),
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_gptsync (VasEBoot_command_t cmd __attribute__ ((unused)),
|
||||
int argc, char **args)
|
||||
{
|
||||
grub_device_t dev;
|
||||
struct grub_msdos_partition_mbr mbr;
|
||||
struct grub_partition *partition;
|
||||
grub_disk_addr_t first_sector;
|
||||
VasEBoot_device_t dev;
|
||||
struct VasEBoot_msdos_partition_mbr mbr;
|
||||
struct VasEBoot_partition *partition;
|
||||
VasEBoot_disk_addr_t first_sector;
|
||||
int numactive = 0;
|
||||
int i;
|
||||
|
||||
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)
|
||||
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");
|
||||
|
||||
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;
|
||||
dev = grub_device_open (args[0] + 1);
|
||||
args[0][grub_strlen (args[0])] = ')';
|
||||
args[0][VasEBoot_strlen (args[0]) - 1] = 0;
|
||||
dev = VasEBoot_device_open (args[0] + 1);
|
||||
args[0][VasEBoot_strlen (args[0])] = ')';
|
||||
}
|
||||
else
|
||||
dev = grub_device_open (args[0]);
|
||||
dev = VasEBoot_device_open (args[0]);
|
||||
|
||||
if (! dev)
|
||||
return grub_errno;
|
||||
return VasEBoot_errno;
|
||||
|
||||
if (! dev->disk)
|
||||
{
|
||||
grub_device_close (dev);
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "not a disk");
|
||||
VasEBoot_device_close (dev);
|
||||
return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, "not a disk");
|
||||
}
|
||||
|
||||
/* 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);
|
||||
return grub_errno;
|
||||
VasEBoot_device_close (dev);
|
||||
return VasEBoot_errno;
|
||||
}
|
||||
|
||||
/* 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);
|
||||
return grub_error (GRUB_ERR_BAD_PART_TABLE, "no signature");
|
||||
VasEBoot_device_close (dev);
|
||||
return VasEBoot_error (VasEBoot_ERR_BAD_PART_TABLE, "no signature");
|
||||
}
|
||||
|
||||
/* Make sure the MBR is a protective MBR and not a normal MBR. */
|
||||
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;
|
||||
if (i == 4)
|
||||
{
|
||||
grub_device_close (dev);
|
||||
return grub_error (GRUB_ERR_BAD_PART_TABLE, "no GPT partition map found");
|
||||
VasEBoot_device_close (dev);
|
||||
return VasEBoot_error (VasEBoot_ERR_BAD_PART_TABLE, "no GPT partition map found");
|
||||
}
|
||||
|
||||
first_sector = dev->disk->total_sectors;
|
||||
for (i = 1; i < argc; i++)
|
||||
{
|
||||
char *separator, csep = 0;
|
||||
grub_uint8_t type;
|
||||
separator = grub_strchr (args[i], '+');
|
||||
VasEBoot_uint8_t type;
|
||||
separator = VasEBoot_strchr (args[i], '+');
|
||||
if (! separator)
|
||||
separator = grub_strchr (args[i], '-');
|
||||
separator = VasEBoot_strchr (args[i], '-');
|
||||
if (separator)
|
||||
{
|
||||
csep = *separator;
|
||||
*separator = 0;
|
||||
}
|
||||
partition = grub_partition_probe (dev->disk, args[i]);
|
||||
partition = VasEBoot_partition_probe (dev->disk, args[i]);
|
||||
if (separator)
|
||||
*separator = csep;
|
||||
if (! partition)
|
||||
{
|
||||
grub_device_close (dev);
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
|
||||
VasEBoot_device_close (dev);
|
||||
return VasEBoot_error (VasEBoot_ERR_UNKNOWN_DEVICE,
|
||||
N_("no such partition"));
|
||||
}
|
||||
|
||||
if (partition->start + partition->len > 0xffffffff)
|
||||
{
|
||||
grub_device_close (dev);
|
||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
VasEBoot_device_close (dev);
|
||||
return VasEBoot_error (VasEBoot_ERR_OUT_OF_RANGE,
|
||||
"only partitions residing in the first 2TB "
|
||||
"can be present in hybrid MBR");
|
||||
}
|
||||
|
|
@ -153,31 +153,31 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)),
|
|||
first_sector = partition->start;
|
||||
|
||||
if (separator && *(separator + 1))
|
||||
type = grub_strtoul (separator + 1, 0, 0);
|
||||
type = VasEBoot_strtoul (separator + 1, 0, 0);
|
||||
else
|
||||
{
|
||||
grub_fs_t fs = 0;
|
||||
VasEBoot_fs_t fs = 0;
|
||||
dev->disk->partition = partition;
|
||||
fs = grub_fs_probe (dev);
|
||||
fs = VasEBoot_fs_probe (dev);
|
||||
|
||||
/* Unknown filesystem isn't fatal. */
|
||||
if (grub_errno == GRUB_ERR_UNKNOWN_FS)
|
||||
if (VasEBoot_errno == VasEBoot_ERR_UNKNOWN_FS)
|
||||
{
|
||||
fs = 0;
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
VasEBoot_errno = VasEBoot_ERR_NONE;
|
||||
}
|
||||
|
||||
if (fs && grub_strcmp (fs->name, "ntfs") == 0)
|
||||
type = GRUB_PC_PARTITION_TYPE_NTFS;
|
||||
else if (fs && grub_strcmp (fs->name, "fat") == 0)
|
||||
if (fs && VasEBoot_strcmp (fs->name, "ntfs") == 0)
|
||||
type = VasEBoot_PC_PARTITION_TYPE_NTFS;
|
||||
else if (fs && VasEBoot_strcmp (fs->name, "fat") == 0)
|
||||
/* FIXME: detect FAT16. */
|
||||
type = GRUB_PC_PARTITION_TYPE_FAT32_LBA;
|
||||
else if (fs && (grub_strcmp (fs->name, "hfsplus") == 0
|
||||
|| grub_strcmp (fs->name, "hfs") == 0))
|
||||
type = GRUB_PC_PARTITION_TYPE_HFS;
|
||||
type = VasEBoot_PC_PARTITION_TYPE_FAT32_LBA;
|
||||
else if (fs && (VasEBoot_strcmp (fs->name, "hfsplus") == 0
|
||||
|| VasEBoot_strcmp (fs->name, "hfs") == 0))
|
||||
type = VasEBoot_PC_PARTITION_TYPE_HFS;
|
||||
else
|
||||
/* FIXME: detect more types. */
|
||||
type = GRUB_PC_PARTITION_TYPE_EXT2FS;
|
||||
type = VasEBoot_PC_PARTITION_TYPE_EXT2FS;
|
||||
|
||||
dev->disk->partition = 0;
|
||||
}
|
||||
|
|
@ -188,13 +188,13 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)),
|
|||
numactive++;
|
||||
if (numactive == 2)
|
||||
{
|
||||
grub_device_close (dev);
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
VasEBoot_device_close (dev);
|
||||
return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT,
|
||||
"only one partition can be active");
|
||||
}
|
||||
}
|
||||
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,
|
||||
&(mbr.entries[i].start_sector),
|
||||
&(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_cylinder),
|
||||
&(mbr.entries[i].end_head));
|
||||
mbr.entries[i].length = grub_cpu_to_le32 (partition->len);
|
||||
grub_free (partition);
|
||||
mbr.entries[i].length = VasEBoot_cpu_to_le32 (partition->len);
|
||||
VasEBoot_free (partition);
|
||||
}
|
||||
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. */
|
||||
if (first_sector > 0xffffffff)
|
||||
|
|
@ -215,8 +215,8 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)),
|
|||
else
|
||||
first_sector--;
|
||||
mbr.entries[0].flag = 0;
|
||||
mbr.entries[0].type = GRUB_PC_PARTITION_TYPE_GPT_DISK;
|
||||
mbr.entries[0].start = grub_cpu_to_le32_compile_time (1);
|
||||
mbr.entries[0].type = VasEBoot_PC_PARTITION_TYPE_GPT_DISK;
|
||||
mbr.entries[0].start = VasEBoot_cpu_to_le32_compile_time (1);
|
||||
lba_to_chs (1,
|
||||
&(mbr.entries[0].start_sector),
|
||||
&(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_cylinder),
|
||||
&(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);
|
||||
return grub_errno;
|
||||
VasEBoot_device_close (dev);
|
||||
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. */
|
||||
cmd = grub_register_command ("gptsync", grub_cmd_gptsync,
|
||||
cmd = VasEBoot_register_command ("gptsync", VasEBoot_cmd_gptsync,
|
||||
N_("DEVICE [PARTITION[+/-[TYPE]]] ..."),
|
||||
/* TRANSLATORS: MBR type is one-byte partition
|
||||
type id. */
|
||||
|
|
@ -260,7 +260,7 @@ GRUB_MOD_INIT(gptsync)
|
|||
"Only one partition can be active."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(gptsync)
|
||||
VasEBoot_MOD_FINI(gptsync)
|
||||
{
|
||||
grub_unregister_command (cmd);
|
||||
VasEBoot_unregister_command (cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,47 +1,47 @@
|
|||
/* halt.c - command to halt the computer. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/command.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
VasEBoot_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_err_t __attribute__ ((noreturn))
|
||||
grub_cmd_halt (grub_command_t cmd __attribute__ ((unused)),
|
||||
static VasEBoot_err_t __attribute__ ((noreturn))
|
||||
VasEBoot_cmd_halt (VasEBoot_command_t cmd __attribute__ ((unused)),
|
||||
int argc __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"
|
||||
" not work on all firmware implementations."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(halt)
|
||||
VasEBoot_MOD_FINI(halt)
|
||||
{
|
||||
grub_unregister_command (cmd);
|
||||
VasEBoot_unregister_command (cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,34 +1,34 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/crypto.h>
|
||||
#include <grub/normal.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/extcmd.h>
|
||||
#include <VasEBoot/file.h>
|
||||
#include <VasEBoot/disk.h>
|
||||
#include <VasEBoot/mm.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/crypto.h>
|
||||
#include <VasEBoot/normal.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},
|
||||
{"check", 'c', 0, N_("Check hashes of files with hash list FILE."),
|
||||
N_("FILE"), ARG_TYPE_STRING},
|
||||
|
|
@ -60,24 +60,24 @@ hextoval (char c)
|
|||
return -1;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
hash_file (grub_file_t file, const gcry_md_spec_t *hash, void *result)
|
||||
static VasEBoot_err_t
|
||||
hash_file (VasEBoot_file_t file, const gcry_md_spec_t *hash, void *result)
|
||||
{
|
||||
void *context;
|
||||
grub_uint8_t *readbuf;
|
||||
VasEBoot_uint8_t *readbuf;
|
||||
#define BUF_SIZE 4096
|
||||
readbuf = grub_malloc (BUF_SIZE);
|
||||
readbuf = VasEBoot_malloc (BUF_SIZE);
|
||||
if (!readbuf)
|
||||
return grub_errno;
|
||||
context = grub_zalloc (hash->contextsize);
|
||||
return VasEBoot_errno;
|
||||
context = VasEBoot_zalloc (hash->contextsize);
|
||||
if (!readbuf || !context)
|
||||
goto fail;
|
||||
|
||||
hash->init (context);
|
||||
while (1)
|
||||
{
|
||||
grub_ssize_t r;
|
||||
r = grub_file_read (file, readbuf, BUF_SIZE);
|
||||
VasEBoot_ssize_t r;
|
||||
r = VasEBoot_file_read (file, readbuf, BUF_SIZE);
|
||||
if (r < 0)
|
||||
goto fail;
|
||||
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->final (context);
|
||||
grub_memcpy (result, hash->read (context), hash->mdlen);
|
||||
VasEBoot_memcpy (result, hash->read (context), hash->mdlen);
|
||||
|
||||
grub_free (readbuf);
|
||||
grub_free (context);
|
||||
VasEBoot_free (readbuf);
|
||||
VasEBoot_free (context);
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
return VasEBoot_ERR_NONE;
|
||||
|
||||
fail:
|
||||
grub_free (readbuf);
|
||||
grub_free (context);
|
||||
return grub_errno;
|
||||
VasEBoot_free (readbuf);
|
||||
VasEBoot_free (context);
|
||||
return VasEBoot_errno;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
static VasEBoot_err_t
|
||||
check_list (const gcry_md_spec_t *hash, const char *hashfilename,
|
||||
const char *prefix, int keep, int uncompress)
|
||||
{
|
||||
grub_file_t hashlist, file;
|
||||
VasEBoot_file_t hashlist, file;
|
||||
char *buf = NULL;
|
||||
grub_uint8_t expected[GRUB_CRYPTO_MAX_MDLEN];
|
||||
grub_uint8_t actual[GRUB_CRYPTO_MAX_MDLEN];
|
||||
grub_err_t err;
|
||||
VasEBoot_uint8_t expected[VasEBoot_CRYPTO_MAX_MDLEN];
|
||||
VasEBoot_uint8_t actual[VasEBoot_CRYPTO_MAX_MDLEN];
|
||||
VasEBoot_err_t err;
|
||||
unsigned i;
|
||||
unsigned unread = 0, mismatch = 0;
|
||||
|
||||
if (hash->mdlen > GRUB_CRYPTO_MAX_MDLEN)
|
||||
return grub_error (GRUB_ERR_BUG, "mdlen is too long");
|
||||
if (hash->mdlen > VasEBoot_CRYPTO_MAX_MDLEN)
|
||||
return VasEBoot_error (VasEBoot_ERR_BUG, "mdlen is too long");
|
||||
|
||||
hashlist = grub_file_open (hashfilename);
|
||||
hashlist = VasEBoot_file_open (hashfilename);
|
||||
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;
|
||||
while (grub_isspace (p[0]))
|
||||
while (VasEBoot_isspace (p[0]))
|
||||
p++;
|
||||
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++);
|
||||
low = hextoval (*p++);
|
||||
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;
|
||||
}
|
||||
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;
|
||||
if (prefix)
|
||||
{
|
||||
char *filename;
|
||||
|
||||
filename = grub_xasprintf ("%s/%s", prefix, p);
|
||||
filename = VasEBoot_xasprintf ("%s/%s", prefix, p);
|
||||
if (!filename)
|
||||
return grub_errno;
|
||||
return VasEBoot_errno;
|
||||
if (!uncompress)
|
||||
grub_file_filter_disable_compression ();
|
||||
file = grub_file_open (filename);
|
||||
grub_free (filename);
|
||||
VasEBoot_file_filter_disable_compression ();
|
||||
file = VasEBoot_file_open (filename);
|
||||
VasEBoot_free (filename);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!uncompress)
|
||||
grub_file_filter_disable_compression ();
|
||||
file = grub_file_open (p);
|
||||
VasEBoot_file_filter_disable_compression ();
|
||||
file = VasEBoot_file_open (p);
|
||||
}
|
||||
if (!file)
|
||||
{
|
||||
grub_file_close (hashlist);
|
||||
grub_free (buf);
|
||||
return grub_errno;
|
||||
VasEBoot_file_close (hashlist);
|
||||
VasEBoot_free (buf);
|
||||
return VasEBoot_errno;
|
||||
}
|
||||
err = hash_file (file, hash, actual);
|
||||
grub_file_close (file);
|
||||
VasEBoot_file_close (file);
|
||||
if (err)
|
||||
{
|
||||
grub_printf_ (N_("%s: READ ERROR\n"), p);
|
||||
VasEBoot_printf_ (N_("%s: READ ERROR\n"), p);
|
||||
if (!keep)
|
||||
{
|
||||
grub_file_close (hashlist);
|
||||
grub_free (buf);
|
||||
VasEBoot_file_close (hashlist);
|
||||
VasEBoot_free (buf);
|
||||
return err;
|
||||
}
|
||||
grub_print_error ();
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
VasEBoot_print_error ();
|
||||
VasEBoot_errno = VasEBoot_ERR_NONE;
|
||||
unread++;
|
||||
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)
|
||||
{
|
||||
grub_file_close (hashlist);
|
||||
grub_free (buf);
|
||||
return grub_error (GRUB_ERR_TEST_FAILURE,
|
||||
VasEBoot_file_close (hashlist);
|
||||
VasEBoot_free (buf);
|
||||
return VasEBoot_error (VasEBoot_ERR_TEST_FAILURE,
|
||||
"hash of '%s' mismatches", p);
|
||||
}
|
||||
mismatch++;
|
||||
continue;
|
||||
}
|
||||
grub_printf_ (N_("%s: OK\n"), p);
|
||||
VasEBoot_printf_ (N_("%s: OK\n"), p);
|
||||
}
|
||||
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 "
|
||||
"of %d files mismatches", unread, mismatch);
|
||||
return GRUB_ERR_NONE;
|
||||
return VasEBoot_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_hashsum (struct grub_extcmd_context *ctxt,
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_hashsum (struct VasEBoot_extcmd_context *ctxt,
|
||||
int argc, char **args)
|
||||
{
|
||||
struct grub_arg_list *state = ctxt->state;
|
||||
struct VasEBoot_arg_list *state = ctxt->state;
|
||||
const char *hashname = NULL;
|
||||
const char *prefix = NULL;
|
||||
const gcry_md_spec_t *hash;
|
||||
|
|
@ -210,20 +210,20 @@ grub_cmd_hashsum (struct grub_extcmd_context *ctxt,
|
|||
unsigned unread = 0;
|
||||
|
||||
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;
|
||||
if (state[0].set)
|
||||
hashname = state[0].arg;
|
||||
|
||||
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)
|
||||
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)
|
||||
return grub_error (GRUB_ERR_BUG, "mdlen is too long");
|
||||
if (hash->mdlen > VasEBoot_CRYPTO_MAX_MDLEN)
|
||||
return VasEBoot_error (VasEBoot_ERR_BUG, "mdlen is too long");
|
||||
|
||||
if (state[2].set)
|
||||
prefix = state[2].arg;
|
||||
|
|
@ -231,56 +231,56 @@ grub_cmd_hashsum (struct grub_extcmd_context *ctxt,
|
|||
if (state[1].set)
|
||||
{
|
||||
if (argc != 0)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT,
|
||||
return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT,
|
||||
"--check is incompatible with file list");
|
||||
return check_list (hash, state[1].arg, prefix, keep, uncompress);
|
||||
}
|
||||
|
||||
for (i = 0; i < (unsigned) argc; i++)
|
||||
{
|
||||
GRUB_PROPERLY_ALIGNED_ARRAY (result, GRUB_CRYPTO_MAX_MDLEN);
|
||||
grub_file_t file;
|
||||
grub_err_t err;
|
||||
VasEBoot_PROPERLY_ALIGNED_ARRAY (result, VasEBoot_CRYPTO_MAX_MDLEN);
|
||||
VasEBoot_file_t file;
|
||||
VasEBoot_err_t err;
|
||||
unsigned j;
|
||||
if (!uncompress)
|
||||
grub_file_filter_disable_compression ();
|
||||
file = grub_file_open (args[i]);
|
||||
VasEBoot_file_filter_disable_compression ();
|
||||
file = VasEBoot_file_open (args[i]);
|
||||
if (!file)
|
||||
{
|
||||
if (!keep)
|
||||
return grub_errno;
|
||||
grub_print_error ();
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
return VasEBoot_errno;
|
||||
VasEBoot_print_error ();
|
||||
VasEBoot_errno = VasEBoot_ERR_NONE;
|
||||
unread++;
|
||||
continue;
|
||||
}
|
||||
err = hash_file (file, hash, result);
|
||||
grub_file_close (file);
|
||||
VasEBoot_file_close (file);
|
||||
if (err)
|
||||
{
|
||||
if (!keep)
|
||||
return err;
|
||||
grub_print_error ();
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
VasEBoot_print_error ();
|
||||
VasEBoot_errno = VasEBoot_ERR_NONE;
|
||||
unread++;
|
||||
continue;
|
||||
}
|
||||
for (j = 0; j < hash->mdlen; j++)
|
||||
grub_printf ("%02x", ((grub_uint8_t *) result)[j]);
|
||||
grub_printf (" %s\n", args[i]);
|
||||
VasEBoot_printf ("%02x", ((VasEBoot_uint8_t *) result)[j]);
|
||||
VasEBoot_printf (" %s\n", args[i]);
|
||||
}
|
||||
|
||||
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);
|
||||
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]] "
|
||||
"[FILE1 [FILE2 ...]]"),
|
||||
/* TRANSLATORS: "hash checksum" is just to
|
||||
|
|
@ -288,40 +288,40 @@ GRUB_MOD_INIT(hashsum)
|
|||
just "hash". */
|
||||
N_("Compute or check hash checksum."),
|
||||
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]] "
|
||||
"[FILE1 [FILE2 ...]]"),
|
||||
N_("Compute or check hash checksum."),
|
||||
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]] "
|
||||
"[FILE1 [FILE2 ...]]"),
|
||||
N_("Compute or check hash checksum."),
|
||||
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]] "
|
||||
"[FILE1 [FILE2 ...]]"),
|
||||
N_("Compute or check hash checksum."),
|
||||
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]] "
|
||||
"[FILE1 [FILE2 ...]]"),
|
||||
N_("Compute or check hash checksum."),
|
||||
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]] "
|
||||
"[FILE1 [FILE2 ...]]"),
|
||||
N_("Compute or check hash checksum."),
|
||||
options);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(hashsum)
|
||||
VasEBoot_MOD_FINI(hashsum)
|
||||
{
|
||||
grub_unregister_extcmd (cmd);
|
||||
grub_unregister_extcmd (cmd_md5);
|
||||
grub_unregister_extcmd (cmd_sha1);
|
||||
grub_unregister_extcmd (cmd_sha256);
|
||||
grub_unregister_extcmd (cmd_sha512);
|
||||
grub_unregister_extcmd (cmd_crc);
|
||||
VasEBoot_unregister_extcmd (cmd);
|
||||
VasEBoot_unregister_extcmd (cmd_md5);
|
||||
VasEBoot_unregister_extcmd (cmd_sha1);
|
||||
VasEBoot_unregister_extcmd (cmd_sha256);
|
||||
VasEBoot_unregister_extcmd (cmd_sha512);
|
||||
VasEBoot_unregister_extcmd (cmd_crc);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,35 +1,35 @@
|
|||
/* hdparm.c - command to get/set ATA disk parameters. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/ata.h>
|
||||
#include <grub/scsi.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/lib/hexdump.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <VasEBoot/ata.h>
|
||||
#include <VasEBoot/scsi.h>
|
||||
#include <VasEBoot/disk.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/mm.h>
|
||||
#include <VasEBoot/lib/hexdump.h>
|
||||
#include <VasEBoot/extcmd.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"
|
||||
"(1=low, ..., 254=high, 255=off)."),
|
||||
0, ARG_TYPE_INT},
|
||||
|
|
@ -54,22 +54,22 @@ static const struct grub_arg_option options[] = {
|
|||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
enum grub_ata_smart_commands
|
||||
enum VasEBoot_ata_smart_commands
|
||||
{
|
||||
GRUB_ATA_FEAT_SMART_ENABLE = 0xd8,
|
||||
GRUB_ATA_FEAT_SMART_DISABLE = 0xd9,
|
||||
GRUB_ATA_FEAT_SMART_STATUS = 0xda,
|
||||
VasEBoot_ATA_FEAT_SMART_ENABLE = 0xd8,
|
||||
VasEBoot_ATA_FEAT_SMART_DISABLE = 0xd9,
|
||||
VasEBoot_ATA_FEAT_SMART_STATUS = 0xda,
|
||||
};
|
||||
|
||||
static int quiet = 0;
|
||||
|
||||
static grub_err_t
|
||||
grub_hdparm_do_ata_cmd (grub_ata_t ata, grub_uint8_t cmd,
|
||||
grub_uint8_t features, grub_uint8_t sectors,
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_hdparm_do_ata_cmd (VasEBoot_ata_t ata, VasEBoot_uint8_t cmd,
|
||||
VasEBoot_uint8_t features, VasEBoot_uint8_t sectors,
|
||||
void * buffer, int size)
|
||||
{
|
||||
struct grub_disk_ata_pass_through_parms apt;
|
||||
grub_memset (&apt, 0, sizeof (apt));
|
||||
struct VasEBoot_disk_ata_pass_through_parms apt;
|
||||
VasEBoot_memset (&apt, 0, sizeof (apt));
|
||||
|
||||
apt.taskfile.cmd = cmd;
|
||||
apt.taskfile.features = features;
|
||||
|
|
@ -80,18 +80,18 @@ grub_hdparm_do_ata_cmd (grub_ata_t ata, grub_uint8_t cmd,
|
|||
apt.size = size;
|
||||
|
||||
if (ata->dev->readwrite (ata, &apt, 0))
|
||||
return grub_errno;
|
||||
return VasEBoot_errno;
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
return VasEBoot_ERR_NONE;
|
||||
}
|
||||
|
||||
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;
|
||||
grub_memset (&apt, 0, sizeof (apt));
|
||||
struct VasEBoot_disk_ata_pass_through_parms 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;
|
||||
|
||||
if (ata->dev->readwrite (ata, &apt, 0))
|
||||
|
|
@ -101,12 +101,12 @@ grub_hdparm_do_check_powermode_cmd (grub_ata_t ata)
|
|||
}
|
||||
|
||||
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;
|
||||
grub_memset (&apt, 0, sizeof (apt));
|
||||
struct VasEBoot_disk_ata_pass_through_parms 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.lba_mid = 0x4f;
|
||||
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))
|
||||
return -1;
|
||||
|
||||
if (features == GRUB_ATA_FEAT_SMART_STATUS)
|
||||
if (features == VasEBoot_ATA_FEAT_SMART_STATUS)
|
||||
{
|
||||
if ( apt.taskfile.lba_mid == 0x4f
|
||||
&& apt.taskfile.lba_high == 0xc2)
|
||||
|
|
@ -129,118 +129,118 @@ grub_hdparm_do_smart_cmd (grub_ata_t ata, grub_uint8_t features)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_hdparm_simple_cmd (const char * msg,
|
||||
grub_ata_t ata, grub_uint8_t cmd)
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_hdparm_simple_cmd (const char * msg,
|
||||
VasEBoot_ata_t ata, VasEBoot_uint8_t cmd)
|
||||
{
|
||||
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)
|
||||
grub_printf ("%s\n", ! err ? "" : ": not supported");
|
||||
VasEBoot_printf ("%s\n", ! err ? "" : ": not supported");
|
||||
return err;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_hdparm_set_val_cmd (const char * msg, int val,
|
||||
grub_ata_t ata, grub_uint8_t cmd,
|
||||
grub_uint8_t features, grub_uint8_t sectors)
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_hdparm_set_val_cmd (const char * msg, int val,
|
||||
VasEBoot_ata_t ata, VasEBoot_uint8_t cmd,
|
||||
VasEBoot_uint8_t features, VasEBoot_uint8_t sectors)
|
||||
{
|
||||
if (! quiet && msg && *msg)
|
||||
{
|
||||
if (val >= 0)
|
||||
grub_printf ("Set %s to %d", msg, val);
|
||||
VasEBoot_printf ("Set %s to %d", msg, val);
|
||||
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);
|
||||
|
||||
if (! quiet && msg)
|
||||
grub_printf ("%s\n", ! err ? "" : ": not supported");
|
||||
VasEBoot_printf ("%s\n", ! err ? "" : ": not supported");
|
||||
return err;
|
||||
}
|
||||
|
||||
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;
|
||||
for (i = 0; i < bytes / 2; i++)
|
||||
dest[i] = grub_swap_bytes16 (src16[i]);
|
||||
dest[i] = VasEBoot_swap_bytes16 (src16[i]);
|
||||
dest[i] = 0;
|
||||
return (char *) dest;
|
||||
}
|
||||
|
||||
static void
|
||||
grub_hdparm_print_identify (const grub_uint16_t * idw)
|
||||
VasEBoot_hdparm_print_identify (const VasEBoot_uint16_t * idw)
|
||||
{
|
||||
/* Print identity strings. */
|
||||
grub_uint16_t tmp[21];
|
||||
grub_printf ("Model: \"%.40s\"\n", le16_to_char (tmp, &idw[27], 40));
|
||||
grub_printf ("Firmware: \"%.8s\"\n", le16_to_char (tmp, &idw[23], 8));
|
||||
grub_printf ("Serial: \"%.20s\"\n", le16_to_char (tmp, &idw[10], 20));
|
||||
VasEBoot_uint16_t tmp[21];
|
||||
VasEBoot_printf ("Model: \"%.40s\"\n", le16_to_char (tmp, &idw[27], 40));
|
||||
VasEBoot_printf ("Firmware: \"%.8s\"\n", le16_to_char (tmp, &idw[23], 8));
|
||||
VasEBoot_printf ("Serial: \"%.20s\"\n", le16_to_char (tmp, &idw[10], 20));
|
||||
|
||||
/* Print AAM, APM and SMART settings. */
|
||||
grub_uint16_t features1 = grub_le_to_cpu16 (idw[82]);
|
||||
grub_uint16_t features2 = grub_le_to_cpu16 (idw[83]);
|
||||
grub_uint16_t enabled1 = grub_le_to_cpu16 (idw[85]);
|
||||
grub_uint16_t enabled2 = grub_le_to_cpu16 (idw[86]);
|
||||
VasEBoot_uint16_t features1 = VasEBoot_le_to_cpu16 (idw[82]);
|
||||
VasEBoot_uint16_t features2 = VasEBoot_le_to_cpu16 (idw[83]);
|
||||
VasEBoot_uint16_t enabled1 = VasEBoot_le_to_cpu16 (idw[85]);
|
||||
VasEBoot_uint16_t enabled2 = VasEBoot_le_to_cpu16 (idw[86]);
|
||||
|
||||
grub_printf ("Automatic Acoustic Management: ");
|
||||
VasEBoot_printf ("Automatic Acoustic Management: ");
|
||||
if (features2 & 0x0200)
|
||||
{
|
||||
if (enabled2 & 0x0200)
|
||||
{
|
||||
grub_uint16_t aam = grub_le_to_cpu16 (idw[94]);
|
||||
grub_printf ("%u (128=quiet, ..., 254=fast, recommended=%u)\n",
|
||||
VasEBoot_uint16_t aam = VasEBoot_le_to_cpu16 (idw[94]);
|
||||
VasEBoot_printf ("%u (128=quiet, ..., 254=fast, recommended=%u)\n",
|
||||
aam & 0xff, (aam >> 8) & 0xff);
|
||||
}
|
||||
else
|
||||
grub_printf ("disabled\n");
|
||||
VasEBoot_printf ("disabled\n");
|
||||
}
|
||||
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 (enabled2 & 0x0008)
|
||||
grub_printf ("%u (1=low, ..., 254=high)\n",
|
||||
grub_le_to_cpu16 (idw[91]) & 0xff);
|
||||
VasEBoot_printf ("%u (1=low, ..., 254=high)\n",
|
||||
VasEBoot_le_to_cpu16 (idw[91]) & 0xff);
|
||||
else
|
||||
grub_printf ("disabled\n");
|
||||
VasEBoot_printf ("disabled\n");
|
||||
}
|
||||
else
|
||||
grub_printf ("not supported\n");
|
||||
VasEBoot_printf ("not supported\n");
|
||||
|
||||
grub_printf ("SMART Feature Set: ");
|
||||
VasEBoot_printf ("SMART Feature Set: ");
|
||||
if (features1 & 0x0001)
|
||||
grub_printf ("%sabled\n", (enabled1 & 0x0001 ? "en" : "dis"));
|
||||
VasEBoot_printf ("%sabled\n", (enabled1 & 0x0001 ? "en" : "dis"));
|
||||
else
|
||||
grub_printf ("not supported\n");
|
||||
VasEBoot_printf ("not supported\n");
|
||||
|
||||
/* 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)
|
||||
grub_printf ("%s, %s, %s, %s\n",
|
||||
VasEBoot_printf ("%s, %s, %s, %s\n",
|
||||
(security & 0x0002 ? "ENABLED" : "disabled"),
|
||||
(security & 0x0004 ? "**LOCKED**" : "not locked"),
|
||||
(security & 0x0008 ? "frozen" : "NOT FROZEN"),
|
||||
(security & 0x0010 ? "COUNT EXPIRED" : "count not expired"));
|
||||
else
|
||||
grub_printf ("not supported\n");
|
||||
VasEBoot_printf ("not supported\n");
|
||||
}
|
||||
|
||||
static void
|
||||
grub_hdparm_print_standby_tout (int timeout)
|
||||
VasEBoot_hdparm_print_standby_tout (int timeout)
|
||||
{
|
||||
if (timeout == 0)
|
||||
grub_printf ("off");
|
||||
VasEBoot_printf ("off");
|
||||
else if (timeout <= 252 || timeout == 255)
|
||||
{
|
||||
int h = 0, m = 0 , s = 0;
|
||||
|
|
@ -263,31 +263,31 @@ grub_hdparm_print_standby_tout (int timeout)
|
|||
h = m / 60;
|
||||
m %= 60;
|
||||
}
|
||||
grub_printf ("%02d:%02d:%02d", h, m, s);
|
||||
VasEBoot_printf ("%02d:%02d:%02d", h, m, s);
|
||||
}
|
||||
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
|
||||
grub_cmd_hdparm (grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_hdparm (VasEBoot_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
struct grub_arg_list *state = ctxt->state;
|
||||
struct grub_ata *ata;
|
||||
struct VasEBoot_arg_list *state = ctxt->state;
|
||||
struct VasEBoot_ata *ata;
|
||||
const char *diskname;
|
||||
|
||||
/* Check command line. */
|
||||
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] == '(')
|
||||
{
|
||||
grub_size_t len = grub_strlen (args[0]);
|
||||
VasEBoot_size_t len = VasEBoot_strlen (args[0]);
|
||||
if (args[0][len - 1] == ')')
|
||||
args[0][len - 1] = 0;
|
||||
diskname = &args[0][1];
|
||||
|
|
@ -310,41 +310,41 @@ grub_cmd_hdparm (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
quiet = state[i++].set;
|
||||
|
||||
/* Open disk. */
|
||||
grub_disk_t disk = grub_disk_open (diskname);
|
||||
VasEBoot_disk_t disk = VasEBoot_disk_open (diskname);
|
||||
if (! disk)
|
||||
return grub_errno;
|
||||
return VasEBoot_errno;
|
||||
|
||||
switch (disk->dev->id)
|
||||
{
|
||||
case GRUB_DISK_DEVICE_ATA_ID:
|
||||
case VasEBoot_DISK_DEVICE_ATA_ID:
|
||||
ata = disk->data;
|
||||
break;
|
||||
case GRUB_DISK_DEVICE_SCSI_ID:
|
||||
if (((disk->id >> GRUB_SCSI_ID_SUBSYSTEM_SHIFT) & 0xFF)
|
||||
== GRUB_SCSI_SUBSYSTEM_PATA
|
||||
|| (((disk->id >> GRUB_SCSI_ID_SUBSYSTEM_SHIFT) & 0xFF)
|
||||
== GRUB_SCSI_SUBSYSTEM_AHCI))
|
||||
case VasEBoot_DISK_DEVICE_SCSI_ID:
|
||||
if (((disk->id >> VasEBoot_SCSI_ID_SUBSYSTEM_SHIFT) & 0xFF)
|
||||
== VasEBoot_SCSI_SUBSYSTEM_PATA
|
||||
|| (((disk->id >> VasEBoot_SCSI_ID_SUBSYSTEM_SHIFT) & 0xFF)
|
||||
== VasEBoot_SCSI_SUBSYSTEM_AHCI))
|
||||
{
|
||||
ata = ((struct grub_scsi *) disk->data)->data;
|
||||
ata = ((struct VasEBoot_scsi *) disk->data)->data;
|
||||
break;
|
||||
}
|
||||
/* FALLTHROUGH */
|
||||
default:
|
||||
grub_disk_close (disk);
|
||||
return grub_error (GRUB_ERR_IO, "not an ATA device");
|
||||
VasEBoot_disk_close (disk);
|
||||
return VasEBoot_error (VasEBoot_ERR_IO, "not an ATA device");
|
||||
}
|
||||
|
||||
|
||||
/* Change settings. */
|
||||
if (aam >= 0)
|
||||
grub_hdparm_set_val_cmd ("Automatic Acoustic Management", (aam ? aam : -1),
|
||||
ata, GRUB_ATA_CMD_SET_FEATURES,
|
||||
VasEBoot_hdparm_set_val_cmd ("Automatic Acoustic Management", (aam ? aam : -1),
|
||||
ata, VasEBoot_ATA_CMD_SET_FEATURES,
|
||||
(aam ? 0x42 : 0xc2), aam);
|
||||
|
||||
if (apm >= 0)
|
||||
grub_hdparm_set_val_cmd ("Advanced Power Management",
|
||||
VasEBoot_hdparm_set_val_cmd ("Advanced Power Management",
|
||||
(apm != 255 ? apm : -1), ata,
|
||||
GRUB_ATA_CMD_SET_FEATURES,
|
||||
VasEBoot_ATA_CMD_SET_FEATURES,
|
||||
(apm != 255 ? 0x05 : 0x85),
|
||||
(apm != 255 ? apm : 0));
|
||||
|
||||
|
|
@ -352,39 +352,39 @@ grub_cmd_hdparm (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
{
|
||||
if (! quiet)
|
||||
{
|
||||
grub_printf ("Set standby timeout to %d (", standby_tout);
|
||||
grub_hdparm_print_standby_tout (standby_tout);
|
||||
grub_printf (")");
|
||||
VasEBoot_printf ("Set standby timeout to %d (", standby_tout);
|
||||
VasEBoot_hdparm_print_standby_tout (standby_tout);
|
||||
VasEBoot_printf (")");
|
||||
}
|
||||
/* 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 (! quiet)
|
||||
grub_printf ("%sable SMART operations", (enable_smart ? "En" : "Dis"));
|
||||
int err = grub_hdparm_do_smart_cmd (ata, (enable_smart ?
|
||||
GRUB_ATA_FEAT_SMART_ENABLE : GRUB_ATA_FEAT_SMART_DISABLE));
|
||||
VasEBoot_printf ("%sable SMART operations", (enable_smart ? "En" : "Dis"));
|
||||
int err = VasEBoot_hdparm_do_smart_cmd (ata, (enable_smart ?
|
||||
VasEBoot_ATA_FEAT_SMART_ENABLE : VasEBoot_ATA_FEAT_SMART_DISABLE));
|
||||
if (! quiet)
|
||||
grub_printf ("%s\n", err ? ": not supported" : "");
|
||||
VasEBoot_printf ("%s\n", err ? ": not supported" : "");
|
||||
}
|
||||
|
||||
if (sec_freeze)
|
||||
grub_hdparm_simple_cmd ("Freeze security settings", ata,
|
||||
GRUB_ATA_CMD_SECURITY_FREEZE_LOCK);
|
||||
VasEBoot_hdparm_simple_cmd ("Freeze security settings", ata,
|
||||
VasEBoot_ATA_CMD_SECURITY_FREEZE_LOCK);
|
||||
|
||||
/* Print/dump IDENTIFY. */
|
||||
if (ident || dumpid)
|
||||
{
|
||||
grub_uint16_t buf[GRUB_DISK_SECTOR_SIZE / 2];
|
||||
if (grub_hdparm_do_ata_cmd (ata, GRUB_ATA_CMD_IDENTIFY_DEVICE,
|
||||
VasEBoot_uint16_t buf[VasEBoot_DISK_SECTOR_SIZE / 2];
|
||||
if (VasEBoot_hdparm_do_ata_cmd (ata, VasEBoot_ATA_CMD_IDENTIFY_DEVICE,
|
||||
0, 0, buf, sizeof (buf)))
|
||||
grub_printf ("Cannot read ATA IDENTIFY data\n");
|
||||
VasEBoot_printf ("Cannot read ATA IDENTIFY data\n");
|
||||
else
|
||||
{
|
||||
if (ident)
|
||||
grub_hdparm_print_identify (buf);
|
||||
VasEBoot_hdparm_print_identify (buf);
|
||||
if (dumpid)
|
||||
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. */
|
||||
if (power)
|
||||
{
|
||||
grub_printf ("Disk power mode is: ");
|
||||
int mode = grub_hdparm_do_check_powermode_cmd (ata);
|
||||
VasEBoot_printf ("Disk power mode is: ");
|
||||
int mode = VasEBoot_hdparm_do_check_powermode_cmd (ata);
|
||||
if (mode < 0)
|
||||
grub_printf ("unknown\n");
|
||||
VasEBoot_printf ("unknown\n");
|
||||
else
|
||||
grub_printf ("%s (0x%02x)\n",
|
||||
VasEBoot_printf ("%s (0x%02x)\n",
|
||||
(mode == 0xff ? "active/idle" :
|
||||
mode == 0x80 ? "idle" :
|
||||
mode == 0x00 ? "standby" : "unknown"), mode);
|
||||
|
|
@ -409,39 +409,39 @@ grub_cmd_hdparm (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
if (health)
|
||||
{
|
||||
if (! quiet)
|
||||
grub_printf ("SMART status is: ");
|
||||
int err = grub_hdparm_do_smart_cmd (ata, GRUB_ATA_FEAT_SMART_STATUS);
|
||||
VasEBoot_printf ("SMART status is: ");
|
||||
int err = VasEBoot_hdparm_do_smart_cmd (ata, VasEBoot_ATA_FEAT_SMART_STATUS);
|
||||
if (! quiet)
|
||||
grub_printf ("%s\n", (err < 0 ? "unknown" :
|
||||
VasEBoot_printf ("%s\n", (err < 0 ? "unknown" :
|
||||
err == 0 ? "OK" : "*BAD*"));
|
||||
status = (err > 0);
|
||||
}
|
||||
|
||||
/* Change power mode. */
|
||||
if (standby_now)
|
||||
grub_hdparm_simple_cmd ("Set disk to standby mode", ata,
|
||||
GRUB_ATA_CMD_STANDBY_IMMEDIATE);
|
||||
VasEBoot_hdparm_simple_cmd ("Set disk to standby mode", ata,
|
||||
VasEBoot_ATA_CMD_STANDBY_IMMEDIATE);
|
||||
|
||||
if (sleep_now)
|
||||
grub_hdparm_simple_cmd ("Set disk to sleep mode", ata,
|
||||
GRUB_ATA_CMD_SLEEP);
|
||||
VasEBoot_hdparm_simple_cmd ("Set disk to sleep mode", ata,
|
||||
VasEBoot_ATA_CMD_SLEEP);
|
||||
|
||||
grub_disk_close (disk);
|
||||
VasEBoot_disk_close (disk);
|
||||
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
VasEBoot_errno = VasEBoot_ERR_NONE;
|
||||
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_("Get/set ATA disk parameters."), options);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(hdparm)
|
||||
VasEBoot_MOD_FINI(hdparm)
|
||||
{
|
||||
grub_unregister_extcmd (cmd);
|
||||
VasEBoot_unregister_extcmd (cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,35 +1,35 @@
|
|||
/* 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.
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/term.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/normal.h>
|
||||
#include <grub/charset.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/term.h>
|
||||
#include <VasEBoot/extcmd.h>
|
||||
#include <VasEBoot/i18n.h>
|
||||
#include <VasEBoot/mm.h>
|
||||
#include <VasEBoot/normal.h>
|
||||
#include <VasEBoot/charset.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
VasEBoot_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_help (grub_extcmd_context_t ctxt __attribute__ ((unused)), int argc,
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_help (VasEBoot_extcmd_context_t ctxt __attribute__ ((unused)), int argc,
|
||||
char **args)
|
||||
{
|
||||
int cnt = 0;
|
||||
|
|
@ -37,69 +37,69 @@ grub_cmd_help (grub_extcmd_context_t ctxt __attribute__ ((unused)), int argc,
|
|||
|
||||
if (argc == 0)
|
||||
{
|
||||
grub_command_t cmd;
|
||||
VasEBoot_command_t 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);
|
||||
char *command_help;
|
||||
grub_uint32_t *unicode_command_help;
|
||||
grub_uint32_t *unicode_last_position;
|
||||
VasEBoot_uint32_t *unicode_command_help;
|
||||
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)
|
||||
break;
|
||||
|
||||
grub_utf8_to_ucs4_alloc (command_help, &unicode_command_help,
|
||||
VasEBoot_utf8_to_ucs4_alloc (command_help, &unicode_command_help,
|
||||
&unicode_last_position);
|
||||
|
||||
FOR_ACTIVE_TERM_OUTPUTS(term)
|
||||
{
|
||||
unsigned stringwidth;
|
||||
grub_uint32_t *unicode_last_screen_position;
|
||||
VasEBoot_uint32_t *unicode_last_screen_position;
|
||||
|
||||
unicode_last_screen_position = unicode_command_help;
|
||||
|
||||
stringwidth = 0;
|
||||
|
||||
while (unicode_last_screen_position < unicode_last_position &&
|
||||
stringwidth < ((grub_term_width (term) / 2) - 2))
|
||||
stringwidth < ((VasEBoot_term_width (term) / 2) - 2))
|
||||
{
|
||||
struct grub_unicode_glyph glyph;
|
||||
struct VasEBoot_unicode_glyph glyph;
|
||||
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_screen_position,
|
||||
&glyph);
|
||||
|
||||
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);
|
||||
if (!(cnt % 2))
|
||||
grub_print_spaces (term, grub_term_width (term) / 2
|
||||
VasEBoot_print_spaces (term, VasEBoot_term_width (term) / 2
|
||||
- stringwidth);
|
||||
}
|
||||
|
||||
if (cnt % 2)
|
||||
grub_printf ("\n");
|
||||
VasEBoot_printf ("\n");
|
||||
cnt++;
|
||||
|
||||
grub_free (command_help);
|
||||
grub_free (unicode_command_help);
|
||||
VasEBoot_free (command_help);
|
||||
VasEBoot_free (unicode_command_help);
|
||||
}
|
||||
}
|
||||
if (!(cnt % 2))
|
||||
grub_printf ("\n");
|
||||
VasEBoot_printf ("\n");
|
||||
}
|
||||
else
|
||||
{
|
||||
int i;
|
||||
grub_command_t cmd_iter, cmd, cmd_next;
|
||||
VasEBoot_command_t cmd_iter, cmd, cmd_next;
|
||||
|
||||
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)
|
||||
{
|
||||
if (!(cmd_iter->prio & GRUB_COMMAND_FLAG_ACTIVE))
|
||||
if (!(cmd_iter->prio & VasEBoot_COMMAND_FLAG_ACTIVE))
|
||||
continue;
|
||||
|
||||
if (grub_strncmp (cmd_iter->name, currarg,
|
||||
grub_strlen (currarg)) != 0)
|
||||
if (VasEBoot_strncmp (cmd_iter->name, currarg,
|
||||
VasEBoot_strlen (currarg)) != 0)
|
||||
continue;
|
||||
if (cmd_iter->flags & GRUB_COMMAND_FLAG_DYNCMD)
|
||||
cmd = grub_dyncmd_get_cmd (cmd_iter);
|
||||
if (cmd_iter->flags & VasEBoot_COMMAND_FLAG_DYNCMD)
|
||||
cmd = VasEBoot_dyncmd_get_cmd (cmd_iter);
|
||||
else
|
||||
cmd = cmd_iter;
|
||||
if (!cmd)
|
||||
{
|
||||
grub_print_error ();
|
||||
VasEBoot_print_error ();
|
||||
continue;
|
||||
}
|
||||
if (cnt++ > 0)
|
||||
grub_printf ("\n\n");
|
||||
VasEBoot_printf ("\n\n");
|
||||
|
||||
if ((cmd->flags & GRUB_COMMAND_FLAG_EXTCMD) &&
|
||||
! (cmd->flags & GRUB_COMMAND_FLAG_DYNCMD))
|
||||
grub_arg_show_help ((grub_extcmd_t) cmd->data);
|
||||
if ((cmd->flags & VasEBoot_COMMAND_FLAG_EXTCMD) &&
|
||||
! (cmd->flags & VasEBoot_COMMAND_FLAG_DYNCMD))
|
||||
VasEBoot_arg_show_help ((VasEBoot_extcmd_t) cmd->data);
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
|
@ -138,16 +138,16 @@ grub_cmd_help (grub_extcmd_context_t ctxt __attribute__ ((unused)), int argc,
|
|||
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_("Show a help message."), 0);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(help)
|
||||
VasEBoot_MOD_FINI(help)
|
||||
{
|
||||
grub_unregister_extcmd (cmd);
|
||||
VasEBoot_unregister_extcmd (cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,79 +1,79 @@
|
|||
/* 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.
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/lib/hexdump.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/file.h>
|
||||
#include <VasEBoot/disk.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/lib/hexdump.h>
|
||||
#include <VasEBoot/extcmd.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,
|
||||
ARG_TYPE_INT},
|
||||
{"length", 'n', 0, N_("Read only LENGTH bytes."), 0, ARG_TYPE_INT},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
};
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_hexdump (grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_hexdump (VasEBoot_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
struct grub_arg_list *state = ctxt->state;
|
||||
char buf[GRUB_DISK_SECTOR_SIZE * 4];
|
||||
grub_ssize_t size, length;
|
||||
grub_disk_addr_t skip;
|
||||
struct VasEBoot_arg_list *state = ctxt->state;
|
||||
char buf[VasEBoot_DISK_SECTOR_SIZE * 4];
|
||||
VasEBoot_ssize_t size, length;
|
||||
VasEBoot_disk_addr_t skip;
|
||||
int namelen;
|
||||
|
||||
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]);
|
||||
skip = (state[0].set) ? grub_strtoull (state[0].arg, 0, 0) : 0;
|
||||
length = (state[1].set) ? grub_strtoul (state[1].arg, 0, 0) : 256;
|
||||
namelen = VasEBoot_strlen (args[0]);
|
||||
skip = (state[0].set) ? VasEBoot_strtoull (state[0].arg, 0, 0) : 0;
|
||||
length = (state[1].set) ? VasEBoot_strtoul (state[1].arg, 0, 0) : 256;
|
||||
|
||||
if (!grub_strcmp (args[0], "(mem)"))
|
||||
hexdump (skip, (char *) (grub_addr_t) skip, length);
|
||||
if (!VasEBoot_strcmp (args[0], "(mem)"))
|
||||
hexdump (skip, (char *) (VasEBoot_addr_t) skip, length);
|
||||
else if ((args[0][0] == '(') && (args[0][namelen - 1] == ')'))
|
||||
{
|
||||
grub_disk_t disk;
|
||||
grub_disk_addr_t sector;
|
||||
grub_size_t ofs;
|
||||
VasEBoot_disk_t disk;
|
||||
VasEBoot_disk_addr_t sector;
|
||||
VasEBoot_size_t ofs;
|
||||
|
||||
args[0][namelen - 1] = 0;
|
||||
disk = grub_disk_open (&args[0][1]);
|
||||
disk = VasEBoot_disk_open (&args[0][1]);
|
||||
if (! disk)
|
||||
return 0;
|
||||
|
||||
sector = (skip >> (GRUB_DISK_SECTOR_BITS + 2)) * 4;
|
||||
ofs = skip & (GRUB_DISK_SECTOR_SIZE * 4 - 1);
|
||||
sector = (skip >> (VasEBoot_DISK_SECTOR_BITS + 2)) * 4;
|
||||
ofs = skip & (VasEBoot_DISK_SECTOR_SIZE * 4 - 1);
|
||||
while (length)
|
||||
{
|
||||
grub_size_t len;
|
||||
VasEBoot_size_t len;
|
||||
|
||||
len = length;
|
||||
if (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;
|
||||
|
||||
hexdump (skip, buf, len);
|
||||
|
|
@ -84,19 +84,19 @@ grub_cmd_hexdump (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
sector += 4;
|
||||
}
|
||||
|
||||
grub_disk_close (disk);
|
||||
VasEBoot_disk_close (disk);
|
||||
}
|
||||
else
|
||||
{
|
||||
grub_file_t file;
|
||||
VasEBoot_file_t file;
|
||||
|
||||
file = grub_file_open (args[0]);
|
||||
file = VasEBoot_file_open (args[0]);
|
||||
if (! file)
|
||||
return 0;
|
||||
|
||||
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;
|
||||
|
||||
|
|
@ -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;
|
||||
}
|
||||
|
||||
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_("Show raw contents of a file or memory."),
|
||||
options);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI (hexdump)
|
||||
VasEBoot_MOD_FINI (hexdump)
|
||||
{
|
||||
grub_unregister_extcmd (cmd);
|
||||
VasEBoot_unregister_extcmd (cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,64 +1,64 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/cmos.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/command.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/cmos.h>
|
||||
#include <VasEBoot/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
VasEBoot_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_cmosdump (struct grub_command *cmd __attribute__ ((unused)),
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_cmosdump (struct VasEBoot_command *cmd __attribute__ ((unused)),
|
||||
int argc __attribute__ ((unused)), char *argv[] __attribute__ ((unused)))
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = 0; i < 256; i++)
|
||||
{
|
||||
grub_err_t err;
|
||||
grub_uint8_t value;
|
||||
VasEBoot_err_t err;
|
||||
VasEBoot_uint8_t value;
|
||||
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)
|
||||
return err;
|
||||
|
||||
grub_printf ("%02x ", value);
|
||||
VasEBoot_printf ("%02x ", value);
|
||||
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,
|
||||
N_("Show raw dump of the CMOS contents."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(cmosdump)
|
||||
VasEBoot_MOD_FINI(cmosdump)
|
||||
{
|
||||
grub_unregister_command (cmd);
|
||||
VasEBoot_unregister_command (cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,124 +1,124 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/cmos.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/command.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/cmos.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)
|
||||
{
|
||||
char *rest;
|
||||
|
||||
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 != ':')
|
||||
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
|
||||
grub_cmd_cmostest (struct grub_command *cmd __attribute__ ((unused)),
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_cmostest (struct VasEBoot_command *cmd __attribute__ ((unused)),
|
||||
int argc, char *argv[])
|
||||
{
|
||||
int byte = 0, bit = 0;
|
||||
grub_err_t err;
|
||||
grub_uint8_t value;
|
||||
VasEBoot_err_t err;
|
||||
VasEBoot_uint8_t value;
|
||||
|
||||
err = parse_args (argc, argv, &byte, &bit);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
err = grub_cmos_read (byte, &value);
|
||||
err = VasEBoot_cmos_read (byte, &value);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
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
|
||||
grub_cmd_cmosclean (struct grub_command *cmd __attribute__ ((unused)),
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_cmosclean (struct VasEBoot_command *cmd __attribute__ ((unused)),
|
||||
int argc, char *argv[])
|
||||
{
|
||||
int byte = 0, bit = 0;
|
||||
grub_err_t err;
|
||||
grub_uint8_t value;
|
||||
VasEBoot_err_t err;
|
||||
VasEBoot_uint8_t value;
|
||||
|
||||
err = parse_args (argc, argv, &byte, &bit);
|
||||
if (err)
|
||||
return err;
|
||||
err = grub_cmos_read (byte, &value);
|
||||
err = VasEBoot_cmos_read (byte, &value);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
return grub_cmos_write (byte, value & (~(1 << bit)));
|
||||
return VasEBoot_cmos_write (byte, value & (~(1 << bit)));
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_cmosset (struct grub_command *cmd __attribute__ ((unused)),
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_cmosset (struct VasEBoot_command *cmd __attribute__ ((unused)),
|
||||
int argc, char *argv[])
|
||||
{
|
||||
int byte = 0, bit = 0;
|
||||
grub_err_t err;
|
||||
grub_uint8_t value;
|
||||
VasEBoot_err_t err;
|
||||
VasEBoot_uint8_t value;
|
||||
|
||||
err = parse_args (argc, argv, &byte, &bit);
|
||||
if (err)
|
||||
return err;
|
||||
err = grub_cmos_read (byte, &value);
|
||||
err = VasEBoot_cmos_read (byte, &value);
|
||||
if (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_("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_("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"),
|
||||
/* TRANSLATORS: A bit may be either set (1) or clear (0). */
|
||||
N_("Set bit at BYTE:BIT in CMOS."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(cmostest)
|
||||
VasEBoot_MOD_FINI(cmostest)
|
||||
{
|
||||
grub_unregister_command (cmd);
|
||||
grub_unregister_command (cmd_clean);
|
||||
grub_unregister_command (cmd_set);
|
||||
VasEBoot_unregister_command (cmd);
|
||||
VasEBoot_unregister_command (cmd_clean);
|
||||
VasEBoot_unregister_command (cmd_set);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,37 +1,37 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/i386/coreboot/lbio.h>
|
||||
#include <grub/i386/tsc.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/command.h>
|
||||
#include <VasEBoot/i18n.h>
|
||||
#include <VasEBoot/i386/coreboot/lbio.h>
|
||||
#include <VasEBoot/i386/tsc.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
VasEBoot_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_uint32_t
|
||||
tsc2ms (grub_uint64_t tsc)
|
||||
static VasEBoot_uint32_t
|
||||
tsc2ms (VasEBoot_uint64_t tsc)
|
||||
{
|
||||
grub_uint64_t ah = tsc >> 32;
|
||||
grub_uint64_t al = tsc & 0xffffffff;
|
||||
VasEBoot_uint64_t ah = tsc >> 32;
|
||||
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[] = {
|
||||
|
|
@ -63,28 +63,28 @@ static const char *descs[] = {
|
|||
};
|
||||
|
||||
static int
|
||||
iterate_linuxbios_table (grub_linuxbios_table_item_t table_item,
|
||||
iterate_linuxbios_table (VasEBoot_linuxbios_table_item_t table_item,
|
||||
void *data)
|
||||
{
|
||||
int *available = data;
|
||||
grub_uint64_t last_tsc = 0;
|
||||
struct grub_linuxbios_timestamp_table *ts_table;
|
||||
VasEBoot_uint64_t last_tsc = 0;
|
||||
struct VasEBoot_linuxbios_timestamp_table *ts_table;
|
||||
unsigned i;
|
||||
|
||||
if (table_item->tag != GRUB_LINUXBIOS_MEMBER_TIMESTAMPS)
|
||||
if (table_item->tag != VasEBoot_LINUXBIOS_MEMBER_TIMESTAMPS)
|
||||
return 0;
|
||||
|
||||
*available = 1;
|
||||
ts_table = (struct grub_linuxbios_timestamp_table *) (grub_addr_t)
|
||||
*(grub_uint64_t *) (table_item + 1);
|
||||
ts_table = (struct VasEBoot_linuxbios_timestamp_table *) (VasEBoot_addr_t)
|
||||
*(VasEBoot_uint64_t *) (table_item + 1);
|
||||
|
||||
for (i = 0; i < ts_table->used; i++)
|
||||
{
|
||||
grub_uint32_t tmabs = tsc2ms (ts_table->entries[i].tsc);
|
||||
grub_uint32_t tmrel = tsc2ms (ts_table->entries[i].tsc - last_tsc);
|
||||
VasEBoot_uint32_t tmabs = tsc2ms (ts_table->entries[i].tsc);
|
||||
VasEBoot_uint32_t tmrel = tsc2ms (ts_table->entries[i].tsc - last_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,
|
||||
ts_table->entries[i].id,
|
||||
(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
|
||||
grub_cmd_coreboot_boottime (struct grub_command *cmd __attribute__ ((unused)),
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_coreboot_boottime (struct VasEBoot_command *cmd __attribute__ ((unused)),
|
||||
int argc __attribute__ ((unused)),
|
||||
char *argv[] __attribute__ ((unused)))
|
||||
{
|
||||
int available = 0;
|
||||
|
||||
grub_linuxbios_table_iterate (iterate_linuxbios_table, &available);
|
||||
VasEBoot_linuxbios_table_iterate (iterate_linuxbios_table, &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;
|
||||
}
|
||||
|
||||
static grub_command_t cmd_boottime;
|
||||
static VasEBoot_command_t cmd_boottime;
|
||||
|
||||
GRUB_MOD_INIT(cbtime)
|
||||
VasEBoot_MOD_INIT(cbtime)
|
||||
{
|
||||
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."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(cbtime)
|
||||
VasEBoot_MOD_FINI(cbtime)
|
||||
{
|
||||
grub_unregister_command (cmd_boottime);
|
||||
VasEBoot_unregister_command (cmd_boottime);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,29 +1,29 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/i386/coreboot/lbio.h>
|
||||
#include <grub/i386/tsc.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/command.h>
|
||||
#include <VasEBoot/i18n.h>
|
||||
#include <VasEBoot/i386/coreboot/lbio.h>
|
||||
#include <VasEBoot/i386/tsc.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
VasEBoot_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static const char *console_descs[] = {
|
||||
"8250 UART",
|
||||
|
|
@ -36,8 +36,8 @@ static const char *console_descs[] = {
|
|||
};
|
||||
|
||||
static const char *descs[] = {
|
||||
[GRUB_LINUXBIOS_MEMBER_MEMORY] = "memory map (`lsmmap' to list)",
|
||||
[GRUB_LINUXBIOS_MEMBER_MAINBOARD] = "mainboard",
|
||||
[VasEBoot_LINUXBIOS_MEMBER_MEMORY] = "memory map (`lsmmap' to list)",
|
||||
[VasEBoot_LINUXBIOS_MEMBER_MAINBOARD] = "mainboard",
|
||||
[4] = "version",
|
||||
[5] = "extra version",
|
||||
[6] = "build",
|
||||
|
|
@ -49,12 +49,12 @@ static const char *descs[] = {
|
|||
[0xc] = "linker",
|
||||
[0xd] = "assembler",
|
||||
[0xf] = "serial",
|
||||
[GRUB_LINUXBIOS_MEMBER_CONSOLE] = "console",
|
||||
[GRUB_LINUXBIOS_MEMBER_FRAMEBUFFER] = "framebuffer",
|
||||
[VasEBoot_LINUXBIOS_MEMBER_CONSOLE] = "console",
|
||||
[VasEBoot_LINUXBIOS_MEMBER_FRAMEBUFFER] = "framebuffer",
|
||||
[0x13] = "GPIO",
|
||||
[0x15] = "VDAT",
|
||||
[GRUB_LINUXBIOS_MEMBER_TIMESTAMPS] = "timestamps (`coreboot_boottime' to list)",
|
||||
[GRUB_LINUXBIOS_MEMBER_CBMEMC] = "CBMEM console (`cbmemc' to list)",
|
||||
[VasEBoot_LINUXBIOS_MEMBER_TIMESTAMPS] = "timestamps (`coreboot_boottime' to list)",
|
||||
[VasEBoot_LINUXBIOS_MEMBER_CBMEMC] = "CBMEM console (`cbmemc' to list)",
|
||||
[0x18] = "MRC cache",
|
||||
[0x19] = "VBNV",
|
||||
[0xc8] = "CMOS option table",
|
||||
|
|
@ -65,24 +65,24 @@ static const char *descs[] = {
|
|||
};
|
||||
|
||||
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)))
|
||||
{
|
||||
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]);
|
||||
else
|
||||
grub_printf ("tag=%02x size=%02x",
|
||||
VasEBoot_printf ("tag=%02x size=%02x",
|
||||
table_item->tag, table_item->size);
|
||||
|
||||
switch (table_item->tag)
|
||||
{
|
||||
case GRUB_LINUXBIOS_MEMBER_FRAMEBUFFER:
|
||||
case VasEBoot_LINUXBIOS_MEMBER_FRAMEBUFFER:
|
||||
{
|
||||
struct grub_linuxbios_table_framebuffer *fb;
|
||||
fb = (struct grub_linuxbios_table_framebuffer *) (table_item + 1);
|
||||
struct VasEBoot_linuxbios_table_framebuffer *fb;
|
||||
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->bpp, fb->pitch,
|
||||
(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);
|
||||
break;
|
||||
}
|
||||
case GRUB_LINUXBIOS_MEMBER_MAINBOARD:
|
||||
case VasEBoot_LINUXBIOS_MEMBER_MAINBOARD:
|
||||
{
|
||||
struct grub_linuxbios_mainboard *mb;
|
||||
mb = (struct grub_linuxbios_mainboard *) (table_item + 1);
|
||||
grub_printf (": vendor=`%s' part_number=`%s'",
|
||||
struct VasEBoot_linuxbios_mainboard *mb;
|
||||
mb = (struct VasEBoot_linuxbios_mainboard *) (table_item + 1);
|
||||
VasEBoot_printf (": vendor=`%s' part_number=`%s'",
|
||||
mb->strings + mb->vendor,
|
||||
mb->strings + mb->part_number);
|
||||
break;
|
||||
}
|
||||
case 0x04 ... 0x0d:
|
||||
grub_printf (": `%s'", (char *) (table_item + 1));
|
||||
VasEBoot_printf (": `%s'", (char *) (table_item + 1));
|
||||
break;
|
||||
case GRUB_LINUXBIOS_MEMBER_CONSOLE:
|
||||
case VasEBoot_LINUXBIOS_MEMBER_CONSOLE:
|
||||
{
|
||||
grub_uint16_t *val = (grub_uint16_t *) (table_item + 1);
|
||||
grub_printf (": id=%d", *val);
|
||||
VasEBoot_uint16_t *val = (VasEBoot_uint16_t *) (table_item + 1);
|
||||
VasEBoot_printf (": id=%d", *val);
|
||||
if (*val < ARRAY_SIZE (console_descs)
|
||||
&& console_descs[*val])
|
||||
grub_printf (" %s", console_descs[*val]);
|
||||
VasEBoot_printf (" %s", console_descs[*val]);
|
||||
}
|
||||
}
|
||||
grub_printf ("\n");
|
||||
VasEBoot_printf ("\n");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_lscoreboot (struct grub_command *cmd __attribute__ ((unused)),
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_lscoreboot (struct VasEBoot_command *cmd __attribute__ ((unused)),
|
||||
int argc __attribute__ ((unused)),
|
||||
char *argv[] __attribute__ ((unused)))
|
||||
{
|
||||
grub_linuxbios_table_iterate (iterate_linuxbios_table, 0);
|
||||
VasEBoot_linuxbios_table_iterate (iterate_linuxbios_table, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_command_t cmd;
|
||||
static VasEBoot_command_t cmd;
|
||||
|
||||
GRUB_MOD_INIT(cbls)
|
||||
VasEBoot_MOD_INIT(cbls)
|
||||
{
|
||||
cmd =
|
||||
grub_register_command ("lscoreboot", grub_cmd_lscoreboot,
|
||||
VasEBoot_register_command ("lscoreboot", VasEBoot_cmd_lscoreboot,
|
||||
0, N_("List coreboot tables."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(cbls)
|
||||
VasEBoot_MOD_FINI(cbls)
|
||||
{
|
||||
grub_unregister_command (cmd);
|
||||
VasEBoot_unregister_command (cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,35 +1,35 @@
|
|||
/* cpuid.c - test for CPU features */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* Copyright (C) 2006, 2007, 2009 Free Software Foundation, Inc.
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/i386/cpuid.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/mm.h>
|
||||
#include <VasEBoot/env.h>
|
||||
#include <VasEBoot/command.h>
|
||||
#include <VasEBoot/extcmd.h>
|
||||
#include <VasEBoot/i386/cpuid.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
|
||||
no argument is specified. */
|
||||
|
|
@ -53,32 +53,32 @@ enum
|
|||
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
|
||||
grub_cmd_cpuid (grub_extcmd_context_t ctxt,
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_cpuid (VasEBoot_extcmd_context_t ctxt,
|
||||
int argc __attribute__ ((unused)),
|
||||
char **args __attribute__ ((unused)))
|
||||
{
|
||||
int val = 0;
|
||||
if (ctxt->state[MODE_PAE].set)
|
||||
val = grub_cpuid_has_pae;
|
||||
val = VasEBoot_cpuid_has_pae;
|
||||
else
|
||||
val = grub_cpuid_has_longmode;
|
||||
return val ? GRUB_ERR_NONE
|
||||
val = VasEBoot_cpuid_has_longmode;
|
||||
return val ? VasEBoot_ERR_NONE
|
||||
/* TRANSLATORS: it's a standalone boolean value,
|
||||
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__
|
||||
/* grub-emu */
|
||||
grub_cpuid_has_longmode = 1;
|
||||
grub_cpuid_has_pae = 1;
|
||||
/* VasEBoot-emu */
|
||||
VasEBoot_cpuid_has_longmode = 1;
|
||||
VasEBoot_cpuid_has_pae = 1;
|
||||
#else
|
||||
unsigned int eax, ebx, ecx, edx;
|
||||
unsigned int max_level;
|
||||
|
|
@ -93,7 +93,7 @@ GRUB_MOD_INIT(cpuid)
|
|||
goto done;
|
||||
|
||||
/* 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. */
|
||||
max_level = eax;
|
||||
if (max_level == 0)
|
||||
|
|
@ -101,25 +101,25 @@ GRUB_MOD_INIT(cpuid)
|
|||
|
||||
if (max_level >= 1)
|
||||
{
|
||||
grub_cpuid (1, eax, ebx, ecx, edx);
|
||||
grub_cpuid_has_pae = !!(edx & bit_PAE);
|
||||
VasEBoot_cpuid (1, eax, ebx, ecx, edx);
|
||||
VasEBoot_cpuid_has_pae = !!(edx & bit_PAE);
|
||||
}
|
||||
|
||||
grub_cpuid (0x80000000, eax, ebx, ecx, edx);
|
||||
VasEBoot_cpuid (0x80000000, eax, ebx, ecx, edx);
|
||||
ext_level = eax;
|
||||
if (ext_level < 0x80000000)
|
||||
goto done;
|
||||
|
||||
grub_cpuid (0x80000001, eax, ebx, ecx, edx);
|
||||
grub_cpuid_has_longmode = !!(edx & bit_LM);
|
||||
VasEBoot_cpuid (0x80000001, eax, ebx, ecx, edx);
|
||||
VasEBoot_cpuid_has_longmode = !!(edx & bit_LM);
|
||||
done:
|
||||
#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);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(cpuid)
|
||||
VasEBoot_MOD_FINI(cpuid)
|
||||
{
|
||||
grub_unregister_extcmd (cmd);
|
||||
VasEBoot_unregister_extcmd (cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,42 +1,42 @@
|
|||
/* 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.
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/loader.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/machine/biosnum.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/memory.h>
|
||||
#include <grub/machine/memory.h>
|
||||
#include <VasEBoot/extcmd.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/mm.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/disk.h>
|
||||
#include <VasEBoot/loader.h>
|
||||
#include <VasEBoot/env.h>
|
||||
#include <VasEBoot/machine/biosnum.h>
|
||||
#include <VasEBoot/i18n.h>
|
||||
#include <VasEBoot/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. */
|
||||
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. */
|
||||
static const struct grub_arg_option options[] = {
|
||||
/* TRANSLATORS: In this file "mapping" refers to a change GRUB makes so if
|
||||
static const struct VasEBoot_arg_option options[] = {
|
||||
/* TRANSLATORS: In this file "mapping" refers to a change VasEBoot makes so if
|
||||
your language doesn't have an equivalent of "mapping" you can
|
||||
use the word like "rerouting".
|
||||
*/
|
||||
|
|
@ -55,33 +55,33 @@ enum opt_idxs
|
|||
};
|
||||
|
||||
/* 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
|
||||
serves just to take the address with &label. */
|
||||
|
||||
/* The assembly function to replace the old INT13h handler. It does not follow
|
||||
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). */
|
||||
extern const void grub_drivemap_mapstart;
|
||||
extern const void VasEBoot_drivemap_mapstart;
|
||||
|
||||
typedef struct drivemap_node
|
||||
{
|
||||
struct drivemap_node *next;
|
||||
grub_uint8_t newdrive;
|
||||
grub_uint8_t redirto;
|
||||
VasEBoot_uint8_t newdrive;
|
||||
VasEBoot_uint8_t redirto;
|
||||
} drivemap_node_t;
|
||||
|
||||
typedef struct GRUB_PACKED int13map_node
|
||||
typedef struct VasEBoot_PACKED int13map_node
|
||||
{
|
||||
grub_uint8_t disknum;
|
||||
grub_uint8_t mapto;
|
||||
VasEBoot_uint8_t disknum;
|
||||
VasEBoot_uint8_t mapto;
|
||||
} int13map_node_t;
|
||||
|
||||
#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 void *drivemap_hook;
|
||||
|
|
@ -89,8 +89,8 @@ static int drivemap_mmap;
|
|||
|
||||
/* Puts the specified mapping into the table, replacing an existing mapping
|
||||
for newdrive or adding a new one if required. */
|
||||
static grub_err_t
|
||||
drivemap_set (grub_uint8_t newdrive, grub_uint8_t redirto)
|
||||
static VasEBoot_err_t
|
||||
drivemap_set (VasEBoot_uint8_t newdrive, VasEBoot_uint8_t redirto)
|
||||
{
|
||||
drivemap_node_t *mapping = 0;
|
||||
drivemap_node_t *search = map_head;
|
||||
|
|
@ -109,21 +109,21 @@ drivemap_set (grub_uint8_t newdrive, grub_uint8_t redirto)
|
|||
mapping->redirto = redirto;
|
||||
else
|
||||
{
|
||||
mapping = grub_malloc (sizeof (drivemap_node_t));
|
||||
mapping = VasEBoot_malloc (sizeof (drivemap_node_t));
|
||||
if (! mapping)
|
||||
return grub_errno;
|
||||
return VasEBoot_errno;
|
||||
mapping->newdrive = newdrive;
|
||||
mapping->redirto = redirto;
|
||||
mapping->next = map_head;
|
||||
map_head = mapping;
|
||||
}
|
||||
return GRUB_ERR_NONE;
|
||||
return VasEBoot_ERR_NONE;
|
||||
}
|
||||
|
||||
/* Removes the mapping for newdrive from the table. If there is no mapping,
|
||||
then this function behaves like a no-op on the map. */
|
||||
static void
|
||||
drivemap_remove (grub_uint8_t newdrive)
|
||||
drivemap_remove (VasEBoot_uint8_t newdrive)
|
||||
{
|
||||
drivemap_node_t *mapping = 0;
|
||||
drivemap_node_t *search = map_head;
|
||||
|
|
@ -146,53 +146,53 @@ drivemap_remove (grub_uint8_t newdrive)
|
|||
previous->next = mapping->next;
|
||||
else
|
||||
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
|
||||
0 <= N < 128. */
|
||||
static grub_err_t
|
||||
tryparse_diskstring (const char *str, grub_uint8_t *output)
|
||||
static VasEBoot_err_t
|
||||
tryparse_diskstring (const char *str, VasEBoot_uint8_t *output)
|
||||
{
|
||||
/* Skip opening paren in order to allow both (hd0) and hd0. */
|
||||
if (*str == '(')
|
||||
str++;
|
||||
if ((str[0] == 'f' || str[0] == 'h') && str[1] == 'd')
|
||||
{
|
||||
grub_uint8_t bios_num = (str[0] == 'h') ? 0x80 : 0x00;
|
||||
unsigned long drivenum = grub_strtoul (str + 2, 0, 0);
|
||||
if (grub_errno == GRUB_ERR_NONE && drivenum < 128)
|
||||
VasEBoot_uint8_t bios_num = (str[0] == 'h') ? 0x80 : 0x00;
|
||||
unsigned long drivenum = VasEBoot_strtoul (str + 2, 0, 0);
|
||||
if (VasEBoot_errno == VasEBoot_ERR_NONE && drivenum < 128)
|
||||
{
|
||||
bios_num |= drivenum;
|
||||
if (output)
|
||||
*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);
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
static VasEBoot_err_t
|
||||
list_mappings (void)
|
||||
{
|
||||
/* Show: list mappings. */
|
||||
if (! map_head)
|
||||
{
|
||||
grub_puts_ (N_("No drives have been remapped"));
|
||||
return GRUB_ERR_NONE;
|
||||
VasEBoot_puts_ (N_("No drives have been remapped"));
|
||||
return VasEBoot_ERR_NONE;
|
||||
}
|
||||
|
||||
/* TRANSLATORS: This is the header of mapping list.
|
||||
On the left is how OS will see the disks and
|
||||
on the right current GRUB vision. */
|
||||
grub_puts_ (N_("OS disk #num ------> GRUB/BIOS device"));
|
||||
on the right current VasEBoot vision. */
|
||||
VasEBoot_puts_ (N_("OS disk #num ------> VasEBoot/BIOS device"));
|
||||
drivemap_node_t *curnode = map_head;
|
||||
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 & 0x7F, curnode->newdrive,
|
||||
(curnode->redirto & 0x80) ? 'h' : 'f',
|
||||
|
|
@ -200,11 +200,11 @@ list_mappings (void)
|
|||
);
|
||||
curnode = curnode->next;
|
||||
}
|
||||
return GRUB_ERR_NONE;
|
||||
return VasEBoot_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_drivemap (struct grub_extcmd_context *ctxt, int argc, char **args)
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_drivemap (struct VasEBoot_extcmd_context *ctxt, int argc, char **args)
|
||||
{
|
||||
if (ctxt->state[OPTIDX_LIST].set)
|
||||
{
|
||||
|
|
@ -219,10 +219,10 @@ grub_cmd_drivemap (struct grub_extcmd_context *ctxt, int argc, char **args)
|
|||
{
|
||||
prevnode = curnode;
|
||||
curnode = curnode->next;
|
||||
grub_free (prevnode);
|
||||
VasEBoot_free (prevnode);
|
||||
}
|
||||
map_head = 0;
|
||||
return GRUB_ERR_NONE;
|
||||
return VasEBoot_ERR_NONE;
|
||||
}
|
||||
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. */
|
||||
grub_uint8_t mapfrom = 0;
|
||||
grub_uint8_t mapto = 0xFF;
|
||||
grub_err_t err;
|
||||
VasEBoot_uint8_t mapfrom = 0;
|
||||
VasEBoot_uint8_t mapto = 0xFF;
|
||||
VasEBoot_err_t err;
|
||||
|
||||
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);
|
||||
if (err != GRUB_ERR_NONE)
|
||||
if (err != VasEBoot_ERR_NONE)
|
||||
return err;
|
||||
|
||||
err = tryparse_diskstring (args[1], &mapto);
|
||||
if (err != GRUB_ERR_NONE)
|
||||
if (err != VasEBoot_ERR_NONE)
|
||||
return err;
|
||||
|
||||
if (mapto == mapfrom)
|
||||
{
|
||||
/* Reset to default. */
|
||||
grub_dprintf ("drivemap", "Removing mapping for %s (%02x)\n",
|
||||
VasEBoot_dprintf ("drivemap", "Removing mapping for %s (%02x)\n",
|
||||
args[0], mapfrom);
|
||||
drivemap_remove (mapfrom);
|
||||
return GRUB_ERR_NONE;
|
||||
return VasEBoot_ERR_NONE;
|
||||
}
|
||||
/* 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",
|
||||
args[1], mapto, args[0], mapfrom);
|
||||
err = drivemap_set (mapto, mapfrom);
|
||||
/* 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);
|
||||
return err;
|
||||
}
|
||||
|
||||
/* Int13h handler installer - reserves conventional memory for the handler,
|
||||
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
|
||||
realmode structures by their absolute addresses, like the IVT at 0;
|
||||
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)))
|
||||
{
|
||||
/* 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. */
|
||||
grub_uint8_t *handler_base = 0;
|
||||
VasEBoot_uint8_t *handler_base = 0;
|
||||
/* Address of the map within the deployed bundle. */
|
||||
int13map_node_t *handler_map;
|
||||
|
||||
|
|
@ -294,93 +294,93 @@ install_int13_handler (int noret __attribute__ ((unused)))
|
|||
if (entries == 0)
|
||||
{
|
||||
/* 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");
|
||||
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. */
|
||||
grub_drivemap_oldhandler = *int13slot;
|
||||
grub_dprintf ("drivemap", "Original int13 handler: %04x:%04x\n",
|
||||
(grub_drivemap_oldhandler >> 16) & 0x0ffff,
|
||||
grub_drivemap_oldhandler & 0x0ffff);
|
||||
VasEBoot_drivemap_oldhandler = *int13slot;
|
||||
VasEBoot_dprintf ("drivemap", "Original int13 handler: %04x:%04x\n",
|
||||
(VasEBoot_drivemap_oldhandler >> 16) & 0x0ffff,
|
||||
VasEBoot_drivemap_oldhandler & 0x0ffff);
|
||||
|
||||
/* Find a rmode-segment-aligned zone in conventional memory big
|
||||
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);
|
||||
grub_dprintf ("drivemap", "Payload is %u bytes long\n", total_size);
|
||||
handler_base = grub_mmap_malign_and_register (16, ALIGN_UP (total_size, 16),
|
||||
VasEBoot_dprintf ("drivemap", "Payload is %u bytes long\n", total_size);
|
||||
handler_base = VasEBoot_mmap_malign_and_register (16, ALIGN_UP (total_size, 16),
|
||||
&drivemap_mmap,
|
||||
GRUB_MEMORY_RESERVED,
|
||||
GRUB_MMAP_MALLOC_LOW);
|
||||
VasEBoot_MEMORY_RESERVED,
|
||||
VasEBoot_MMAP_MALLOC_LOW);
|
||||
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");
|
||||
|
||||
/* 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);
|
||||
grub_memcpy (handler_base, &grub_drivemap_handler,
|
||||
INT13H_OFFSET (&grub_drivemap_mapstart));
|
||||
VasEBoot_memcpy (handler_base, &VasEBoot_drivemap_handler,
|
||||
INT13H_OFFSET (&VasEBoot_drivemap_mapstart));
|
||||
|
||||
/* Copy the mappings to the reserved area. */
|
||||
curentry = map_head;
|
||||
handler_map = (int13map_node_t *) (handler_base +
|
||||
INT13H_OFFSET (&grub_drivemap_mapstart));
|
||||
grub_dprintf ("drivemap", "Target map at %p, copying mappings\n", handler_map);
|
||||
INT13H_OFFSET (&VasEBoot_drivemap_mapstart));
|
||||
VasEBoot_dprintf ("drivemap", "Target map at %p, copying mappings\n", handler_map);
|
||||
for (i = 0; i < entries; ++i, curentry = curentry->next)
|
||||
{
|
||||
handler_map[i].disknum = curentry->newdrive;
|
||||
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);
|
||||
}
|
||||
/* Signal end-of-map. */
|
||||
handler_map[i].disknum = 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. */
|
||||
*int13slot = ((grub_uint32_t) handler_base) << 12; /* Segment address. */
|
||||
grub_dprintf ("drivemap", "New int13 handler: %04x:%04x\n",
|
||||
*int13slot = ((VasEBoot_uint32_t) handler_base) << 12; /* Segment address. */
|
||||
VasEBoot_dprintf ("drivemap", "New int13 handler: %04x:%04x\n",
|
||||
(*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)
|
||||
{
|
||||
if (! grub_drivemap_oldhandler)
|
||||
return GRUB_ERR_NONE;
|
||||
if (! VasEBoot_drivemap_oldhandler)
|
||||
return VasEBoot_ERR_NONE;
|
||||
|
||||
*int13slot = grub_drivemap_oldhandler;
|
||||
grub_mmap_free_and_unregister (drivemap_mmap);
|
||||
grub_drivemap_oldhandler = 0;
|
||||
grub_dprintf ("drivemap", "Restored int13 handler: %04x:%04x\n",
|
||||
*int13slot = VasEBoot_drivemap_oldhandler;
|
||||
VasEBoot_mmap_free_and_unregister (drivemap_mmap);
|
||||
VasEBoot_drivemap_oldhandler = 0;
|
||||
VasEBoot_dprintf ("drivemap", "Restored int13 handler: %04x:%04x\n",
|
||||
(*int13slot >> 16) & 0x0ffff, *int13slot & 0x0ffff);
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
return VasEBoot_ERR_NONE;
|
||||
}
|
||||
|
||||
static int
|
||||
grub_get_root_biosnumber_drivemap (void)
|
||||
VasEBoot_get_root_biosnumber_drivemap (void)
|
||||
{
|
||||
const char *biosnum;
|
||||
int ret = -1;
|
||||
grub_device_t dev;
|
||||
VasEBoot_device_t dev;
|
||||
|
||||
biosnum = grub_env_get ("biosnum");
|
||||
biosnum = VasEBoot_env_get ("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
|
||||
&& dev->disk->dev->id == GRUB_DISK_DEVICE_BIOSDISK_ID)
|
||||
&& dev->disk->dev->id == VasEBoot_DISK_DEVICE_BIOSDISK_ID)
|
||||
{
|
||||
drivemap_node_t *curnode = map_head;
|
||||
ret = (int) dev->disk->id;
|
||||
|
|
@ -397,32 +397,32 @@ grub_get_root_biosnumber_drivemap (void)
|
|||
}
|
||||
|
||||
if (dev)
|
||||
grub_device_close (dev);
|
||||
VasEBoot_device_close (dev);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
static grub_extcmd_t cmd;
|
||||
static int (*grub_get_root_biosnumber_saved) (void);
|
||||
static VasEBoot_extcmd_t cmd;
|
||||
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;
|
||||
grub_get_root_biosnumber = grub_get_root_biosnumber_drivemap;
|
||||
cmd = grub_register_extcmd ("drivemap", grub_cmd_drivemap, 0,
|
||||
N_("-l | -r | [-s] grubdev osdisk."),
|
||||
VasEBoot_get_root_biosnumber_saved = VasEBoot_get_root_biosnumber;
|
||||
VasEBoot_get_root_biosnumber = VasEBoot_get_root_biosnumber_drivemap;
|
||||
cmd = VasEBoot_register_extcmd ("drivemap", VasEBoot_cmd_drivemap, 0,
|
||||
N_("-l | -r | [-s] VasEBootdev osdisk."),
|
||||
N_("Manage the BIOS drive mappings."),
|
||||
options);
|
||||
drivemap_hook =
|
||||
grub_loader_register_preboot_hook (&install_int13_handler,
|
||||
VasEBoot_loader_register_preboot_hook (&install_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;
|
||||
grub_loader_unregister_preboot_hook (drivemap_hook);
|
||||
VasEBoot_get_root_biosnumber = VasEBoot_get_root_biosnumber_saved;
|
||||
VasEBoot_loader_unregister_preboot_hook (drivemap_hook);
|
||||
drivemap_hook = 0;
|
||||
grub_unregister_extcmd (cmd);
|
||||
VasEBoot_unregister_extcmd (cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,23 +1,23 @@
|
|||
/* 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.
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* 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))
|
||||
|
||||
|
|
@ -26,7 +26,7 @@
|
|||
/* Copy starts here. When deployed, this code must be segment-aligned. */
|
||||
|
||||
/* The replacement int13 handler. Preserve all registers. */
|
||||
FUNCTION(grub_drivemap_handler)
|
||||
FUNCTION(VasEBoot_drivemap_handler)
|
||||
LOCAL (base):
|
||||
/* Save %dx for future restore. */
|
||||
push %dx
|
||||
|
|
@ -111,7 +111,7 @@ norestore:
|
|||
|
||||
/* Far pointer to the old handler. Stored as a CS:IP in the style of real-mode
|
||||
IVT entries (thus PI:SC in mem). */
|
||||
VARIABLE(grub_drivemap_oldhandler)
|
||||
VARIABLE(VasEBoot_drivemap_oldhandler)
|
||||
LOCAL (oldhandler):
|
||||
.word 0x0, 0x0
|
||||
|
||||
|
|
@ -119,6 +119,6 @@ LOCAL (oldhandler):
|
|||
reserves additional space for mappings at runtime and copies them over it. */
|
||||
.align 2
|
||||
|
||||
VARIABLE(grub_drivemap_mapstart)
|
||||
VARIABLE(VasEBoot_drivemap_mapstart)
|
||||
LOCAL (mapstart):
|
||||
.byte 0
|
||||
|
|
|
|||
|
|
@ -1,32 +1,32 @@
|
|||
/* halt.c - command to halt the computer. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/machine/int.h>
|
||||
#include <grub/acpi.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/extcmd.h>
|
||||
#include <VasEBoot/i18n.h>
|
||||
#include <VasEBoot/machine/int.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},
|
||||
{0, 0, 0, 0, 0, 0}
|
||||
|
|
@ -45,11 +45,11 @@ stop (void)
|
|||
* APM even if it is available.
|
||||
*/
|
||||
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)
|
||||
stop ();
|
||||
|
|
@ -57,70 +57,70 @@ grub_halt (int no_apm)
|
|||
/* detect APM */
|
||||
regs.eax = 0x5300;
|
||||
regs.ebx = 0;
|
||||
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
|
||||
grub_bios_interrupt (0x15, ®s);
|
||||
regs.flags = VasEBoot_CPU_INT_FLAGS_DEFAULT;
|
||||
VasEBoot_bios_interrupt (0x15, ®s);
|
||||
|
||||
if (regs.flags & GRUB_CPU_INT_FLAGS_CARRY)
|
||||
if (regs.flags & VasEBoot_CPU_INT_FLAGS_CARRY)
|
||||
stop ();
|
||||
|
||||
/* disconnect APM first */
|
||||
regs.eax = 0x5304;
|
||||
regs.ebx = 0;
|
||||
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
|
||||
grub_bios_interrupt (0x15, ®s);
|
||||
regs.flags = VasEBoot_CPU_INT_FLAGS_DEFAULT;
|
||||
VasEBoot_bios_interrupt (0x15, ®s);
|
||||
|
||||
/* connect APM */
|
||||
regs.eax = 0x5301;
|
||||
regs.ebx = 0;
|
||||
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
|
||||
grub_bios_interrupt (0x15, ®s);
|
||||
if (regs.flags & GRUB_CPU_INT_FLAGS_CARRY)
|
||||
regs.flags = VasEBoot_CPU_INT_FLAGS_DEFAULT;
|
||||
VasEBoot_bios_interrupt (0x15, ®s);
|
||||
if (regs.flags & VasEBoot_CPU_INT_FLAGS_CARRY)
|
||||
stop ();
|
||||
|
||||
/* set APM protocol level - 1.1 or bust. (this covers APM 1.2 also) */
|
||||
regs.eax = 0x530E;
|
||||
regs.ebx = 0;
|
||||
regs.ecx = 0x0101;
|
||||
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
|
||||
grub_bios_interrupt (0x15, ®s);
|
||||
if (regs.flags & GRUB_CPU_INT_FLAGS_CARRY)
|
||||
regs.flags = VasEBoot_CPU_INT_FLAGS_DEFAULT;
|
||||
VasEBoot_bios_interrupt (0x15, ®s);
|
||||
if (regs.flags & VasEBoot_CPU_INT_FLAGS_CARRY)
|
||||
stop ();
|
||||
|
||||
/* set the power state to off */
|
||||
regs.eax = 0x5307;
|
||||
regs.ebx = 1;
|
||||
regs.ecx = 3;
|
||||
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
|
||||
grub_bios_interrupt (0x15, ®s);
|
||||
regs.flags = VasEBoot_CPU_INT_FLAGS_DEFAULT;
|
||||
VasEBoot_bios_interrupt (0x15, ®s);
|
||||
|
||||
/* shouldn't reach here */
|
||||
stop ();
|
||||
}
|
||||
|
||||
static grub_err_t __attribute__ ((noreturn))
|
||||
grub_cmd_halt (grub_extcmd_context_t ctxt,
|
||||
static VasEBoot_err_t __attribute__ ((noreturn))
|
||||
VasEBoot_cmd_halt (VasEBoot_extcmd_context_t ctxt,
|
||||
int argc __attribute__ ((unused)),
|
||||
char **args __attribute__ ((unused)))
|
||||
|
||||
{
|
||||
struct grub_arg_list *state = ctxt->state;
|
||||
struct VasEBoot_arg_list *state = ctxt->state;
|
||||
int no_apm = 0;
|
||||
|
||||
if (state[0].set)
|
||||
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."),
|
||||
options);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(halt)
|
||||
VasEBoot_MOD_FINI(halt)
|
||||
{
|
||||
grub_unregister_extcmd (cmd);
|
||||
VasEBoot_unregister_extcmd (cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,41 +1,41 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/machine/int.h>
|
||||
#include <grub/machine/apm.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <VasEBoot/machine/int.h>
|
||||
#include <VasEBoot/machine/apm.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/command.h>
|
||||
#include <VasEBoot/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
VasEBoot_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
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 */
|
||||
regs.eax = 0x5300;
|
||||
regs.ebx = 0;
|
||||
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
|
||||
grub_bios_interrupt (0x15, ®s);
|
||||
regs.flags = VasEBoot_CPU_INT_FLAGS_DEFAULT;
|
||||
VasEBoot_bios_interrupt (0x15, ®s);
|
||||
|
||||
if (regs.flags & GRUB_CPU_INT_FLAGS_CARRY)
|
||||
if (regs.flags & VasEBoot_CPU_INT_FLAGS_CARRY)
|
||||
return 0;
|
||||
info->version = regs.eax & 0xffff;
|
||||
info->flags = regs.ecx & 0xffff;
|
||||
|
|
@ -43,16 +43,16 @@ grub_apm_get_info (struct grub_apm_info *info)
|
|||
/* disconnect APM first */
|
||||
regs.eax = 0x5304;
|
||||
regs.ebx = 0;
|
||||
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
|
||||
grub_bios_interrupt (0x15, ®s);
|
||||
regs.flags = VasEBoot_CPU_INT_FLAGS_DEFAULT;
|
||||
VasEBoot_bios_interrupt (0x15, ®s);
|
||||
|
||||
/* connect APM */
|
||||
regs.eax = 0x5303;
|
||||
regs.ebx = 0;
|
||||
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
|
||||
grub_bios_interrupt (0x15, ®s);
|
||||
regs.flags = VasEBoot_CPU_INT_FLAGS_DEFAULT;
|
||||
VasEBoot_bios_interrupt (0x15, ®s);
|
||||
|
||||
if (regs.flags & GRUB_CPU_INT_FLAGS_CARRY)
|
||||
if (regs.flags & VasEBoot_CPU_INT_FLAGS_CARRY)
|
||||
return 0;
|
||||
|
||||
info->cseg = regs.eax & 0xffff;
|
||||
|
|
@ -66,15 +66,15 @@ grub_apm_get_info (struct grub_apm_info *info)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_lsapm (grub_command_t cmd __attribute__ ((unused)),
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_lsapm (VasEBoot_command_t cmd __attribute__ ((unused)),
|
||||
int argc __attribute__ ((unused)), char **args __attribute__ ((unused)))
|
||||
{
|
||||
struct grub_apm_info info;
|
||||
if (!grub_apm_get_info (&info))
|
||||
return grub_error (GRUB_ERR_IO, N_("no APM found"));
|
||||
struct VasEBoot_apm_info info;
|
||||
if (!VasEBoot_apm_get_info (&info))
|
||||
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"
|
||||
"16-bit CS = 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_16, info.cseg_16_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 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 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 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"));
|
||||
grub_xputs (info.flags & GRUB_APM_FLAGS_DISENGAGED
|
||||
VasEBoot_xputs (info.flags & VasEBoot_APM_FLAGS_DISENGAGED
|
||||
? _("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."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(lsapm)
|
||||
VasEBoot_MOD_FINI(lsapm)
|
||||
{
|
||||
grub_unregister_command (cmd);
|
||||
VasEBoot_unregister_command (cmd);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -1,86 +1,86 @@
|
|||
/* play.c - command to play a tune */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
/* Lots of this file is borrowed from GNU/Hurd generic-speaker driver. */
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/term.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/cpu/io.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/time.h>
|
||||
#include <grub/speaker.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/file.h>
|
||||
#include <VasEBoot/disk.h>
|
||||
#include <VasEBoot/term.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/cpu/io.h>
|
||||
#include <VasEBoot/command.h>
|
||||
#include <VasEBoot/i18n.h>
|
||||
#include <VasEBoot/time.h>
|
||||
#include <VasEBoot/speaker.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
VasEBoot_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
#define BASE_TEMPO (60 * 1000)
|
||||
|
||||
|
||||
#define T_REST ((grub_uint16_t) 0)
|
||||
#define T_FINE ((grub_uint16_t) -1)
|
||||
#define T_REST ((VasEBoot_uint16_t) 0)
|
||||
#define T_FINE ((VasEBoot_uint16_t) -1)
|
||||
|
||||
struct note
|
||||
{
|
||||
grub_uint16_t pitch;
|
||||
grub_uint16_t duration;
|
||||
VasEBoot_uint16_t pitch;
|
||||
VasEBoot_uint16_t duration;
|
||||
};
|
||||
|
||||
/* Returns whether playing should continue. */
|
||||
static int
|
||||
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;
|
||||
|
||||
grub_dprintf ("play", "pitch = %d, duration = %d\n", note->pitch,
|
||||
VasEBoot_dprintf ("play", "pitch = %d, duration = %d\n", note->pitch,
|
||||
note->duration);
|
||||
|
||||
switch (note->pitch)
|
||||
{
|
||||
case T_REST:
|
||||
grub_speaker_beep_off ();
|
||||
VasEBoot_speaker_beep_off ();
|
||||
break;
|
||||
|
||||
default:
|
||||
grub_speaker_beep_on (note->pitch);
|
||||
VasEBoot_speaker_beep_on (note->pitch);
|
||||
break;
|
||||
}
|
||||
|
||||
to = grub_get_time_ms () + BASE_TEMPO * note->duration / tempo;
|
||||
while ((grub_get_time_ms () <= to)
|
||||
&& (grub_getkey_noblock () == GRUB_TERM_NO_KEY));
|
||||
to = VasEBoot_get_time_ms () + BASE_TEMPO * note->duration / tempo;
|
||||
while ((VasEBoot_get_time_ms () <= to)
|
||||
&& (VasEBoot_getkey_noblock () == VasEBoot_TERM_NO_KEY));
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_play (VasEBoot_command_t cmd __attribute__ ((unused)),
|
||||
int argc, char **args)
|
||||
{
|
||||
|
||||
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
|
||||
you take. Play command expects arguments which can
|
||||
be either a filename or tempo+notes.
|
||||
|
|
@ -90,45 +90,45 @@ grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
|
|||
if (argc == 1)
|
||||
{
|
||||
struct note buf;
|
||||
grub_uint32_t tempo;
|
||||
grub_file_t file;
|
||||
VasEBoot_uint32_t tempo;
|
||||
VasEBoot_file_t file;
|
||||
|
||||
file = grub_file_open (args[0]);
|
||||
file = VasEBoot_file_open (args[0]);
|
||||
|
||||
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);
|
||||
if (!grub_errno)
|
||||
grub_error (GRUB_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
|
||||
VasEBoot_file_close (file);
|
||||
if (!VasEBoot_errno)
|
||||
VasEBoot_error (VasEBoot_ERR_FILE_READ_ERROR, N_("premature end of file %s"),
|
||||
args[0]);
|
||||
return grub_errno;
|
||||
return VasEBoot_errno;
|
||||
}
|
||||
|
||||
if (!tempo)
|
||||
{
|
||||
grub_file_close (file);
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("Invalid tempo in %s"),
|
||||
VasEBoot_file_close (file);
|
||||
VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, N_("Invalid tempo in %s"),
|
||||
args[0]);
|
||||
return grub_errno;
|
||||
return VasEBoot_errno;
|
||||
}
|
||||
|
||||
tempo = grub_le_to_cpu32 (tempo);
|
||||
grub_dprintf ("play","tempo = %d\n", tempo);
|
||||
tempo = VasEBoot_le_to_cpu32 (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))
|
||||
{
|
||||
buf.pitch = grub_le_to_cpu16 (buf.pitch);
|
||||
buf.duration = grub_le_to_cpu16 (buf.duration);
|
||||
buf.pitch = VasEBoot_le_to_cpu16 (buf.pitch);
|
||||
buf.duration = VasEBoot_le_to_cpu16 (buf.duration);
|
||||
|
||||
if (play (tempo, &buf))
|
||||
break;
|
||||
}
|
||||
|
||||
grub_file_close (file);
|
||||
VasEBoot_file_close (file);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
@ -137,38 +137,38 @@ grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
|
|||
struct note note;
|
||||
int i;
|
||||
|
||||
tempo = grub_strtoul (args[0], &end, 0);
|
||||
tempo = VasEBoot_strtoul (args[0], &end, 0);
|
||||
|
||||
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]);
|
||||
return grub_errno;
|
||||
return VasEBoot_errno;
|
||||
}
|
||||
|
||||
if (*end)
|
||||
/* 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)
|
||||
{
|
||||
note.pitch = grub_strtoul (args[i], &end, 0);
|
||||
if (grub_errno)
|
||||
note.pitch = VasEBoot_strtoul (args[i], &end, 0);
|
||||
if (VasEBoot_errno)
|
||||
break;
|
||||
if (*end)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_NUMBER, N_("unrecognized number"));
|
||||
VasEBoot_error (VasEBoot_ERR_BAD_NUMBER, N_("unrecognized number"));
|
||||
break;
|
||||
}
|
||||
|
||||
note.duration = grub_strtoul (args[i + 1], &end, 0);
|
||||
if (grub_errno)
|
||||
note.duration = VasEBoot_strtoul (args[i + 1], &end, 0);
|
||||
if (VasEBoot_errno)
|
||||
break;
|
||||
if (*end)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_NUMBER, N_("unrecognized number"));
|
||||
VasEBoot_error (VasEBoot_ERR_BAD_NUMBER, N_("unrecognized number"));
|
||||
break;
|
||||
}
|
||||
|
||||
|
|
@ -177,21 +177,21 @@ grub_cmd_play (grub_command_t cmd __attribute__ ((unused)),
|
|||
}
|
||||
}
|
||||
|
||||
grub_speaker_beep_off ();
|
||||
VasEBoot_speaker_beep_off ();
|
||||
|
||||
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_("Play a tune."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(play)
|
||||
VasEBoot_MOD_FINI(play)
|
||||
{
|
||||
grub_unregister_command (cmd);
|
||||
VasEBoot_unregister_command (cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
/* sendkey.c - fake keystroke. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* Copyright (C) 2009 Free Software Foundation, Inc.
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/cpu/io.h>
|
||||
#include <grub/loader.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <VasEBoot/types.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/mm.h>
|
||||
#include <VasEBoot/err.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/extcmd.h>
|
||||
#include <VasEBoot/cpu/io.h>
|
||||
#include <VasEBoot/loader.h>
|
||||
#include <VasEBoot/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv2+");
|
||||
VasEBoot_MOD_LICENSE ("GPLv2+");
|
||||
|
||||
static char sendkey[0x20];
|
||||
/* Length of sendkey. */
|
||||
static int keylen = 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},
|
||||
{"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[]
|
||||
= {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
|
||||
keysym
|
||||
|
|
@ -71,7 +71,7 @@ keysym
|
|||
};
|
||||
|
||||
/* 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[] =
|
||||
{
|
||||
{"escape", 0, 0x1b, 0, 0x01},
|
||||
|
|
@ -176,7 +176,7 @@ static struct keysym keysym_table[] =
|
|||
OP - action id
|
||||
*/
|
||||
static void
|
||||
grub_sendkey_set_simple_flag (int outoffset, int op)
|
||||
VasEBoot_sendkey_set_simple_flag (int outoffset, int op)
|
||||
{
|
||||
if (op == 2)
|
||||
{
|
||||
|
|
@ -194,51 +194,51 @@ grub_sendkey_set_simple_flag (int outoffset, int op)
|
|||
}
|
||||
|
||||
static int
|
||||
grub_sendkey_parse_op (struct grub_arg_list state)
|
||||
VasEBoot_sendkey_parse_op (struct VasEBoot_arg_list state)
|
||||
{
|
||||
if (! state.set)
|
||||
return 2;
|
||||
|
||||
if (grub_strcmp (state.arg, "off") == 0 || grub_strcmp (state.arg, "0") == 0
|
||||
|| grub_strcmp (state.arg, "unpress") == 0)
|
||||
if (VasEBoot_strcmp (state.arg, "off") == 0 || VasEBoot_strcmp (state.arg, "0") == 0
|
||||
|| VasEBoot_strcmp (state.arg, "unpress") == 0)
|
||||
return 0;
|
||||
|
||||
if (grub_strcmp (state.arg, "on") == 0 || grub_strcmp (state.arg, "1") == 0
|
||||
|| grub_strcmp (state.arg, "press") == 0)
|
||||
if (VasEBoot_strcmp (state.arg, "on") == 0 || VasEBoot_strcmp (state.arg, "1") == 0
|
||||
|| VasEBoot_strcmp (state.arg, "press") == 0)
|
||||
return 1;
|
||||
|
||||
return 2;
|
||||
}
|
||||
|
||||
static grub_uint32_t oldflags;
|
||||
static VasEBoot_uint32_t oldflags;
|
||||
|
||||
static grub_err_t
|
||||
grub_sendkey_postboot (void)
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_sendkey_postboot (void)
|
||||
{
|
||||
/* For convention: pointer to flags. */
|
||||
grub_uint32_t *flags = (grub_uint32_t *) 0x417;
|
||||
VasEBoot_uint32_t *flags = (VasEBoot_uint32_t *) 0x417;
|
||||
|
||||
*flags = oldflags;
|
||||
|
||||
*((char *) 0x41a) = 0x1e;
|
||||
*((char *) 0x41c) = 0x1e;
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
return VasEBoot_ERR_NONE;
|
||||
}
|
||||
|
||||
/* Set keyboard buffer to our sendkey */
|
||||
static grub_err_t
|
||||
grub_sendkey_preboot (int noret __attribute__ ((unused)))
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_sendkey_preboot (int noret __attribute__ ((unused)))
|
||||
{
|
||||
/* For convention: pointer to flags. */
|
||||
grub_uint32_t *flags = (grub_uint32_t *) 0x417;
|
||||
VasEBoot_uint32_t *flags = (VasEBoot_uint32_t *) 0x417;
|
||||
|
||||
oldflags = *flags;
|
||||
|
||||
/* Set the sendkey. */
|
||||
*((char *) 0x41a) = 0x1e;
|
||||
*((char *) 0x41c) = keylen + 0x1e;
|
||||
grub_memcpy ((char *) 0x41e, sendkey, 0x20);
|
||||
VasEBoot_memcpy ((char *) 0x41e, sendkey, 0x20);
|
||||
|
||||
/* Transform "any ctrl" to "right ctrl" flag. */
|
||||
if (*flags & (1 << 8))
|
||||
|
|
@ -268,25 +268,25 @@ grub_sendkey_preboot (int noret __attribute__ ((unused)))
|
|||
{
|
||||
value = 0;
|
||||
/* Send command change LEDs */
|
||||
grub_outb (0xed, 0x60);
|
||||
VasEBoot_outb (0xed, 0x60);
|
||||
|
||||
/* Wait */
|
||||
do
|
||||
value = grub_inb (0x60);
|
||||
value = VasEBoot_inb (0x60);
|
||||
while ((value != 0xfa) && (value != 0xfe));
|
||||
|
||||
if (value == 0xfa)
|
||||
{
|
||||
/* Set new LEDs*/
|
||||
grub_outb ((*flags >> 4) & 7, 0x60);
|
||||
VasEBoot_outb ((*flags >> 4) & 7, 0x60);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return GRUB_ERR_NONE;
|
||||
return VasEBoot_ERR_NONE;
|
||||
}
|
||||
|
||||
/* Helper for grub_cmd_sendkey. */
|
||||
/* Helper for VasEBoot_cmd_sendkey. */
|
||||
static int
|
||||
find_key_code (char *key)
|
||||
{
|
||||
|
|
@ -295,17 +295,17 @@ find_key_code (char *key)
|
|||
for (i = 0; i < ARRAY_SIZE(keysym_table); i++)
|
||||
{
|
||||
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;
|
||||
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 0;
|
||||
}
|
||||
|
||||
/* Helper for grub_cmd_sendkey. */
|
||||
/* Helper for VasEBoot_cmd_sendkey. */
|
||||
static int
|
||||
find_ascii_code (char *key)
|
||||
{
|
||||
|
|
@ -314,20 +314,20 @@ find_ascii_code (char *key)
|
|||
for (i = 0; i < ARRAY_SIZE(keysym_table); i++)
|
||||
{
|
||||
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;
|
||||
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 0;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_sendkey (grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
static VasEBoot_err_t
|
||||
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;
|
||||
ormask = 0;
|
||||
|
|
@ -353,35 +353,35 @@ grub_cmd_sendkey (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
{
|
||||
unsigned i;
|
||||
for (i = 0; i < ARRAY_SIZE(simple_flag_offsets); i++)
|
||||
grub_sendkey_set_simple_flag (simple_flag_offsets[i],
|
||||
grub_sendkey_parse_op(state[i]));
|
||||
VasEBoot_sendkey_set_simple_flag (simple_flag_offsets[i],
|
||||
VasEBoot_sendkey_parse_op(state[i]));
|
||||
}
|
||||
|
||||
/* Set noled. */
|
||||
noled = (state[ARRAY_SIZE(simple_flag_offsets)].set);
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
return VasEBoot_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_extcmd_t cmd;
|
||||
static struct grub_preboot *preboot_hook;
|
||||
static VasEBoot_extcmd_t cmd;
|
||||
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] ..."),
|
||||
/* TRANSLATORS: It can emulate multiple
|
||||
keypresses. */
|
||||
N_("Emulate a keystroke sequence"), options);
|
||||
|
||||
preboot_hook
|
||||
= grub_loader_register_preboot_hook (grub_sendkey_preboot,
|
||||
grub_sendkey_postboot,
|
||||
GRUB_LOADER_PREBOOT_HOOK_PRIO_CONSOLE);
|
||||
= VasEBoot_loader_register_preboot_hook (VasEBoot_sendkey_preboot,
|
||||
VasEBoot_sendkey_postboot,
|
||||
VasEBoot_LOADER_PREBOOT_HOOK_PRIO_CONSOLE);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI (sendkey)
|
||||
VasEBoot_MOD_FINI (sendkey)
|
||||
{
|
||||
grub_unregister_extcmd (cmd);
|
||||
grub_loader_unregister_preboot_hook (preboot_hook);
|
||||
VasEBoot_unregister_extcmd (cmd);
|
||||
VasEBoot_loader_unregister_preboot_hook (preboot_hook);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,50 +1,50 @@
|
|||
/* smbios.c - get smbios tables. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/acpi.h>
|
||||
#include <grub/smbios.h>
|
||||
#include <grub/misc.h>
|
||||
#include <VasEBoot/acpi.h>
|
||||
#include <VasEBoot/smbios.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
|
||||
struct grub_smbios_eps *
|
||||
grub_machine_smbios_get_eps (void)
|
||||
struct VasEBoot_smbios_eps *
|
||||
VasEBoot_machine_smbios_get_eps (void)
|
||||
{
|
||||
grub_uint8_t *ptr;
|
||||
VasEBoot_uint8_t *ptr;
|
||||
|
||||
grub_dprintf ("smbios", "Looking for SMBIOS EPS. Scanning BIOS\n");
|
||||
for (ptr = (grub_uint8_t *) 0xf0000; ptr < (grub_uint8_t *) 0x100000;
|
||||
VasEBoot_dprintf ("smbios", "Looking for SMBIOS EPS. Scanning BIOS\n");
|
||||
for (ptr = (VasEBoot_uint8_t *) 0xf0000; ptr < (VasEBoot_uint8_t *) 0x100000;
|
||||
ptr += 16)
|
||||
if (grub_memcmp (ptr, "_SM_", 4) == 0
|
||||
&& grub_byte_checksum (ptr, sizeof (struct grub_smbios_eps)) == 0)
|
||||
return (struct grub_smbios_eps *) ptr;
|
||||
if (VasEBoot_memcmp (ptr, "_SM_", 4) == 0
|
||||
&& VasEBoot_byte_checksum (ptr, sizeof (struct VasEBoot_smbios_eps)) == 0)
|
||||
return (struct VasEBoot_smbios_eps *) ptr;
|
||||
return 0;
|
||||
}
|
||||
|
||||
struct grub_smbios_eps3 *
|
||||
grub_machine_smbios_get_eps3 (void)
|
||||
struct VasEBoot_smbios_eps3 *
|
||||
VasEBoot_machine_smbios_get_eps3 (void)
|
||||
{
|
||||
grub_uint8_t *ptr;
|
||||
VasEBoot_uint8_t *ptr;
|
||||
|
||||
grub_dprintf ("smbios", "Looking for SMBIOS3 EPS. Scanning BIOS\n");
|
||||
for (ptr = (grub_uint8_t *) 0xf0000; ptr < (grub_uint8_t *) 0x100000;
|
||||
VasEBoot_dprintf ("smbios", "Looking for SMBIOS3 EPS. Scanning BIOS\n");
|
||||
for (ptr = (VasEBoot_uint8_t *) 0xf0000; ptr < (VasEBoot_uint8_t *) 0x100000;
|
||||
ptr += 16)
|
||||
if (grub_memcmp (ptr, "_SM3_", 5) == 0
|
||||
&& grub_byte_checksum (ptr, sizeof (struct grub_smbios_eps3)) == 0)
|
||||
return (struct grub_smbios_eps3 *) ptr;
|
||||
if (VasEBoot_memcmp (ptr, "_SM3_", 5) == 0
|
||||
&& VasEBoot_byte_checksum (ptr, sizeof (struct VasEBoot_smbios_eps3)) == 0)
|
||||
return (struct VasEBoot_smbios_eps3 *) ptr;
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/term.h>
|
||||
#include <grub/ieee1275/ieee1275.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/term.h>
|
||||
#include <VasEBoot/ieee1275/ieee1275.h>
|
||||
#include <VasEBoot/command.h>
|
||||
#include <VasEBoot/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
VasEBoot_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_suspend (grub_command_t cmd __attribute__ ((unused)),
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_suspend (VasEBoot_command_t cmd __attribute__ ((unused)),
|
||||
int argc __attribute__ ((unused)),
|
||||
char **args __attribute__ ((unused)))
|
||||
{
|
||||
grub_puts_ (N_("Run `go' to resume GRUB."));
|
||||
grub_ieee1275_enter ();
|
||||
grub_cls ();
|
||||
VasEBoot_puts_ (N_("Run `go' to resume VasEBoot."));
|
||||
VasEBoot_ieee1275_enter ();
|
||||
VasEBoot_cls ();
|
||||
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."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(ieee1275_suspend)
|
||||
VasEBoot_MOD_FINI(ieee1275_suspend)
|
||||
{
|
||||
grub_unregister_command (cmd);
|
||||
VasEBoot_unregister_command (cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,35 +1,35 @@
|
|||
/* memrw.c - command to read / write physical memory */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/cpu/io.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/extcmd.h>
|
||||
#include <VasEBoot/env.h>
|
||||
#include <VasEBoot/cpu/io.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 grub_command_t cmd_write_byte, cmd_write_word, cmd_write_dword;
|
||||
static VasEBoot_extcmd_t cmd_read_byte, cmd_read_word, cmd_read_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."),
|
||||
N_("VARNAME"), ARG_TYPE_STRING},
|
||||
|
|
@ -37,119 +37,119 @@ static const struct grub_arg_option options[] =
|
|||
};
|
||||
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_read (grub_extcmd_context_t ctxt, int argc, char **argv)
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_read (VasEBoot_extcmd_context_t ctxt, int argc, char **argv)
|
||||
{
|
||||
grub_port_t addr;
|
||||
grub_uint32_t value = 0;
|
||||
VasEBoot_port_t addr;
|
||||
VasEBoot_uint32_t value = 0;
|
||||
|
||||
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])
|
||||
{
|
||||
case 'l':
|
||||
value = grub_inl (addr);
|
||||
value = VasEBoot_inl (addr);
|
||||
break;
|
||||
|
||||
case 'w':
|
||||
value = grub_inw (addr);
|
||||
value = VasEBoot_inw (addr);
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
value = grub_inb (addr);
|
||||
value = VasEBoot_inb (addr);
|
||||
break;
|
||||
}
|
||||
|
||||
if (ctxt->state[0].set)
|
||||
{
|
||||
char buf[sizeof ("XXXXXXXX")];
|
||||
grub_snprintf (buf, sizeof (buf), "%x", value);
|
||||
grub_env_set (ctxt->state[0].arg, buf);
|
||||
VasEBoot_snprintf (buf, sizeof (buf), "%x", value);
|
||||
VasEBoot_env_set (ctxt->state[0].arg, buf);
|
||||
}
|
||||
else
|
||||
grub_printf ("0x%x\n", value);
|
||||
VasEBoot_printf ("0x%x\n", value);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_write (grub_command_t cmd, int argc, char **argv)
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_write (VasEBoot_command_t cmd, int argc, char **argv)
|
||||
{
|
||||
grub_port_t addr;
|
||||
grub_uint32_t value;
|
||||
grub_uint32_t mask = 0xffffffff;
|
||||
VasEBoot_port_t addr;
|
||||
VasEBoot_uint32_t value;
|
||||
VasEBoot_uint32_t mask = 0xffffffff;
|
||||
|
||||
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);
|
||||
value = grub_strtoul (argv[1], 0, 0);
|
||||
addr = VasEBoot_strtoul (argv[0], 0, 0);
|
||||
value = VasEBoot_strtoul (argv[1], 0, 0);
|
||||
if (argc == 3)
|
||||
mask = grub_strtoul (argv[2], 0, 0);
|
||||
mask = VasEBoot_strtoul (argv[2], 0, 0);
|
||||
value &= mask;
|
||||
switch (cmd->name[sizeof ("out") - 1])
|
||||
{
|
||||
case 'l':
|
||||
if (mask != 0xffffffff)
|
||||
grub_outl ((grub_inl (addr) & ~mask) | value, addr);
|
||||
VasEBoot_outl ((VasEBoot_inl (addr) & ~mask) | value, addr);
|
||||
else
|
||||
grub_outl (value, addr);
|
||||
VasEBoot_outl (value, addr);
|
||||
break;
|
||||
|
||||
case 'w':
|
||||
if ((mask & 0xffff) != 0xffff)
|
||||
grub_outw ((grub_inw (addr) & ~mask) | value, addr);
|
||||
VasEBoot_outw ((VasEBoot_inw (addr) & ~mask) | value, addr);
|
||||
else
|
||||
grub_outw (value, addr);
|
||||
VasEBoot_outw (value, addr);
|
||||
break;
|
||||
|
||||
case 'b':
|
||||
if ((mask & 0xff) != 0xff)
|
||||
grub_outb ((grub_inb (addr) & ~mask) | value, addr);
|
||||
VasEBoot_outb ((VasEBoot_inb (addr) & ~mask) | value, addr);
|
||||
else
|
||||
grub_outb (value, addr);
|
||||
VasEBoot_outb (value, addr);
|
||||
break;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
GRUB_MOD_INIT(memrw)
|
||||
VasEBoot_MOD_INIT(memrw)
|
||||
{
|
||||
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."),
|
||||
options);
|
||||
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."),
|
||||
options);
|
||||
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."),
|
||||
options);
|
||||
cmd_write_byte =
|
||||
grub_register_command ("outb", grub_cmd_write,
|
||||
VasEBoot_register_command ("outb", VasEBoot_cmd_write,
|
||||
N_("PORT VALUE [MASK]"),
|
||||
N_("Write 8-bit VALUE to PORT."));
|
||||
cmd_write_word =
|
||||
grub_register_command ("outw", grub_cmd_write,
|
||||
VasEBoot_register_command ("outw", VasEBoot_cmd_write,
|
||||
N_("PORT VALUE [MASK]"),
|
||||
N_("Write 16-bit VALUE to PORT."));
|
||||
cmd_write_dword =
|
||||
grub_register_command ("outl", grub_cmd_write,
|
||||
VasEBoot_register_command ("outl", VasEBoot_cmd_write,
|
||||
N_("ADDR VALUE [MASK]"),
|
||||
N_("Write 32-bit VALUE to PORT."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(memrw)
|
||||
VasEBoot_MOD_FINI(memrw)
|
||||
{
|
||||
grub_unregister_extcmd (cmd_read_byte);
|
||||
grub_unregister_extcmd (cmd_read_word);
|
||||
grub_unregister_extcmd (cmd_read_dword);
|
||||
grub_unregister_command (cmd_write_byte);
|
||||
grub_unregister_command (cmd_write_word);
|
||||
grub_unregister_command (cmd_write_dword);
|
||||
VasEBoot_unregister_extcmd (cmd_read_byte);
|
||||
VasEBoot_unregister_extcmd (cmd_read_word);
|
||||
VasEBoot_unregister_extcmd (cmd_read_dword);
|
||||
VasEBoot_unregister_command (cmd_write_byte);
|
||||
VasEBoot_unregister_command (cmd_write_word);
|
||||
VasEBoot_unregister_command (cmd_write_dword);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,36 +1,36 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/term.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/time.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/keyboard_layouts.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/file.h>
|
||||
#include <VasEBoot/term.h>
|
||||
#include <VasEBoot/err.h>
|
||||
#include <VasEBoot/mm.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/env.h>
|
||||
#include <VasEBoot/time.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/keyboard_layouts.h>
|
||||
#include <VasEBoot/command.h>
|
||||
#include <VasEBoot/i18n.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 errors. Handled by driver. */
|
||||
/* 0x00 */ 0, 0, 0, 0,
|
||||
|
|
@ -47,30 +47,30 @@ static struct grub_keyboard_layout layout_us = {
|
|||
*/
|
||||
/* 0x30 */ ']', 0, '\\', ';', '\'', '`', ',', '.',
|
||||
/* 0x39 is CapsLock. Handled by driver. */
|
||||
/* 0x38 */ '/', 0, GRUB_TERM_KEY_F1, GRUB_TERM_KEY_F2,
|
||||
/* 0x3c */ GRUB_TERM_KEY_F3, GRUB_TERM_KEY_F4,
|
||||
/* 0x3e */ GRUB_TERM_KEY_F5, GRUB_TERM_KEY_F6,
|
||||
/* 0x40 */ GRUB_TERM_KEY_F7, GRUB_TERM_KEY_F8,
|
||||
/* 0x42 */ GRUB_TERM_KEY_F9, GRUB_TERM_KEY_F10,
|
||||
/* 0x44 */ GRUB_TERM_KEY_F11, GRUB_TERM_KEY_F12,
|
||||
/* 0x38 */ '/', 0, VasEBoot_TERM_KEY_F1, VasEBoot_TERM_KEY_F2,
|
||||
/* 0x3c */ VasEBoot_TERM_KEY_F3, VasEBoot_TERM_KEY_F4,
|
||||
/* 0x3e */ VasEBoot_TERM_KEY_F5, VasEBoot_TERM_KEY_F6,
|
||||
/* 0x40 */ VasEBoot_TERM_KEY_F7, VasEBoot_TERM_KEY_F8,
|
||||
/* 0x42 */ VasEBoot_TERM_KEY_F9, VasEBoot_TERM_KEY_F10,
|
||||
/* 0x44 */ VasEBoot_TERM_KEY_F11, VasEBoot_TERM_KEY_F12,
|
||||
/* PrtScr and ScrollLock. Not handled yet. */
|
||||
/* 0x46 */ 0, 0,
|
||||
/* 0x48 is Pause. Not handled yet. */
|
||||
/* 0x48 */ 0, GRUB_TERM_KEY_INSERT,
|
||||
/* 0x4a */ GRUB_TERM_KEY_HOME, GRUB_TERM_KEY_PPAGE,
|
||||
/* 0x4c */ GRUB_TERM_KEY_DC, GRUB_TERM_KEY_END,
|
||||
/* 0x4e */ GRUB_TERM_KEY_NPAGE, GRUB_TERM_KEY_RIGHT,
|
||||
/* 0x50 */ GRUB_TERM_KEY_LEFT, GRUB_TERM_KEY_DOWN,
|
||||
/* 0x48 */ 0, VasEBoot_TERM_KEY_INSERT,
|
||||
/* 0x4a */ VasEBoot_TERM_KEY_HOME, VasEBoot_TERM_KEY_PPAGE,
|
||||
/* 0x4c */ VasEBoot_TERM_KEY_DC, VasEBoot_TERM_KEY_END,
|
||||
/* 0x4e */ VasEBoot_TERM_KEY_NPAGE, VasEBoot_TERM_KEY_RIGHT,
|
||||
/* 0x50 */ VasEBoot_TERM_KEY_LEFT, VasEBoot_TERM_KEY_DOWN,
|
||||
/* 0x53 is NumLock. Handled by driver. */
|
||||
/* 0x52 */ GRUB_TERM_KEY_UP, 0,
|
||||
/* 0x52 */ VasEBoot_TERM_KEY_UP, 0,
|
||||
/* 0x54 */ '/', '*',
|
||||
/* 0x56 */ '-', '+',
|
||||
/* 0x58 */ '\n', GRUB_TERM_KEY_END,
|
||||
/* 0x5a */ GRUB_TERM_KEY_DOWN, GRUB_TERM_KEY_NPAGE,
|
||||
/* 0x5c */ GRUB_TERM_KEY_LEFT, GRUB_TERM_KEY_CENTER,
|
||||
/* 0x5e */ GRUB_TERM_KEY_RIGHT, GRUB_TERM_KEY_HOME,
|
||||
/* 0x60 */ GRUB_TERM_KEY_UP, GRUB_TERM_KEY_PPAGE,
|
||||
/* 0x62 */ GRUB_TERM_KEY_INSERT, GRUB_TERM_KEY_DC,
|
||||
/* 0x58 */ '\n', VasEBoot_TERM_KEY_END,
|
||||
/* 0x5a */ VasEBoot_TERM_KEY_DOWN, VasEBoot_TERM_KEY_NPAGE,
|
||||
/* 0x5c */ VasEBoot_TERM_KEY_LEFT, VasEBoot_TERM_KEY_CENTER,
|
||||
/* 0x5e */ VasEBoot_TERM_KEY_RIGHT, VasEBoot_TERM_KEY_HOME,
|
||||
/* 0x60 */ VasEBoot_TERM_KEY_UP, VasEBoot_TERM_KEY_PPAGE,
|
||||
/* 0x62 */ VasEBoot_TERM_KEY_INSERT, VasEBoot_TERM_KEY_DC,
|
||||
/* 0x64 */ '\\'
|
||||
},
|
||||
.keyboard_map_shift = {
|
||||
|
|
@ -82,9 +82,9 @@ static struct grub_keyboard_layout layout_us = {
|
|||
/* 0x10 */ 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T',
|
||||
/* 0x18 */ 'U', 'V', 'W', 'X', 'Y', 'Z', '!', '@',
|
||||
/* 0x20 */ '#', '$', '%', '^', '&', '*', '(', ')',
|
||||
/* 0x28 */ '\n' | GRUB_TERM_SHIFT, '\e' | GRUB_TERM_SHIFT,
|
||||
/* 0x2a */ '\b' | GRUB_TERM_SHIFT, '\t' | GRUB_TERM_SHIFT,
|
||||
/* 0x2c */ ' ' | GRUB_TERM_SHIFT, '_', '+', '{',
|
||||
/* 0x28 */ '\n' | VasEBoot_TERM_SHIFT, '\e' | VasEBoot_TERM_SHIFT,
|
||||
/* 0x2a */ '\b' | VasEBoot_TERM_SHIFT, '\t' | VasEBoot_TERM_SHIFT,
|
||||
/* 0x2c */ ' ' | VasEBoot_TERM_SHIFT, '_', '+', '{',
|
||||
/* According to usage table 0x31 should be mapped to '/'
|
||||
but testing with real keyboard shows that 0x32 is remapped to '/'.
|
||||
Map 0x31 to 0.
|
||||
|
|
@ -92,93 +92,93 @@ static struct grub_keyboard_layout layout_us = {
|
|||
/* 0x30 */ '}', 0, '|', ':', '"', '~', '<', '>',
|
||||
/* 0x39 is CapsLock. Handled by driver. */
|
||||
/* 0x38 */ '?', 0,
|
||||
/* 0x3a */ GRUB_TERM_KEY_F1 | GRUB_TERM_SHIFT,
|
||||
/* 0x3b */ GRUB_TERM_KEY_F2 | GRUB_TERM_SHIFT,
|
||||
/* 0x3c */ GRUB_TERM_KEY_F3 | GRUB_TERM_SHIFT,
|
||||
/* 0x3d */ GRUB_TERM_KEY_F4 | GRUB_TERM_SHIFT,
|
||||
/* 0x3e */ GRUB_TERM_KEY_F5 | GRUB_TERM_SHIFT,
|
||||
/* 0x3f */ GRUB_TERM_KEY_F6 | GRUB_TERM_SHIFT,
|
||||
/* 0x40 */ GRUB_TERM_KEY_F7 | GRUB_TERM_SHIFT,
|
||||
/* 0x41 */ GRUB_TERM_KEY_F8 | GRUB_TERM_SHIFT,
|
||||
/* 0x42 */ GRUB_TERM_KEY_F9 | GRUB_TERM_SHIFT,
|
||||
/* 0x43 */ GRUB_TERM_KEY_F10 | GRUB_TERM_SHIFT,
|
||||
/* 0x44 */ GRUB_TERM_KEY_F11 | GRUB_TERM_SHIFT,
|
||||
/* 0x45 */ GRUB_TERM_KEY_F12 | GRUB_TERM_SHIFT,
|
||||
/* 0x3a */ VasEBoot_TERM_KEY_F1 | VasEBoot_TERM_SHIFT,
|
||||
/* 0x3b */ VasEBoot_TERM_KEY_F2 | VasEBoot_TERM_SHIFT,
|
||||
/* 0x3c */ VasEBoot_TERM_KEY_F3 | VasEBoot_TERM_SHIFT,
|
||||
/* 0x3d */ VasEBoot_TERM_KEY_F4 | VasEBoot_TERM_SHIFT,
|
||||
/* 0x3e */ VasEBoot_TERM_KEY_F5 | VasEBoot_TERM_SHIFT,
|
||||
/* 0x3f */ VasEBoot_TERM_KEY_F6 | VasEBoot_TERM_SHIFT,
|
||||
/* 0x40 */ VasEBoot_TERM_KEY_F7 | VasEBoot_TERM_SHIFT,
|
||||
/* 0x41 */ VasEBoot_TERM_KEY_F8 | VasEBoot_TERM_SHIFT,
|
||||
/* 0x42 */ VasEBoot_TERM_KEY_F9 | VasEBoot_TERM_SHIFT,
|
||||
/* 0x43 */ VasEBoot_TERM_KEY_F10 | VasEBoot_TERM_SHIFT,
|
||||
/* 0x44 */ VasEBoot_TERM_KEY_F11 | VasEBoot_TERM_SHIFT,
|
||||
/* 0x45 */ VasEBoot_TERM_KEY_F12 | VasEBoot_TERM_SHIFT,
|
||||
/* PrtScr and ScrollLock. Not handled yet. */
|
||||
/* 0x46 */ 0, 0,
|
||||
/* 0x48 is Pause. Not handled yet. */
|
||||
/* 0x48 */ 0, GRUB_TERM_KEY_INSERT | GRUB_TERM_SHIFT,
|
||||
/* 0x4a */ GRUB_TERM_KEY_HOME | GRUB_TERM_SHIFT,
|
||||
/* 0x4b */ GRUB_TERM_KEY_PPAGE | GRUB_TERM_SHIFT,
|
||||
/* 0x4c */ GRUB_TERM_KEY_DC | GRUB_TERM_SHIFT,
|
||||
/* 0x4d */ GRUB_TERM_KEY_END | GRUB_TERM_SHIFT,
|
||||
/* 0x4e */ GRUB_TERM_KEY_NPAGE | GRUB_TERM_SHIFT,
|
||||
/* 0x4f */ GRUB_TERM_KEY_RIGHT | GRUB_TERM_SHIFT,
|
||||
/* 0x50 */ GRUB_TERM_KEY_LEFT | GRUB_TERM_SHIFT,
|
||||
/* 0x51 */ GRUB_TERM_KEY_DOWN | GRUB_TERM_SHIFT,
|
||||
/* 0x48 */ 0, VasEBoot_TERM_KEY_INSERT | VasEBoot_TERM_SHIFT,
|
||||
/* 0x4a */ VasEBoot_TERM_KEY_HOME | VasEBoot_TERM_SHIFT,
|
||||
/* 0x4b */ VasEBoot_TERM_KEY_PPAGE | VasEBoot_TERM_SHIFT,
|
||||
/* 0x4c */ VasEBoot_TERM_KEY_DC | VasEBoot_TERM_SHIFT,
|
||||
/* 0x4d */ VasEBoot_TERM_KEY_END | VasEBoot_TERM_SHIFT,
|
||||
/* 0x4e */ VasEBoot_TERM_KEY_NPAGE | VasEBoot_TERM_SHIFT,
|
||||
/* 0x4f */ VasEBoot_TERM_KEY_RIGHT | VasEBoot_TERM_SHIFT,
|
||||
/* 0x50 */ VasEBoot_TERM_KEY_LEFT | VasEBoot_TERM_SHIFT,
|
||||
/* 0x51 */ VasEBoot_TERM_KEY_DOWN | VasEBoot_TERM_SHIFT,
|
||||
/* 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 */ '/', '*',
|
||||
/* 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', '.', '|'
|
||||
}
|
||||
};
|
||||
|
||||
static struct grub_keyboard_layout *grub_current_layout = &layout_us;
|
||||
static struct VasEBoot_keyboard_layout *VasEBoot_current_layout = &layout_us;
|
||||
|
||||
static int
|
||||
map_key_core (int code, int status, int *alt_gr_consumed)
|
||||
{
|
||||
*alt_gr_consumed = 0;
|
||||
|
||||
if (code >= GRUB_KEYBOARD_LAYOUTS_ARRAY_SIZE)
|
||||
if (code >= VasEBoot_KEYBOARD_LAYOUTS_ARRAY_SIZE)
|
||||
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;
|
||||
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;
|
||||
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))
|
||||
return grub_current_layout->keyboard_map_shift[code];
|
||||
if (status & (VasEBoot_TERM_STATUS_LSHIFT | VasEBoot_TERM_STATUS_RSHIFT))
|
||||
return VasEBoot_current_layout->keyboard_map_shift[code];
|
||||
else
|
||||
return grub_current_layout->keyboard_map[code];
|
||||
return VasEBoot_current_layout->keyboard_map[code];
|
||||
}
|
||||
|
||||
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 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))
|
||||
status &= ~(GRUB_TERM_STATUS_RSHIFT | GRUB_TERM_STATUS_LSHIFT);
|
||||
if (status & (VasEBoot_TERM_STATUS_RSHIFT | VasEBoot_TERM_STATUS_LSHIFT))
|
||||
status &= ~(VasEBoot_TERM_STATUS_RSHIFT | VasEBoot_TERM_STATUS_LSHIFT);
|
||||
else
|
||||
status |= GRUB_TERM_STATUS_RSHIFT;
|
||||
status |= VasEBoot_TERM_STATUS_RSHIFT;
|
||||
}
|
||||
|
||||
key = map_key_core (code, status, &alt_gr_consumed);
|
||||
|
||||
if (key == 0 || key == GRUB_TERM_SHIFT) {
|
||||
grub_printf ("Unknown key 0x%x detected\n", code);
|
||||
return GRUB_TERM_NO_KEY;
|
||||
if (key == 0 || key == VasEBoot_TERM_SHIFT) {
|
||||
VasEBoot_printf ("Unknown key 0x%x detected\n", code);
|
||||
return VasEBoot_TERM_NO_KEY;
|
||||
}
|
||||
|
||||
if (status & GRUB_TERM_STATUS_CAPS)
|
||||
if (status & VasEBoot_TERM_STATUS_CAPS)
|
||||
{
|
||||
if ((key >= 'a') && (key <= 'z'))
|
||||
key += 'A' - 'a';
|
||||
|
|
@ -186,122 +186,122 @@ grub_term_map_key (grub_keyboard_key_t code, int status)
|
|||
key += 'a' - 'A';
|
||||
}
|
||||
|
||||
if ((status & GRUB_TERM_STATUS_LALT) ||
|
||||
((status & GRUB_TERM_STATUS_RALT) && !alt_gr_consumed))
|
||||
key |= GRUB_TERM_ALT;
|
||||
if (status & (GRUB_TERM_STATUS_LCTRL | GRUB_TERM_STATUS_RCTRL))
|
||||
key |= GRUB_TERM_CTRL;
|
||||
if ((status & VasEBoot_TERM_STATUS_LALT) ||
|
||||
((status & VasEBoot_TERM_STATUS_RALT) && !alt_gr_consumed))
|
||||
key |= VasEBoot_TERM_ALT;
|
||||
if (status & (VasEBoot_TERM_STATUS_LCTRL | VasEBoot_TERM_STATUS_RCTRL))
|
||||
key |= VasEBoot_TERM_CTRL;
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_keymap (struct grub_command *cmd __attribute__ ((unused)),
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_keymap (struct VasEBoot_command *cmd __attribute__ ((unused)),
|
||||
int argc, char *argv[])
|
||||
{
|
||||
char *filename;
|
||||
grub_file_t file;
|
||||
grub_uint32_t version;
|
||||
grub_uint8_t magic[GRUB_KEYBOARD_LAYOUTS_FILEMAGIC_SIZE];
|
||||
struct grub_keyboard_layout *newmap = NULL;
|
||||
VasEBoot_file_t file;
|
||||
VasEBoot_uint32_t version;
|
||||
VasEBoot_uint8_t magic[VasEBoot_KEYBOARD_LAYOUTS_FILEMAGIC_SIZE];
|
||||
struct VasEBoot_keyboard_layout *newmap = NULL;
|
||||
unsigned i;
|
||||
|
||||
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] != '+')
|
||||
{
|
||||
const char *prefix = grub_env_get ("prefix");
|
||||
const char *prefix = VasEBoot_env_get ("prefix");
|
||||
if (!prefix)
|
||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, N_("variable `%s' isn't set"), "prefix");
|
||||
filename = grub_xasprintf ("%s/layouts/%s.gkb", prefix, argv[0]);
|
||||
return VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, N_("variable `%s' isn't set"), "prefix");
|
||||
filename = VasEBoot_xasprintf ("%s/layouts/%s.gkb", prefix, argv[0]);
|
||||
if (!filename)
|
||||
return grub_errno;
|
||||
return VasEBoot_errno;
|
||||
}
|
||||
else
|
||||
filename = argv[0];
|
||||
|
||||
file = grub_file_open (filename);
|
||||
file = VasEBoot_file_open (filename);
|
||||
if (! file)
|
||||
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)
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("premature end of file %s"),
|
||||
if (!VasEBoot_errno)
|
||||
VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, N_("premature end of file %s"),
|
||||
filename);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (grub_memcmp (magic, GRUB_KEYBOARD_LAYOUTS_FILEMAGIC,
|
||||
GRUB_KEYBOARD_LAYOUTS_FILEMAGIC_SIZE) != 0)
|
||||
if (VasEBoot_memcmp (magic, VasEBoot_KEYBOARD_LAYOUTS_FILEMAGIC,
|
||||
VasEBoot_KEYBOARD_LAYOUTS_FILEMAGIC_SIZE) != 0)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid magic");
|
||||
VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, "invalid magic");
|
||||
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)
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("premature end of file %s"),
|
||||
if (!VasEBoot_errno)
|
||||
VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, N_("premature end of file %s"),
|
||||
filename);
|
||||
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;
|
||||
}
|
||||
|
||||
newmap = grub_malloc (sizeof (*newmap));
|
||||
newmap = VasEBoot_malloc (sizeof (*newmap));
|
||||
if (!newmap)
|
||||
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)
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, N_("premature end of file %s"),
|
||||
if (!VasEBoot_errno)
|
||||
VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, N_("premature end of file %s"),
|
||||
filename);
|
||||
goto fail;
|
||||
}
|
||||
|
||||
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++)
|
||||
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++)
|
||||
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++)
|
||||
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:
|
||||
if (filename != argv[0])
|
||||
grub_free (filename);
|
||||
grub_free (newmap);
|
||||
VasEBoot_free (filename);
|
||||
VasEBoot_free (newmap);
|
||||
if (file)
|
||||
grub_file_close (file);
|
||||
return grub_errno;
|
||||
VasEBoot_file_close (file);
|
||||
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."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(keylayouts)
|
||||
VasEBoot_MOD_FINI(keylayouts)
|
||||
{
|
||||
grub_unregister_command (cmd);
|
||||
VasEBoot_unregister_command (cmd);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,31 +1,31 @@
|
|||
/* keystatus.c - Command to check key modifier status. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* VasEBoot -- GRand Unified Bootloader
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/term.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/extcmd.h>
|
||||
#include <VasEBoot/term.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
|
||||
"true" is returned, otherwise "false". */
|
||||
|
|
@ -36,13 +36,13 @@ static const struct grub_arg_option options[] =
|
|||
};
|
||||
|
||||
static int
|
||||
grub_getkeystatus (void)
|
||||
VasEBoot_getkeystatus (void)
|
||||
{
|
||||
int status = 0;
|
||||
grub_term_input_t term;
|
||||
VasEBoot_term_input_t term;
|
||||
|
||||
if (grub_term_poll_usb)
|
||||
grub_term_poll_usb (0);
|
||||
if (VasEBoot_term_poll_usb)
|
||||
VasEBoot_term_poll_usb (0);
|
||||
|
||||
FOR_ACTIVE_TERM_INPUTS(term)
|
||||
{
|
||||
|
|
@ -53,61 +53,61 @@ grub_getkeystatus (void)
|
|||
return status;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_keystatus (grub_extcmd_context_t ctxt,
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_keystatus (VasEBoot_extcmd_context_t ctxt,
|
||||
int argc __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 mods;
|
||||
|
||||
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)
|
||||
expect_mods |= (GRUB_TERM_STATUS_LCTRL | GRUB_TERM_STATUS_RCTRL);
|
||||
expect_mods |= (VasEBoot_TERM_STATUS_LCTRL | VasEBoot_TERM_STATUS_RCTRL);
|
||||
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
|
||||
all. */
|
||||
if (expect_mods == 0)
|
||||
{
|
||||
grub_term_input_t term;
|
||||
VasEBoot_term_input_t term;
|
||||
int nterms = 0;
|
||||
|
||||
FOR_ACTIVE_TERM_INPUTS (term)
|
||||
if (!term->getkeystatus)
|
||||
return grub_error (GRUB_ERR_TEST_FAILURE, N_("false"));
|
||||
return VasEBoot_error (VasEBoot_ERR_TEST_FAILURE, N_("false"));
|
||||
else
|
||||
nterms++;
|
||||
if (!nterms)
|
||||
return grub_error (GRUB_ERR_TEST_FAILURE, N_("false"));
|
||||
return VasEBoot_error (VasEBoot_ERR_TEST_FAILURE, N_("false"));
|
||||
return 0;
|
||||
}
|
||||
|
||||
mods = grub_getkeystatus ();
|
||||
grub_dprintf ("keystatus", "mods: %d\n", mods);
|
||||
mods = VasEBoot_getkeystatus ();
|
||||
VasEBoot_dprintf ("keystatus", "mods: %d\n", mods);
|
||||
if (mods >= 0 && (mods & expect_mods) != 0)
|
||||
return 0;
|
||||
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]",
|
||||
/* TRANSLATORS: there are 3 modifiers. */
|
||||
N_("Check key modifier status."),
|
||||
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
|
|
@ -1,36 +1,36 @@
|
|||
/* 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.
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/dl.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/env.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/lib/envblk.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/mm.h>
|
||||
#include <VasEBoot/file.h>
|
||||
#include <VasEBoot/disk.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/env.h>
|
||||
#include <VasEBoot/partition.h>
|
||||
#include <VasEBoot/lib/envblk.h>
|
||||
#include <VasEBoot/extcmd.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
|
||||
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
|
||||
PUBKEY filter (that insists upon properly signed files) as well. PUBKEY
|
||||
filter is restored before the function returns. */
|
||||
static grub_file_t
|
||||
static VasEBoot_file_t
|
||||
open_envblk_file (char *filename, int untrusted)
|
||||
{
|
||||
grub_file_t file;
|
||||
VasEBoot_file_t file;
|
||||
char *buf = 0;
|
||||
|
||||
if (! filename)
|
||||
|
|
@ -54,56 +54,56 @@ open_envblk_file (char *filename, int untrusted)
|
|||
const char *prefix;
|
||||
int len;
|
||||
|
||||
prefix = grub_env_get ("prefix");
|
||||
prefix = VasEBoot_env_get ("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;
|
||||
}
|
||||
|
||||
len = grub_strlen (prefix);
|
||||
buf = grub_malloc (len + 1 + sizeof (GRUB_ENVBLK_DEFCFG));
|
||||
len = VasEBoot_strlen (prefix);
|
||||
buf = VasEBoot_malloc (len + 1 + sizeof (VasEBoot_ENVBLK_DEFCFG));
|
||||
if (! buf)
|
||||
return 0;
|
||||
filename = buf;
|
||||
|
||||
grub_strcpy (filename, prefix);
|
||||
VasEBoot_strcpy (filename, prefix);
|
||||
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
|
||||
grub_file_open() after this particular file is opened. */
|
||||
grub_file_filter_disable_compression ();
|
||||
VasEBoot_file_open() after this particular file is opened. */
|
||||
VasEBoot_file_filter_disable_compression ();
|
||||
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;
|
||||
}
|
||||
|
||||
static grub_envblk_t
|
||||
read_envblk_file (grub_file_t file)
|
||||
static VasEBoot_envblk_t
|
||||
read_envblk_file (VasEBoot_file_t file)
|
||||
{
|
||||
grub_off_t offset = 0;
|
||||
VasEBoot_off_t offset = 0;
|
||||
char *buf;
|
||||
grub_size_t size = grub_file_size (file);
|
||||
grub_envblk_t envblk;
|
||||
VasEBoot_size_t size = VasEBoot_file_size (file);
|
||||
VasEBoot_envblk_t envblk;
|
||||
|
||||
buf = grub_malloc (size);
|
||||
buf = VasEBoot_malloc (size);
|
||||
if (! buf)
|
||||
return 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)
|
||||
{
|
||||
grub_free (buf);
|
||||
VasEBoot_free (buf);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -111,61 +111,61 @@ read_envblk_file (grub_file_t file)
|
|||
offset += ret;
|
||||
}
|
||||
|
||||
envblk = grub_envblk_open (buf, offset);
|
||||
envblk = VasEBoot_envblk_open (buf, offset);
|
||||
if (! envblk)
|
||||
{
|
||||
grub_free (buf);
|
||||
grub_error (GRUB_ERR_BAD_FILE_TYPE, "invalid environment block");
|
||||
VasEBoot_free (buf);
|
||||
VasEBoot_error (VasEBoot_ERR_BAD_FILE_TYPE, "invalid environment block");
|
||||
return 0;
|
||||
}
|
||||
|
||||
return envblk;
|
||||
}
|
||||
|
||||
struct grub_env_whitelist
|
||||
struct VasEBoot_env_whitelist
|
||||
{
|
||||
grub_size_t len;
|
||||
VasEBoot_size_t len;
|
||||
char **list;
|
||||
};
|
||||
typedef struct grub_env_whitelist grub_env_whitelist_t;
|
||||
typedef struct VasEBoot_env_whitelist VasEBoot_env_whitelist_t;
|
||||
|
||||
static int
|
||||
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++)
|
||||
if (grub_strcmp (name, whitelist->list[i]) == 0)
|
||||
if (VasEBoot_strcmp (name, whitelist->list[i]) == 0)
|
||||
return 1; /* found it */
|
||||
|
||||
return 0; /* not found */
|
||||
}
|
||||
|
||||
/* Helper for grub_cmd_load_env. */
|
||||
/* Helper for VasEBoot_cmd_load_env. */
|
||||
static int
|
||||
set_var (const char *name, const char *value, void *whitelist)
|
||||
{
|
||||
if (! whitelist)
|
||||
{
|
||||
grub_env_set (name, value);
|
||||
VasEBoot_env_set (name, value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (test_whitelist_membership (name,
|
||||
(const grub_env_whitelist_t *) whitelist))
|
||||
grub_env_set (name, value);
|
||||
(const VasEBoot_env_whitelist_t *) whitelist))
|
||||
VasEBoot_env_set (name, value);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_load_env (grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_load_env (VasEBoot_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
struct grub_arg_list *state = ctxt->state;
|
||||
grub_file_t file;
|
||||
grub_envblk_t envblk;
|
||||
grub_env_whitelist_t whitelist;
|
||||
struct VasEBoot_arg_list *state = ctxt->state;
|
||||
VasEBoot_file_t file;
|
||||
VasEBoot_envblk_t envblk;
|
||||
VasEBoot_env_whitelist_t whitelist;
|
||||
|
||||
whitelist.len = argc;
|
||||
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 */
|
||||
file = open_envblk_file ((state[0].set) ? state[0].arg : 0, state[1].set);
|
||||
if (! file)
|
||||
return grub_errno;
|
||||
return VasEBoot_errno;
|
||||
|
||||
envblk = read_envblk_file (file);
|
||||
if (! envblk)
|
||||
goto fail;
|
||||
|
||||
/* argc > 0 indicates caller provided a whitelist of variables to read. */
|
||||
grub_envblk_iterate (envblk, argc > 0 ? &whitelist : 0, set_var);
|
||||
grub_envblk_close (envblk);
|
||||
VasEBoot_envblk_iterate (envblk, argc > 0 ? &whitelist : 0, set_var);
|
||||
VasEBoot_envblk_close (envblk);
|
||||
|
||||
fail:
|
||||
grub_file_close (file);
|
||||
return grub_errno;
|
||||
VasEBoot_file_close (file);
|
||||
return VasEBoot_errno;
|
||||
}
|
||||
|
||||
/* Print all variables in current context. */
|
||||
|
|
@ -193,39 +193,39 @@ static int
|
|||
print_var (const char *name, const char *value,
|
||||
void *hook_data __attribute__ ((unused)))
|
||||
{
|
||||
grub_printf ("%s=%s\n", name, value);
|
||||
VasEBoot_printf ("%s=%s\n", name, value);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_list_env (grub_extcmd_context_t ctxt,
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_list_env (VasEBoot_extcmd_context_t ctxt,
|
||||
int argc __attribute__ ((unused)),
|
||||
char **args __attribute__ ((unused)))
|
||||
{
|
||||
struct grub_arg_list *state = ctxt->state;
|
||||
grub_file_t file;
|
||||
grub_envblk_t envblk;
|
||||
struct VasEBoot_arg_list *state = ctxt->state;
|
||||
VasEBoot_file_t file;
|
||||
VasEBoot_envblk_t envblk;
|
||||
|
||||
file = open_envblk_file ((state[0].set) ? state[0].arg : 0, 0);
|
||||
if (! file)
|
||||
return grub_errno;
|
||||
return VasEBoot_errno;
|
||||
|
||||
envblk = read_envblk_file (file);
|
||||
if (! envblk)
|
||||
goto fail;
|
||||
|
||||
grub_envblk_iterate (envblk, NULL, print_var);
|
||||
grub_envblk_close (envblk);
|
||||
VasEBoot_envblk_iterate (envblk, NULL, print_var);
|
||||
VasEBoot_envblk_close (envblk);
|
||||
|
||||
fail:
|
||||
grub_file_close (file);
|
||||
return grub_errno;
|
||||
VasEBoot_file_close (file);
|
||||
return VasEBoot_errno;
|
||||
}
|
||||
|
||||
/* Used to maintain a variable length of blocklists internally. */
|
||||
struct blocklist
|
||||
{
|
||||
grub_disk_addr_t sector;
|
||||
VasEBoot_disk_addr_t sector;
|
||||
unsigned offset;
|
||||
unsigned length;
|
||||
struct blocklist *next;
|
||||
|
|
@ -239,18 +239,18 @@ free_blocklists (struct blocklist *p)
|
|||
for (; p; p = q)
|
||||
{
|
||||
q = p->next;
|
||||
grub_free (p);
|
||||
VasEBoot_free (p);
|
||||
}
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
|
||||
grub_file_t file)
|
||||
static VasEBoot_err_t
|
||||
check_blocklists (VasEBoot_envblk_t envblk, struct blocklist *blocklists,
|
||||
VasEBoot_file_t file)
|
||||
{
|
||||
grub_size_t total_length;
|
||||
grub_size_t index;
|
||||
grub_disk_t disk;
|
||||
grub_disk_addr_t part_start;
|
||||
VasEBoot_size_t total_length;
|
||||
VasEBoot_size_t index;
|
||||
VasEBoot_disk_t disk;
|
||||
VasEBoot_disk_addr_t part_start;
|
||||
struct blocklist *p;
|
||||
char *buf;
|
||||
|
||||
|
|
@ -262,81 +262,81 @@ check_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
|
|||
/* Check if any pair of blocks overlap. */
|
||||
for (q = p->next; q; q = q->next)
|
||||
{
|
||||
grub_disk_addr_t s1, s2;
|
||||
grub_disk_addr_t e1, e2;
|
||||
VasEBoot_disk_addr_t s1, s2;
|
||||
VasEBoot_disk_addr_t e1, e2;
|
||||
|
||||
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;
|
||||
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)
|
||||
{
|
||||
/* This might be actually valid, but it is unbelievable that
|
||||
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;
|
||||
}
|
||||
|
||||
if (total_length != grub_file_size (file))
|
||||
if (total_length != VasEBoot_file_size (file))
|
||||
{
|
||||
/* Maybe sparse, unallocated sectors. No way in GRUB. */
|
||||
return grub_error (GRUB_ERR_BAD_FILE_TYPE, "sparse file not allowed");
|
||||
/* Maybe sparse, unallocated sectors. No way in VasEBoot. */
|
||||
return VasEBoot_error (VasEBoot_ERR_BAD_FILE_TYPE, "sparse file not allowed");
|
||||
}
|
||||
|
||||
/* One more sanity check. Re-read all sectors by blocklists, and compare
|
||||
those with the data read via a file. */
|
||||
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;
|
||||
grub_size_t blockbuf_len = 0;
|
||||
VasEBoot_size_t blockbuf_len = 0;
|
||||
for (p = blocklists, index = 0; p; index += p->length, p = p->next)
|
||||
{
|
||||
if (p->length > blockbuf_len)
|
||||
{
|
||||
grub_free (blockbuf);
|
||||
VasEBoot_free (blockbuf);
|
||||
blockbuf_len = 2 * p->length;
|
||||
blockbuf = grub_malloc (blockbuf_len);
|
||||
blockbuf = VasEBoot_malloc (blockbuf_len);
|
||||
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))
|
||||
return grub_errno;
|
||||
return VasEBoot_errno;
|
||||
|
||||
if (grub_memcmp (buf + index, blockbuf, p->length) != 0)
|
||||
return grub_error (GRUB_ERR_FILE_READ_ERROR, "invalid blocklist");
|
||||
if (VasEBoot_memcmp (buf + index, blockbuf, p->length) != 0)
|
||||
return VasEBoot_error (VasEBoot_ERR_FILE_READ_ERROR, "invalid blocklist");
|
||||
}
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
return VasEBoot_ERR_NONE;
|
||||
}
|
||||
|
||||
static int
|
||||
write_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
|
||||
grub_file_t file)
|
||||
write_blocklists (VasEBoot_envblk_t envblk, struct blocklist *blocklists,
|
||||
VasEBoot_file_t file)
|
||||
{
|
||||
char *buf;
|
||||
grub_disk_t disk;
|
||||
grub_disk_addr_t part_start;
|
||||
VasEBoot_disk_t disk;
|
||||
VasEBoot_disk_addr_t part_start;
|
||||
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;
|
||||
part_start = grub_partition_get_start (disk->partition);
|
||||
part_start = VasEBoot_partition_get_start (disk->partition);
|
||||
|
||||
index = 0;
|
||||
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))
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -344,21 +344,21 @@ write_blocklists (grub_envblk_t envblk, struct blocklist *blocklists,
|
|||
return 1;
|
||||
}
|
||||
|
||||
/* Context for grub_cmd_save_env. */
|
||||
struct grub_cmd_save_env_ctx
|
||||
/* Context for VasEBoot_cmd_save_env. */
|
||||
struct VasEBoot_cmd_save_env_ctx
|
||||
{
|
||||
struct blocklist *head, *tail;
|
||||
};
|
||||
|
||||
/* Store blocklists in a linked list. */
|
||||
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)
|
||||
{
|
||||
struct grub_cmd_save_env_ctx *ctx = data;
|
||||
struct VasEBoot_cmd_save_env_ctx *ctx = data;
|
||||
struct blocklist *block;
|
||||
|
||||
block = grub_malloc (sizeof (*block));
|
||||
block = VasEBoot_malloc (sizeof (*block));
|
||||
if (! block)
|
||||
return;
|
||||
|
||||
|
|
@ -375,29 +375,29 @@ save_env_read_hook (grub_disk_addr_t sector, unsigned offset, unsigned length,
|
|||
ctx->head = block;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_save_env (grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_cmd_save_env (VasEBoot_extcmd_context_t ctxt, int argc, char **args)
|
||||
{
|
||||
struct grub_arg_list *state = ctxt->state;
|
||||
grub_file_t file;
|
||||
grub_envblk_t envblk;
|
||||
struct grub_cmd_save_env_ctx ctx = {
|
||||
struct VasEBoot_arg_list *state = ctxt->state;
|
||||
VasEBoot_file_t file;
|
||||
VasEBoot_envblk_t envblk;
|
||||
struct VasEBoot_cmd_save_env_ctx ctx = {
|
||||
.head = 0,
|
||||
.tail = 0
|
||||
};
|
||||
|
||||
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,
|
||||
1 /* allow untrusted */);
|
||||
if (! file)
|
||||
return grub_errno;
|
||||
return VasEBoot_errno;
|
||||
|
||||
if (! file->device->disk)
|
||||
{
|
||||
grub_file_close (file);
|
||||
return grub_error (GRUB_ERR_BAD_DEVICE, "disk device required");
|
||||
VasEBoot_file_close (file);
|
||||
return VasEBoot_error (VasEBoot_ERR_BAD_DEVICE, "disk device required");
|
||||
}
|
||||
|
||||
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;
|
||||
|
||||
value = grub_env_get (args[0]);
|
||||
value = VasEBoot_env_get (args[0]);
|
||||
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;
|
||||
}
|
||||
}
|
||||
else
|
||||
grub_envblk_delete (envblk, args[0]);
|
||||
VasEBoot_envblk_delete (envblk, args[0]);
|
||||
|
||||
argc--;
|
||||
args++;
|
||||
|
|
@ -434,35 +434,35 @@ grub_cmd_save_env (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
|
||||
fail:
|
||||
if (envblk)
|
||||
grub_envblk_close (envblk);
|
||||
VasEBoot_envblk_close (envblk);
|
||||
free_blocklists (ctx.head);
|
||||
grub_file_close (file);
|
||||
return grub_errno;
|
||||
VasEBoot_file_close (file);
|
||||
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 =
|
||||
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_("Load variables from environment block file."),
|
||||
options);
|
||||
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."),
|
||||
options);
|
||||
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_("Save variables to environment block file."),
|
||||
options);
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(loadenv)
|
||||
VasEBoot_MOD_FINI(loadenv)
|
||||
{
|
||||
grub_unregister_extcmd (cmd_load);
|
||||
grub_unregister_extcmd (cmd_list);
|
||||
grub_unregister_extcmd (cmd_save);
|
||||
VasEBoot_unregister_extcmd (cmd_load);
|
||||
VasEBoot_unregister_extcmd (cmd_list);
|
||||
VasEBoot_unregister_extcmd (cmd_save);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,41 +1,41 @@
|
|||
/* 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.
|
||||
*
|
||||
* 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
|
||||
* the Free Software Foundation, either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* GRUB is distributed in the hope that it will be useful,
|
||||
* VasEBoot is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
* along with VasEBoot. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/types.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/err.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/device.h>
|
||||
#include <grub/term.h>
|
||||
#include <grub/partition.h>
|
||||
#include <grub/file.h>
|
||||
#include <grub/normal.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/datetime.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/net.h>
|
||||
#include <VasEBoot/types.h>
|
||||
#include <VasEBoot/misc.h>
|
||||
#include <VasEBoot/mm.h>
|
||||
#include <VasEBoot/err.h>
|
||||
#include <VasEBoot/dl.h>
|
||||
#include <VasEBoot/disk.h>
|
||||
#include <VasEBoot/device.h>
|
||||
#include <VasEBoot/term.h>
|
||||
#include <VasEBoot/partition.h>
|
||||
#include <VasEBoot/file.h>
|
||||
#include <VasEBoot/normal.h>
|
||||
#include <VasEBoot/extcmd.h>
|
||||
#include <VasEBoot/datetime.h>
|
||||
#include <VasEBoot/i18n.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},
|
||||
{"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}
|
||||
};
|
||||
|
||||
/* Helper for grub_ls_list_devices. */
|
||||
/* Helper for VasEBoot_ls_list_devices. */
|
||||
static int
|
||||
grub_ls_print_devices (const char *name, void *data)
|
||||
VasEBoot_ls_print_devices (const char *name, void *data)
|
||||
{
|
||||
int *longlist = data;
|
||||
|
||||
if (*longlist)
|
||||
grub_normal_print_device_info (name);
|
||||
VasEBoot_normal_print_device_info (name);
|
||||
else
|
||||
grub_printf ("(%s) ", name);
|
||||
VasEBoot_printf ("(%s) ", name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_ls_list_devices (int longlist)
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_ls_list_devices (int longlist)
|
||||
{
|
||||
grub_device_iterate (grub_ls_print_devices, &longlist);
|
||||
grub_xputs ("\n");
|
||||
VasEBoot_device_iterate (VasEBoot_ls_print_devices, &longlist);
|
||||
VasEBoot_xputs ("\n");
|
||||
|
||||
#if 0
|
||||
{
|
||||
grub_net_app_level_t proto;
|
||||
VasEBoot_net_app_level_t proto;
|
||||
int first = 1;
|
||||
FOR_NET_APP_LEVEL (proto)
|
||||
{
|
||||
if (first)
|
||||
grub_puts_ (N_ ("Network protocols:"));
|
||||
VasEBoot_puts_ (N_ ("Network protocols:"));
|
||||
first = 0;
|
||||
grub_printf ("%s ", proto->name);
|
||||
VasEBoot_printf ("%s ", proto->name);
|
||||
}
|
||||
grub_xputs ("\n");
|
||||
VasEBoot_xputs ("\n");
|
||||
}
|
||||
#endif
|
||||
|
||||
grub_refresh ();
|
||||
VasEBoot_refresh ();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Context for grub_ls_list_files. */
|
||||
struct grub_ls_list_files_ctx
|
||||
/* Context for VasEBoot_ls_list_files. */
|
||||
struct VasEBoot_ls_list_files_ctx
|
||||
{
|
||||
char *dirname;
|
||||
int all;
|
||||
int human;
|
||||
};
|
||||
|
||||
/* Helper for grub_ls_list_files. */
|
||||
/* Helper for VasEBoot_ls_list_files. */
|
||||
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)
|
||||
{
|
||||
struct grub_ls_list_files_ctx *ctx = data;
|
||||
struct VasEBoot_ls_list_files_ctx *ctx = data;
|
||||
|
||||
if (ctx->all || filename[0] != '.')
|
||||
grub_printf ("%s%s ", filename, info->dir ? "/" : "");
|
||||
VasEBoot_printf ("%s%s ", filename, info->dir ? "/" : "");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Helper for grub_ls_list_files. */
|
||||
/* Helper for VasEBoot_ls_list_files. */
|
||||
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)
|
||||
{
|
||||
struct grub_ls_list_files_ctx *ctx = data;
|
||||
struct VasEBoot_ls_list_files_ctx *ctx = data;
|
||||
|
||||
if ((! ctx->all) && (filename[0] == '.'))
|
||||
return 0;
|
||||
|
||||
if (! info->dir)
|
||||
{
|
||||
grub_file_t file;
|
||||
VasEBoot_file_t file;
|
||||
char *pathname;
|
||||
|
||||
if (ctx->dirname[grub_strlen (ctx->dirname) - 1] == '/')
|
||||
pathname = grub_xasprintf ("%s%s", ctx->dirname, filename);
|
||||
if (ctx->dirname[VasEBoot_strlen (ctx->dirname) - 1] == '/')
|
||||
pathname = VasEBoot_xasprintf ("%s%s", ctx->dirname, filename);
|
||||
else
|
||||
pathname = grub_xasprintf ("%s/%s", ctx->dirname, filename);
|
||||
pathname = VasEBoot_xasprintf ("%s/%s", ctx->dirname, filename);
|
||||
|
||||
if (!pathname)
|
||||
return 1;
|
||||
|
||||
/* XXX: For ext2fs symlinks are detected as files while they
|
||||
should be reported as directories. */
|
||||
grub_file_filter_disable_compression ();
|
||||
file = grub_file_open (pathname);
|
||||
VasEBoot_file_filter_disable_compression ();
|
||||
file = VasEBoot_file_open (pathname);
|
||||
if (! file)
|
||||
{
|
||||
grub_errno = 0;
|
||||
grub_free (pathname);
|
||||
VasEBoot_errno = 0;
|
||||
VasEBoot_free (pathname);
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (! ctx->human)
|
||||
grub_printf ("%-12llu", (unsigned long long) file->size);
|
||||
VasEBoot_printf ("%-12llu", (unsigned long long) file->size);
|
||||
else
|
||||
grub_printf ("%-12s", grub_get_human_size (file->size,
|
||||
GRUB_HUMAN_SIZE_SHORT));
|
||||
grub_file_close (file);
|
||||
grub_free (pathname);
|
||||
VasEBoot_printf ("%-12s", VasEBoot_get_human_size (file->size,
|
||||
VasEBoot_HUMAN_SIZE_SHORT));
|
||||
VasEBoot_file_close (file);
|
||||
VasEBoot_free (pathname);
|
||||
}
|
||||
else
|
||||
grub_printf ("%-12s", _("DIR"));
|
||||
VasEBoot_printf ("%-12s", _("DIR"));
|
||||
|
||||
if (info->mtimeset)
|
||||
{
|
||||
struct grub_datetime datetime;
|
||||
grub_unixtime2datetime (info->mtime, &datetime);
|
||||
struct VasEBoot_datetime datetime;
|
||||
VasEBoot_unixtime2datetime (info->mtime, &datetime);
|
||||
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.hour, datetime.minute,
|
||||
datetime.second,
|
||||
grub_get_weekday_name (&datetime));
|
||||
VasEBoot_get_weekday_name (&datetime));
|
||||
else
|
||||
grub_printf (" %04d%02d%02d%02d%02d%02d ",
|
||||
VasEBoot_printf (" %04d%02d%02d%02d%02d%02d ",
|
||||
datetime.year, datetime.month,
|
||||
datetime.day, datetime.hour,
|
||||
datetime.minute, datetime.second);
|
||||
}
|
||||
grub_printf ("%s%s\n", filename, info->dir ? "/" : "");
|
||||
VasEBoot_printf ("%s%s\n", filename, info->dir ? "/" : "");
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_ls_list_files (char *dirname, int longlist, int all, int human)
|
||||
static VasEBoot_err_t
|
||||
VasEBoot_ls_list_files (char *dirname, int longlist, int all, int human)
|
||||
{
|
||||
char *device_name;
|
||||
grub_fs_t fs;
|
||||
VasEBoot_fs_t fs;
|
||||
const char *path;
|
||||
grub_device_t dev;
|
||||
VasEBoot_device_t dev;
|
||||
|
||||
device_name = grub_file_get_device_name (dirname);
|
||||
dev = grub_device_open (device_name);
|
||||
device_name = VasEBoot_file_get_device_name (dirname);
|
||||
dev = VasEBoot_device_open (device_name);
|
||||
if (! dev)
|
||||
goto fail;
|
||||
|
||||
fs = grub_fs_probe (dev);
|
||||
path = grub_strchr (dirname, ')');
|
||||
fs = VasEBoot_fs_probe (dev);
|
||||
path = VasEBoot_strchr (dirname, ')');
|
||||
if (! path)
|
||||
path = dirname;
|
||||
else
|
||||
|
|
@ -192,20 +192,20 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human)
|
|||
|
||||
if (! path && ! device_name)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_ARGUMENT, "invalid argument");
|
||||
VasEBoot_error (VasEBoot_ERR_BAD_ARGUMENT, "invalid argument");
|
||||
goto fail;
|
||||
}
|
||||
|
||||
if (! *path)
|
||||
{
|
||||
if (grub_errno == GRUB_ERR_UNKNOWN_FS)
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
if (VasEBoot_errno == VasEBoot_ERR_UNKNOWN_FS)
|
||||
VasEBoot_errno = VasEBoot_ERR_NONE;
|
||||
|
||||
grub_normal_print_device_info (device_name);
|
||||
VasEBoot_normal_print_device_info (device_name);
|
||||
}
|
||||
else if (fs)
|
||||
{
|
||||
struct grub_ls_list_files_ctx ctx = {
|
||||
struct VasEBoot_ls_list_files_ctx ctx = {
|
||||
.dirname = dirname,
|
||||
.all = all,
|
||||
.human = human
|
||||
|
|
@ -216,78 +216,78 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human)
|
|||
else
|
||||
(fs->dir) (dev, path, print_files, &ctx);
|
||||
|
||||
if (grub_errno == GRUB_ERR_BAD_FILE_TYPE
|
||||
&& path[grub_strlen (path) - 1] != '/')
|
||||
if (VasEBoot_errno == VasEBoot_ERR_BAD_FILE_TYPE
|
||||
&& path[VasEBoot_strlen (path) - 1] != '/')
|
||||
{
|
||||
/* PATH might be a regular file. */
|
||||
char *p;
|
||||
grub_file_t file;
|
||||
struct grub_dirhook_info info;
|
||||
grub_errno = 0;
|
||||
VasEBoot_file_t file;
|
||||
struct VasEBoot_dirhook_info info;
|
||||
VasEBoot_errno = 0;
|
||||
|
||||
grub_file_filter_disable_compression ();
|
||||
file = grub_file_open (dirname);
|
||||
VasEBoot_file_filter_disable_compression ();
|
||||
file = VasEBoot_file_open (dirname);
|
||||
if (! file)
|
||||
goto fail;
|
||||
|
||||
grub_file_close (file);
|
||||
VasEBoot_file_close (file);
|
||||
|
||||
p = grub_strrchr (dirname, '/') + 1;
|
||||
dirname = grub_strndup (dirname, p - dirname);
|
||||
p = VasEBoot_strrchr (dirname, '/') + 1;
|
||||
dirname = VasEBoot_strndup (dirname, p - dirname);
|
||||
if (! dirname)
|
||||
goto fail;
|
||||
|
||||
all = 1;
|
||||
grub_memset (&info, 0, sizeof (info));
|
||||
VasEBoot_memset (&info, 0, sizeof (info));
|
||||
if (longlist)
|
||||
print_files_long (p, &info, &ctx);
|
||||
else
|
||||
print_files (p, &info, &ctx);
|
||||
|
||||
grub_free (dirname);
|
||||
VasEBoot_free (dirname);
|
||||
}
|
||||
|
||||
if (grub_errno == GRUB_ERR_NONE)
|
||||
grub_xputs ("\n");
|
||||
if (VasEBoot_errno == VasEBoot_ERR_NONE)
|
||||
VasEBoot_xputs ("\n");
|
||||
|
||||
grub_refresh ();
|
||||
VasEBoot_refresh ();
|
||||
}
|
||||
|
||||
fail:
|
||||
if (dev)
|
||||
grub_device_close (dev);
|
||||
VasEBoot_device_close (dev);
|
||||
|
||||
grub_free (device_name);
|
||||
VasEBoot_free (device_name);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_ls (grub_extcmd_context_t ctxt, int argc, char **args)
|
||||
static VasEBoot_err_t
|
||||
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;
|
||||
|
||||
if (argc == 0)
|
||||
grub_ls_list_devices (state[0].set);
|
||||
VasEBoot_ls_list_devices (state[0].set);
|
||||
else
|
||||
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);
|
||||
|
||||
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_("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
Loading…
Reference in New Issue