merge mainline into backtrace
This commit is contained in:
commit
245f4582f9
871 changed files with 102908 additions and 16407 deletions
74
.bzrignore
74
.bzrignore
|
@ -4,6 +4,8 @@
|
||||||
30_os-prober
|
30_os-prober
|
||||||
40_custom
|
40_custom
|
||||||
41_custom
|
41_custom
|
||||||
|
*.1
|
||||||
|
*.8
|
||||||
aclocal.m4
|
aclocal.m4
|
||||||
ascii.bitmaps
|
ascii.bitmaps
|
||||||
ascii.h
|
ascii.h
|
||||||
|
@ -13,23 +15,27 @@ build_env.mk
|
||||||
config.cache
|
config.cache
|
||||||
config.guess
|
config.guess
|
||||||
config.h
|
config.h
|
||||||
config.h.in
|
config-util.h
|
||||||
|
config-util.h.in
|
||||||
config.log
|
config.log
|
||||||
config.status
|
config.status
|
||||||
config.sub
|
config.sub
|
||||||
configure
|
configure
|
||||||
*.d
|
|
||||||
DISTLIST
|
DISTLIST
|
||||||
docs/*.info
|
docs/*.info
|
||||||
docs/stamp-vti
|
docs/stamp-vti
|
||||||
docs/version.texi
|
docs/version.texi
|
||||||
*.elf
|
*.elf
|
||||||
|
example_grub_script_test
|
||||||
|
example_scripted_test
|
||||||
|
example_unit_test
|
||||||
*.exec
|
*.exec
|
||||||
genkernsyms.sh
|
genkernsyms.sh
|
||||||
gensymlist.sh
|
gensymlist.sh
|
||||||
gentrigtables
|
gentrigtables
|
||||||
grub-bin2h
|
grub-bin2h
|
||||||
grub-dumpbios
|
grub_cmd_echo
|
||||||
|
grub_cmd_regexp
|
||||||
grub-editenv
|
grub-editenv
|
||||||
grub-emu
|
grub-emu
|
||||||
grub_emu_init.c
|
grub_emu_init.c
|
||||||
|
@ -38,17 +44,38 @@ grub-fstest
|
||||||
grub_fstest_init.c
|
grub_fstest_init.c
|
||||||
grub_fstest_init.h
|
grub_fstest_init.h
|
||||||
grub-install
|
grub-install
|
||||||
|
grub-kbdcomp
|
||||||
grub-macho2img
|
grub-macho2img
|
||||||
|
grub-menulst2cfg
|
||||||
grub-mk*
|
grub-mk*
|
||||||
grub-pbkdf2
|
grub-mount
|
||||||
grub-pe2elf
|
grub-pe2elf
|
||||||
grub-probe
|
grub-probe
|
||||||
grub_probe_init.c
|
grub_probe_init.c
|
||||||
grub_probe_init.h
|
grub_probe_init.h
|
||||||
grub-reboot
|
grub-reboot
|
||||||
|
grub_script_blanklines
|
||||||
|
grub_script_blockarg
|
||||||
|
grub_script_break
|
||||||
grub-script-check
|
grub-script-check
|
||||||
grub_script_check_init.c
|
grub_script_check_init.c
|
||||||
grub_script_check_init.h
|
grub_script_check_init.h
|
||||||
|
grub_script_comments
|
||||||
|
grub_script_continue
|
||||||
|
grub_script_dollar
|
||||||
|
grub_script_echo1
|
||||||
|
grub_script_echo_keywords
|
||||||
|
grub_script_expansion
|
||||||
|
grub_script_final_semicolon
|
||||||
|
grub_script_for1
|
||||||
|
grub_script_functions
|
||||||
|
grub_script_if
|
||||||
|
grub_script_not
|
||||||
|
grub_script_return
|
||||||
|
grub_script_setparams
|
||||||
|
grub_script_shift
|
||||||
|
grub_script_vars1
|
||||||
|
grub_script_while1
|
||||||
grub_script.tab.c
|
grub_script.tab.c
|
||||||
grub_script.tab.h
|
grub_script.tab.h
|
||||||
grub_script.yy.c
|
grub_script.yy.c
|
||||||
|
@ -57,16 +84,22 @@ grub-set-default
|
||||||
grub-setup
|
grub-setup
|
||||||
grub_setup_init.c
|
grub_setup_init.c
|
||||||
grub_setup_init.h
|
grub_setup_init.h
|
||||||
|
grub-shell
|
||||||
|
grub-shell-tester
|
||||||
*.img
|
*.img
|
||||||
|
*.image
|
||||||
include/grub/cpu
|
include/grub/cpu
|
||||||
include/grub/machine
|
include/grub/machine
|
||||||
install-sh
|
install-sh
|
||||||
lib/libgcrypt-grub
|
lib/libgcrypt-grub
|
||||||
|
libgrub_a_init.c
|
||||||
*.lst
|
*.lst
|
||||||
|
*.marker
|
||||||
Makefile
|
Makefile
|
||||||
*.mod
|
*.mod
|
||||||
mod-*.c
|
mod-*.c
|
||||||
missing
|
missing
|
||||||
|
partmap_test
|
||||||
*.pf2
|
*.pf2
|
||||||
*.pp
|
*.pp
|
||||||
po/*.mo
|
po/*.mo
|
||||||
|
@ -75,6 +108,7 @@ stamp-h
|
||||||
stamp-h1
|
stamp-h1
|
||||||
stamp-h.in
|
stamp-h.in
|
||||||
symlist.c
|
symlist.c
|
||||||
|
symlist.h
|
||||||
trigtables.c
|
trigtables.c
|
||||||
update-grub_lib
|
update-grub_lib
|
||||||
unidata.c
|
unidata.c
|
||||||
|
@ -89,12 +123,42 @@ depcomp
|
||||||
mdate-sh
|
mdate-sh
|
||||||
texinfo.tex
|
texinfo.tex
|
||||||
grub-core/lib/libgcrypt-grub
|
grub-core/lib/libgcrypt-grub
|
||||||
|
**/.deps
|
||||||
**/.deps-util
|
**/.deps-util
|
||||||
**/.deps-core
|
**/.deps-core
|
||||||
**/.dirstamp
|
**/.dirstamp
|
||||||
Makefile.util.am
|
Makefile.util.am
|
||||||
|
contrib
|
||||||
grub-core/Makefile.core.am
|
grub-core/Makefile.core.am
|
||||||
grub-core/Makefile.gcry.am
|
|
||||||
grub-core/Makefile.gcry.def
|
grub-core/Makefile.gcry.def
|
||||||
|
grub-core/contrib
|
||||||
|
grub-core/genmod.sh
|
||||||
|
grub-core/gensyminfo.sh
|
||||||
|
grub-core/modinfo.sh
|
||||||
grub-core/*.module
|
grub-core/*.module
|
||||||
grub-core/*.pp
|
grub-core/*.pp
|
||||||
|
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/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.S
|
||||||
|
widthspec.bin
|
||||||
|
widthspec.h
|
||||||
|
docs/stamp-1
|
||||||
|
docs/version-dev.texi
|
||||||
|
Makefile.utilgcry.def
|
||||||
|
|
7
BUGS
Normal file
7
BUGS
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
GRUB 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.
|
||||||
|
|
||||||
|
While these are bugs their solution has a potential of breaking more and more
|
||||||
|
seriously. So it was decided for 1.99 that they aren't fixed.
|
36
Makefile.am
36
Makefile.am
|
@ -1,7 +1,7 @@
|
||||||
AUTOMAKE_OPTIONS = subdir-objects
|
AUTOMAKE_OPTIONS = subdir-objects -Wno-portability
|
||||||
|
|
||||||
DEPDIR = .deps-util
|
DEPDIR = .deps-util
|
||||||
SUBDIRS = . grub-core po docs util/bash-completion.d
|
SUBDIRS = grub-core/gnulib . grub-core po docs util/bash-completion.d
|
||||||
|
|
||||||
include $(top_srcdir)/conf/Makefile.common
|
include $(top_srcdir)/conf/Makefile.common
|
||||||
include $(top_srcdir)/conf/Makefile.extra-dist
|
include $(top_srcdir)/conf/Makefile.extra-dist
|
||||||
|
@ -11,6 +11,8 @@ AM_LDFLAGS = $(HOST_LDFLAGS)
|
||||||
AM_CPPFLAGS = $(HOST_CPPFLAGS) $(CPPFLAGS_DEFAULT)
|
AM_CPPFLAGS = $(HOST_CPPFLAGS) $(CPPFLAGS_DEFAULT)
|
||||||
AM_CCASFLAGS = $(HOST_CCASFLAGS) $(CCASFLAGS_DEFAULT)
|
AM_CCASFLAGS = $(HOST_CCASFLAGS) $(CCASFLAGS_DEFAULT)
|
||||||
|
|
||||||
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
|
|
||||||
CFLAGS_PROGRAM += $(CFLAGS_GNULIB)
|
CFLAGS_PROGRAM += $(CFLAGS_GNULIB)
|
||||||
LDFLAGS_PROGRAM += $(LDFLAGS_GNULIB)
|
LDFLAGS_PROGRAM += $(LDFLAGS_GNULIB)
|
||||||
CPPFLAGS_PROGRAM += $(CPPFLAGS_GNULIB)
|
CPPFLAGS_PROGRAM += $(CPPFLAGS_GNULIB)
|
||||||
|
@ -31,8 +33,8 @@ grub_script.yy.c: grub_script.yy.h
|
||||||
CLEANFILES += grub_script.yy.c grub_script.yy.h
|
CLEANFILES += grub_script.yy.c grub_script.yy.h
|
||||||
|
|
||||||
# For libgrub.a
|
# For libgrub.a
|
||||||
libgrub.pp: grub_script.tab.h grub_script.yy.h $(libgrub_a_SOURCES)
|
libgrub.pp: grub_script.tab.h grub_script.yy.h $(libgrubmods_a_SOURCES) $(libgrubkern_a_SOURCES)
|
||||||
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgrub_a_CPPFLAGS) $(CPPFLAGS) \
|
$(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(libgrubmods_a_CPPFLAGS) $(libgrubkern_a_CPPFLAGS) $(CPPFLAGS) \
|
||||||
-D'GRUB_MOD_INIT(x)=@MARKER@x@' $^ > $@ || (rm -f $@; exit 1)
|
-D'GRUB_MOD_INIT(x)=@MARKER@x@' $^ > $@ || (rm -f $@; exit 1)
|
||||||
CLEANFILES += libgrub.pp
|
CLEANFILES += libgrub.pp
|
||||||
|
|
||||||
|
@ -145,28 +147,28 @@ linux.init.i386: $(srcdir)/grub-core/tests/boot/linux.init-i386.S
|
||||||
$(TARGET_CC) -o $@ $< -m32 -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\"
|
$(TARGET_CC) -o $@ $< -m32 -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\"
|
||||||
|
|
||||||
multiboot.elf: $(srcdir)/grub-core/tests/boot/kernel-i386.S
|
multiboot.elf: $(srcdir)/grub-core/tests/boot/kernel-i386.S
|
||||||
$(TARGET_CC) -o $@ $< -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -ffreestanding -nostdlib -nostdinc -DTARGET_MULTIBOOT=1 -Wl,-N -Wl,-Ttext,0x100000 -m32 -I$(srcdir)/include
|
$(TARGET_CC) -o $@ $< -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -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
|
kfreebsd.elf: $(srcdir)/grub-core/tests/boot/kernel-i386.S
|
||||||
$(TARGET_CC) -o $@ $< -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -ffreestanding -nostdlib -nostdinc -Wl,-N -Wl,-Ttext,0x100000 -m32 -I$(srcdir)/include
|
$(TARGET_CC) -o $@ $< -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -ffreestanding -nostdlib -nostdinc -Wl,--build-id=none -Wl,-N -Wl,-Ttext,0x100000 -m32 -I$(srcdir)/include
|
||||||
|
|
||||||
kfreebsd.aout: kfreebsd.elf
|
kfreebsd.aout: kfreebsd.elf
|
||||||
$(OBJCOPY) -O a.out-i386-linux $< $@ -R .note.gnu.build-id
|
$(OBJCOPY) -O a.out-i386-linux $< $@ -R .note.gnu.build-id
|
||||||
|
|
||||||
pc-chainloader.elf: $(srcdir)/grub-core/tests/boot/kernel-8086.S
|
pc-chainloader.elf: $(srcdir)/grub-core/tests/boot/kernel-8086.S
|
||||||
$(TARGET_CC) -o $@ $< -DTARGET_CHAINLOADER=1 -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -ffreestanding -nostdlib -nostdinc -Wl,-N -Wl,-Ttext,0x7c00 -m32
|
$(TARGET_CC) -o $@ $< -DTARGET_CHAINLOADER=1 -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -ffreestanding -nostdlib -nostdinc -Wl,--build-id=none -Wl,-N -Wl,-Ttext,0x7c00 -m32
|
||||||
|
|
||||||
pc-chainloader.bin: pc-chainloader.elf
|
pc-chainloader.bin: pc-chainloader.elf
|
||||||
$(OBJCOPY) -O binary --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn $< $@;
|
$(OBJCOPY) -O binary --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn $< $@;
|
||||||
|
|
||||||
ntldr.elf: $(srcdir)/grub-core/tests/boot/kernel-8086.S
|
ntldr.elf: $(srcdir)/grub-core/tests/boot/kernel-8086.S
|
||||||
$(TARGET_CC) -o $@ $< -DTARGET_NTLDR=1 -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -ffreestanding -nostdlib -nostdinc -Wl,-N -Wl,-Ttext,0 -m32
|
$(TARGET_CC) -o $@ $< -DTARGET_NTLDR=1 -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -ffreestanding -nostdlib -nostdinc -Wl,--build-id=none -Wl,-N -Wl,-Ttext,0 -m32
|
||||||
|
|
||||||
ntldr.bin: ntldr.elf
|
ntldr.bin: ntldr.elf
|
||||||
$(OBJCOPY) -O binary --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn $< $@;
|
$(OBJCOPY) -O binary --strip-unneeded -R .note -R .comment -R .note.gnu.build-id -R .reginfo -R .rel.dyn $< $@;
|
||||||
|
|
||||||
multiboot2.elf: $(srcdir)/grub-core/tests/boot/kernel-i386.S
|
multiboot2.elf: $(srcdir)/grub-core/tests/boot/kernel-i386.S
|
||||||
$(TARGET_CC) -o $@ $< -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" -ffreestanding -nostdlib -nostdinc -Wl,-N -Wl,-Ttext,0x100000 -m32 -I$(srcdir)/include -DTARGET_MULTIBOOT2=1
|
$(TARGET_CC) -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
|
kfreebsd.init.x86_64: $(srcdir)/grub-core/tests/boot/kfreebsd.init-x86_64.S
|
||||||
$(TARGET_CC) -o $@ $< -m64 -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" && freebsd-brandelf -t FreeBSD $@
|
$(TARGET_CC) -o $@ $< -m64 -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\" && freebsd-brandelf -t FreeBSD $@
|
||||||
|
@ -187,31 +189,31 @@ kopenbsd.init.x86_64: $(srcdir)/grub-core/tests/boot/kbsd.init-x86_64.S
|
||||||
$(TARGET_CC) -o $@ $< -m64 -DTARGET_OPENBSD=1 -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\"
|
$(TARGET_CC) -o $@ $< -m64 -DTARGET_OPENBSD=1 -nostdlib -nostdinc -DSUCCESSFUL_BOOT_STRING=\"$(SUCCESSFUL_BOOT_STRING)\"
|
||||||
|
|
||||||
linux-initramfs.i386: linux.init.i386 Makefile
|
linux-initramfs.i386: linux.init.i386 Makefile
|
||||||
TDIR=`mktemp -d`; cp $< $$TDIR/init; (cd $$TDIR; echo ./init | cpio --quiet --dereference -o -H newc) | gzip > $@; rm -rf $$TDIR
|
TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && cp $< $$TDIR/init && (cd $$TDIR && echo ./init | cpio --quiet --dereference -o -H newc) | gzip > $@ && rm -rf $$TDIR
|
||||||
|
|
||||||
linux-initramfs.x86_64: linux.init.x86_64 Makefile
|
linux-initramfs.x86_64: linux.init.x86_64 Makefile
|
||||||
TDIR=`mktemp -d`; cp $< $$TDIR/init; (cd $$TDIR; echo ./init | cpio --quiet --dereference -o -H newc) | gzip > $@; rm -rf $$TDIR
|
TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && cp $< $$TDIR/init && (cd $$TDIR && echo ./init | cpio --quiet --dereference -o -H newc) | gzip > $@ && rm -rf $$TDIR
|
||||||
|
|
||||||
kfreebsd-mfsroot.i386.img: kfreebsd.init.i386 Makefile
|
kfreebsd-mfsroot.i386.img: kfreebsd.init.i386 Makefile
|
||||||
TDIR=`mktemp -d`; mkdir $$TDIR/dev; mkdir $$TDIR/sbin; cp $< $$TDIR/sbin/init; makefs -t ffs -s 30m -f 1000 -o minfree=0,version=1 $@ $$TDIR; rm -rf $$TDIR
|
TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -t ffs -s 30m -f 1000 -o minfree=0,version=1 $@ $$TDIR && rm -rf $$TDIR
|
||||||
|
|
||||||
knetbsd.image.i386: knetbsd.init.i386 $(srcdir)/grub-core/tests/boot/kbsd.spec.txt
|
knetbsd.image.i386: knetbsd.init.i386 $(srcdir)/grub-core/tests/boot/kbsd.spec.txt
|
||||||
TDIR=`mktemp -d` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -F $(srcdir)/grub-core/tests/boot/kbsd.spec.txt -t ffs -s 64k -f 10 -o minfree=0,version=1 $@ $$TDIR && rm -rf $$TDIR
|
TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -F $(srcdir)/grub-core/tests/boot/kbsd.spec.txt -t ffs -s 64k -f 10 -o minfree=0,version=1 $@ $$TDIR && rm -rf $$TDIR
|
||||||
|
|
||||||
kopenbsd.image.i386: kopenbsd.init.i386 $(srcdir)/grub-core/tests/boot/kopenbsdlabel.txt
|
kopenbsd.image.i386: kopenbsd.init.i386 $(srcdir)/grub-core/tests/boot/kopenbsdlabel.txt
|
||||||
TDIR=`mktemp -d` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -F $(srcdir)/grub-core/tests/boot/kbsd.spec.txt -t ffs -s 128k -f 10 -o minfree=0,version=1 $@ $$TDIR && bsdlabel -f -R $@ $(srcdir)/grub-core/tests/boot/kopenbsdlabel.txt && rm -rf $$TDIR || rm -f $@
|
TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -F $(srcdir)/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)/grub-core/tests/boot/kopenbsdlabel.txt
|
kopenbsd.image.x86_64: kopenbsd.init.x86_64 $(srcdir)/grub-core/tests/boot/kopenbsdlabel.txt
|
||||||
TDIR=`mktemp -d` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -F $(srcdir)/grub-core/tests/boot/kbsd.spec.txt -t ffs -s 128k -f 10 -o minfree=0,version=1 $@ $$TDIR && bsdlabel -f -R $@ $(srcdir)/grub-core/tests/boot/kopenbsdlabel.txt && rm -rf $$TDIR || rm -f $@
|
TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -F $(srcdir)/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 $@
|
||||||
|
|
||||||
knetbsd.miniroot-image.i386.img: knetbsd.image.i386 $(GRUB_PAYLOADS_DIR)/knetbsd.miniroot.i386
|
knetbsd.miniroot-image.i386.img: knetbsd.image.i386 $(GRUB_PAYLOADS_DIR)/knetbsd.miniroot.i386
|
||||||
$(OBJCOPY) --add-section=miniroot=$< $(GRUB_PAYLOADS_DIR)/knetbsd.miniroot.i386 $@
|
$(OBJCOPY) --add-section=miniroot=$< $(GRUB_PAYLOADS_DIR)/knetbsd.miniroot.i386 $@
|
||||||
|
|
||||||
kfreebsd-mfsroot.x86_64.img: kfreebsd.init.x86_64 Makefile
|
kfreebsd-mfsroot.x86_64.img: kfreebsd.init.x86_64 Makefile
|
||||||
TDIR=`mktemp -d`; mkdir $$TDIR/dev; mkdir $$TDIR/sbin; cp $< $$TDIR/sbin/init; makefs -t ffs -s 30m -f 1000 -o minfree=0,version=1 $@ $$TDIR; rm -rf $$TDIR
|
TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -t ffs -s 30m -f 1000 -o minfree=0,version=1 $@ $$TDIR && rm -rf $$TDIR
|
||||||
|
|
||||||
knetbsd.image.x86_64: knetbsd.init.x86_64 $(srcdir)/grub-core/tests/boot/kbsd.spec.txt
|
knetbsd.image.x86_64: knetbsd.init.x86_64 $(srcdir)/grub-core/tests/boot/kbsd.spec.txt
|
||||||
TDIR=`mktemp -d` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -F $(srcdir)/grub-core/tests/boot/kbsd.spec.txt -t ffs -s 64k -f 10 -o minfree=0,version=1 $@ $$TDIR && rm -rf $$TDIR
|
TDIR=`mktemp -d "$${TMPDIR:-/tmp}/tmp.XXXXXXXXXX"` && mkdir $$TDIR/dev && mkdir $$TDIR/sbin && cp $< $$TDIR/sbin/init && makefs -F $(srcdir)/grub-core/tests/boot/kbsd.spec.txt -t ffs -s 64k -f 10 -o minfree=0,version=1 $@ $$TDIR && rm -rf $$TDIR
|
||||||
|
|
||||||
knetbsd.miniroot-image.x86_64.img: knetbsd.image.x86_64 $(GRUB_PAYLOADS_DIR)/knetbsd.miniroot.x86_64
|
knetbsd.miniroot-image.x86_64.img: knetbsd.image.x86_64 $(GRUB_PAYLOADS_DIR)/knetbsd.miniroot.x86_64
|
||||||
$(OBJCOPY) --add-section=miniroot=$< $(GRUB_PAYLOADS_DIR)/knetbsd.miniroot.x86_64 $@
|
$(OBJCOPY) --add-section=miniroot=$< $(GRUB_PAYLOADS_DIR)/knetbsd.miniroot.x86_64 $@
|
||||||
|
|
|
@ -1,9 +1,40 @@
|
||||||
AutoGen definitions Makefile.tpl;
|
AutoGen definitions Makefile.tpl;
|
||||||
|
|
||||||
library = {
|
library = {
|
||||||
name = libgrub.a;
|
name = libgrubkern.a;
|
||||||
cflags = '$(CFLAGS_GCRY)';
|
cflags = '$(CFLAGS_GNULIB)';
|
||||||
cppflags = '$(CPPFLAGS_GCRY)';
|
cppflags = '$(CPPFLAGS_GNULIB)';
|
||||||
|
|
||||||
|
common = util/misc.c;
|
||||||
|
common = grub-core/kern/command.c;
|
||||||
|
common = grub-core/kern/device.c;
|
||||||
|
common = grub-core/kern/disk.c;
|
||||||
|
common = util/getroot.c;
|
||||||
|
common = util/raid.c;
|
||||||
|
common = grub-core/kern/emu/hostdisk.c;
|
||||||
|
common = grub-core/kern/emu/misc.c;
|
||||||
|
common = grub-core/kern/emu/mm.c;
|
||||||
|
common = grub-core/kern/env.c;
|
||||||
|
common = grub-core/kern/err.c;
|
||||||
|
common = grub-core/kern/file.c;
|
||||||
|
common = grub-core/kern/fs.c;
|
||||||
|
common = grub-core/kern/list.c;
|
||||||
|
common = grub-core/kern/misc.c;
|
||||||
|
common = grub-core/kern/partition.c;
|
||||||
|
common = grub-core/lib/crypto.c;
|
||||||
|
common = grub-core/disk/luks.c;
|
||||||
|
common = grub-core/disk/geli.c;
|
||||||
|
common = grub-core/disk/cryptodisk.c;
|
||||||
|
common = grub-core/disk/AFSplitter.c;
|
||||||
|
common = grub-core/lib/pbkdf2.c;
|
||||||
|
common = grub-core/commands/extcmd.c;
|
||||||
|
common = grub-core/lib/arg.c;
|
||||||
|
};
|
||||||
|
|
||||||
|
library = {
|
||||||
|
name = libgrubmods.a;
|
||||||
|
cflags = '$(CFLAGS_POSIX) -Wno-undef';
|
||||||
|
cppflags = '-I$(srcdir)/lib/posix_wrap -I$(top_srcdir)/grub-core/lib/minilzo -DMINILZO_HAVE_CONFIG_H';
|
||||||
|
|
||||||
common_nodist = grub_script.tab.c;
|
common_nodist = grub_script.tab.c;
|
||||||
common_nodist = grub_script.yy.c;
|
common_nodist = grub_script.yy.c;
|
||||||
|
@ -11,40 +42,26 @@ library = {
|
||||||
common_nodist = grub_script.yy.h;
|
common_nodist = grub_script.yy.h;
|
||||||
common_nodist = grub_script.tab.h;
|
common_nodist = grub_script.tab.h;
|
||||||
|
|
||||||
common = grub-core/gnulib/error.c;
|
|
||||||
common = grub-core/gnulib/fnmatch.c;
|
|
||||||
common = grub-core/gnulib/getdelim.c;
|
|
||||||
common = grub-core/gnulib/getline.c;
|
|
||||||
common = grub-core/gnulib/getopt1.c;
|
|
||||||
common = grub-core/gnulib/getopt.c;
|
|
||||||
common = grub-core/gnulib/progname.c;
|
|
||||||
|
|
||||||
common = util/misc.c;
|
|
||||||
common = grub-core/kern/misc.c;
|
|
||||||
common = grub-core/kern/emu/mm.c;
|
|
||||||
common = grub-core/kern/emu/misc.c;
|
|
||||||
common = grub-core/kern/emu/getroot.c;
|
|
||||||
common = grub-core/kern/emu/hostdisk.c;
|
|
||||||
|
|
||||||
common = grub-core/commands/blocklist.c;
|
common = grub-core/commands/blocklist.c;
|
||||||
common = grub-core/commands/extcmd.c;
|
common = grub-core/commands/xnu_uuid.c;
|
||||||
|
common = grub-core/commands/testload.c;
|
||||||
common = grub-core/commands/ls.c;
|
common = grub-core/commands/ls.c;
|
||||||
common = grub-core/disk/dmraid_nvidia.c;
|
common = grub-core/disk/dmraid_nvidia.c;
|
||||||
common = grub-core/disk/loopback.c;
|
common = grub-core/disk/loopback.c;
|
||||||
common = grub-core/disk/lvm.c;
|
common = grub-core/disk/lvm.c;
|
||||||
common = grub-core/disk/mdraid_linux.c;
|
common = grub-core/disk/mdraid_linux.c;
|
||||||
|
common = grub-core/disk/mdraid1x_linux.c;
|
||||||
common = grub-core/disk/raid5_recover.c;
|
common = grub-core/disk/raid5_recover.c;
|
||||||
common = grub-core/disk/raid6_recover.c;
|
common = grub-core/disk/raid6_recover.c;
|
||||||
common = grub-core/disk/raid.c;
|
common = grub-core/disk/raid.c;
|
||||||
common = grub-core/fs/affs.c;
|
common = grub-core/fs/affs.c;
|
||||||
common = grub-core/fs/afs_be.c;
|
|
||||||
common = grub-core/fs/afs.c;
|
common = grub-core/fs/afs.c;
|
||||||
common = grub-core/fs/befs_be.c;
|
common = grub-core/fs/bfs.c;
|
||||||
common = grub-core/fs/befs.c;
|
|
||||||
common = grub-core/fs/btrfs.c;
|
common = grub-core/fs/btrfs.c;
|
||||||
common = grub-core/fs/cpio.c;
|
common = grub-core/fs/cpio.c;
|
||||||
common = grub-core/fs/ext2.c;
|
common = grub-core/fs/ext2.c;
|
||||||
common = grub-core/fs/fat.c;
|
common = grub-core/fs/fat.c;
|
||||||
|
common = grub-core/fs/exfat.c;
|
||||||
common = grub-core/fs/fshelp.c;
|
common = grub-core/fs/fshelp.c;
|
||||||
common = grub-core/fs/hfs.c;
|
common = grub-core/fs/hfs.c;
|
||||||
common = grub-core/fs/hfsplus.c;
|
common = grub-core/fs/hfsplus.c;
|
||||||
|
@ -52,34 +69,32 @@ library = {
|
||||||
common = grub-core/fs/jfs.c;
|
common = grub-core/fs/jfs.c;
|
||||||
common = grub-core/fs/minix.c;
|
common = grub-core/fs/minix.c;
|
||||||
common = grub-core/fs/minix2.c;
|
common = grub-core/fs/minix2.c;
|
||||||
|
common = grub-core/fs/minix3.c;
|
||||||
common = grub-core/fs/nilfs2.c;
|
common = grub-core/fs/nilfs2.c;
|
||||||
common = grub-core/fs/ntfs.c;
|
common = grub-core/fs/ntfs.c;
|
||||||
common = grub-core/fs/ntfscomp.c;
|
common = grub-core/fs/ntfscomp.c;
|
||||||
common = grub-core/fs/reiserfs.c;
|
common = grub-core/fs/reiserfs.c;
|
||||||
|
common = grub-core/fs/romfs.c;
|
||||||
common = grub-core/fs/sfs.c;
|
common = grub-core/fs/sfs.c;
|
||||||
|
common = grub-core/fs/squash4.c;
|
||||||
common = grub-core/fs/tar.c;
|
common = grub-core/fs/tar.c;
|
||||||
common = grub-core/fs/udf.c;
|
common = grub-core/fs/udf.c;
|
||||||
common = grub-core/fs/ufs2.c;
|
common = grub-core/fs/ufs2.c;
|
||||||
common = grub-core/fs/ufs.c;
|
common = grub-core/fs/ufs.c;
|
||||||
common = grub-core/fs/xfs.c;
|
common = grub-core/fs/xfs.c;
|
||||||
common = grub-core/kern/command.c;
|
common = grub-core/fs/zfs/zfscrypt.c;
|
||||||
common = grub-core/kern/device.c;
|
common = grub-core/fs/zfs/zfs.c;
|
||||||
common = grub-core/kern/disk.c;
|
common = grub-core/fs/zfs/zfsinfo.c;
|
||||||
common = grub-core/kern/env.c;
|
common = grub-core/fs/zfs/zfs_lzjb.c;
|
||||||
common = grub-core/kern/err.c;
|
common = grub-core/fs/zfs/zfs_sha256.c;
|
||||||
common = grub-core/kern/file.c;
|
common = grub-core/fs/zfs/zfs_fletcher.c;
|
||||||
common = grub-core/kern/fs.c;
|
|
||||||
common = grub-core/kern/list.c;
|
|
||||||
common = grub-core/kern/partition.c;
|
|
||||||
common = grub-core/lib/arg.c;
|
|
||||||
common = grub-core/lib/crc.c;
|
|
||||||
common = grub-core/lib/crypto.c;
|
|
||||||
common = grub-core/lib/envblk.c;
|
common = grub-core/lib/envblk.c;
|
||||||
common = grub-core/lib/hexdump.c;
|
common = grub-core/lib/hexdump.c;
|
||||||
common = grub-core/lib/libgcrypt-grub/cipher/sha512.c;
|
|
||||||
common = grub-core/lib/LzFind.c;
|
common = grub-core/lib/LzFind.c;
|
||||||
common = grub-core/lib/LzmaEnc.c;
|
common = grub-core/lib/LzmaEnc.c;
|
||||||
common = grub-core/lib/pbkdf2.c;
|
common = grub-core/lib/crc.c;
|
||||||
|
common = grub-core/lib/adler32.c;
|
||||||
|
common = grub-core/lib/crc64.c;
|
||||||
common = grub-core/normal/datetime.c;
|
common = grub-core/normal/datetime.c;
|
||||||
common = grub-core/normal/misc.c;
|
common = grub-core/normal/misc.c;
|
||||||
common = grub-core/partmap/acorn.c;
|
common = grub-core/partmap/acorn.c;
|
||||||
|
@ -88,20 +103,30 @@ library = {
|
||||||
common = grub-core/partmap/gpt.c;
|
common = grub-core/partmap/gpt.c;
|
||||||
common = grub-core/partmap/msdos.c;
|
common = grub-core/partmap/msdos.c;
|
||||||
common = grub-core/partmap/sun.c;
|
common = grub-core/partmap/sun.c;
|
||||||
|
common = grub-core/partmap/plan.c;
|
||||||
|
common = grub-core/partmap/dvh.c;
|
||||||
common = grub-core/partmap/sunpc.c;
|
common = grub-core/partmap/sunpc.c;
|
||||||
|
common = grub-core/partmap/bsdlabel.c;
|
||||||
common = grub-core/script/function.c;
|
common = grub-core/script/function.c;
|
||||||
common = grub-core/script/lexer.c;
|
common = grub-core/script/lexer.c;
|
||||||
common = grub-core/script/main.c;
|
common = grub-core/script/main.c;
|
||||||
common = grub-core/script/script.c;
|
common = grub-core/script/script.c;
|
||||||
common = grub-core/script/argv.c;
|
common = grub-core/script/argv.c;
|
||||||
|
common = grub-core/io/gzio.c;
|
||||||
|
common = grub-core/io/lzopio.c;
|
||||||
|
common = grub-core/kern/ia64/dl_helper.c;
|
||||||
|
common = grub-core/lib/minilzo/minilzo.c;
|
||||||
};
|
};
|
||||||
|
|
||||||
program = {
|
program = {
|
||||||
name = grub-bin2h;
|
name = grub-bin2h;
|
||||||
common = util/bin2h.c;
|
common = util/bin2h.c;
|
||||||
ldadd = libgrub.a;
|
ldadd = libgrubmods.a;
|
||||||
|
ldadd = libgrubgcry.a;
|
||||||
|
ldadd = libgrubkern.a;
|
||||||
|
ldadd = grub-core/gnulib/libgnu.a;
|
||||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER)';
|
ldadd = '$(LIBINTL) $(LIBDEVMAPPER)';
|
||||||
mansection = 1;
|
installdir = noinst;
|
||||||
};
|
};
|
||||||
|
|
||||||
program = {
|
program = {
|
||||||
|
@ -112,8 +137,12 @@ program = {
|
||||||
common = util/resolve.c;
|
common = util/resolve.c;
|
||||||
extra_dist = util/grub-mkimagexx.c;
|
extra_dist = util/grub-mkimagexx.c;
|
||||||
|
|
||||||
ldadd = libgrub.a;
|
ldadd = libgrubmods.a;
|
||||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER)';
|
ldadd = libgrubgcry.a;
|
||||||
|
ldadd = libgrubkern.a;
|
||||||
|
ldadd = grub-core/gnulib/libgnu.a;
|
||||||
|
ldadd = '$(LIBLZMA)';
|
||||||
|
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||||
cppflags = '-DGRUB_PKGLIBROOTDIR=\"$(pkglibrootdir)\"';
|
cppflags = '-DGRUB_PKGLIBROOTDIR=\"$(pkglibrootdir)\"';
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -123,8 +152,11 @@ program = {
|
||||||
|
|
||||||
common = util/grub-mkrelpath.c;
|
common = util/grub-mkrelpath.c;
|
||||||
|
|
||||||
ldadd = libgrub.a;
|
ldadd = libgrubmods.a;
|
||||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER)';
|
ldadd = libgrubgcry.a;
|
||||||
|
ldadd = libgrubkern.a;
|
||||||
|
ldadd = grub-core/gnulib/libgnu.a;
|
||||||
|
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||||
};
|
};
|
||||||
|
|
||||||
program = {
|
program = {
|
||||||
|
@ -133,8 +165,11 @@ program = {
|
||||||
|
|
||||||
common = util/grub-script-check.c;
|
common = util/grub-script-check.c;
|
||||||
|
|
||||||
ldadd = libgrub.a;
|
ldadd = libgrubmods.a;
|
||||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER)';
|
ldadd = libgrubgcry.a;
|
||||||
|
ldadd = libgrubkern.a;
|
||||||
|
ldadd = grub-core/gnulib/libgnu.a;
|
||||||
|
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||||
};
|
};
|
||||||
|
|
||||||
program = {
|
program = {
|
||||||
|
@ -143,8 +178,11 @@ program = {
|
||||||
|
|
||||||
common = util/grub-editenv.c;
|
common = util/grub-editenv.c;
|
||||||
|
|
||||||
ldadd = libgrub.a;
|
ldadd = libgrubmods.a;
|
||||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER)';
|
ldadd = libgrubgcry.a;
|
||||||
|
ldadd = libgrubkern.a;
|
||||||
|
ldadd = grub-core/gnulib/libgnu.a;
|
||||||
|
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||||
};
|
};
|
||||||
|
|
||||||
program = {
|
program = {
|
||||||
|
@ -153,8 +191,11 @@ program = {
|
||||||
|
|
||||||
common = util/grub-mkpasswd-pbkdf2.c;
|
common = util/grub-mkpasswd-pbkdf2.c;
|
||||||
|
|
||||||
ldadd = libgrub.a;
|
ldadd = libgrubmods.a;
|
||||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER)';
|
ldadd = libgrubgcry.a;
|
||||||
|
ldadd = libgrubkern.a;
|
||||||
|
ldadd = grub-core/gnulib/libgnu.a;
|
||||||
|
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||||
cflags = '$(CFLAGS_GCRY)';
|
cflags = '$(CFLAGS_GCRY)';
|
||||||
cppflags = '$(CPPFLAGS_GCRY)';
|
cppflags = '$(CPPFLAGS_GCRY)';
|
||||||
};
|
};
|
||||||
|
@ -171,7 +212,10 @@ program = {
|
||||||
mansection = 1;
|
mansection = 1;
|
||||||
common = util/grub-pe2elf.c;
|
common = util/grub-pe2elf.c;
|
||||||
|
|
||||||
ldadd = libgrub.a;
|
ldadd = libgrubmods.a;
|
||||||
|
ldadd = libgrubgcry.a;
|
||||||
|
ldadd = libgrubkern.a;
|
||||||
|
ldadd = grub-core/gnulib/libgnu.a;
|
||||||
ldadd = '$(LIBINTL)';
|
ldadd = '$(LIBINTL)';
|
||||||
condition = COND_GRUB_PE2ELF;
|
condition = COND_GRUB_PE2ELF;
|
||||||
};
|
};
|
||||||
|
@ -184,8 +228,30 @@ program = {
|
||||||
common = grub-core/kern/emu/hostfs.c;
|
common = grub-core/kern/emu/hostfs.c;
|
||||||
common = grub-core/disk/host.c;
|
common = grub-core/disk/host.c;
|
||||||
|
|
||||||
ldadd = libgrub.a;
|
cflags = '$(CFLAGS_GCRY)';
|
||||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER)';
|
cppflags = '$(CPPFLAGS_GCRY)';
|
||||||
|
|
||||||
|
ldadd = libgrubmods.a;
|
||||||
|
ldadd = libgrubgcry.a;
|
||||||
|
ldadd = libgrubkern.a;
|
||||||
|
ldadd = grub-core/gnulib/libgnu.a;
|
||||||
|
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||||
|
};
|
||||||
|
|
||||||
|
program = {
|
||||||
|
name = grub-mount;
|
||||||
|
mansection = 1;
|
||||||
|
common_nodist = grub_fstest_init.c;
|
||||||
|
common = util/grub-mount.c;
|
||||||
|
common = grub-core/kern/emu/hostfs.c;
|
||||||
|
common = grub-core/disk/host.c;
|
||||||
|
|
||||||
|
ldadd = libgrubmods.a;
|
||||||
|
ldadd = libgrubgcry.a;
|
||||||
|
ldadd = libgrubkern.a;
|
||||||
|
ldadd = grub-core/gnulib/libgnu.a;
|
||||||
|
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) -lfuse';
|
||||||
|
condition = COND_GRUB_MOUNT;
|
||||||
};
|
};
|
||||||
|
|
||||||
program = {
|
program = {
|
||||||
|
@ -196,9 +262,12 @@ program = {
|
||||||
|
|
||||||
cflags = '$(freetype_cflags)';
|
cflags = '$(freetype_cflags)';
|
||||||
|
|
||||||
ldadd = libgrub.a;
|
ldadd = libgrubmods.a;
|
||||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER)';
|
ldadd = libgrubgcry.a;
|
||||||
|
ldadd = libgrubkern.a;
|
||||||
|
ldadd = grub-core/gnulib/libgnu.a;
|
||||||
ldadd = '$(freetype_libs)';
|
ldadd = '$(freetype_libs)';
|
||||||
|
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||||
condition = COND_GRUB_MKFONT;
|
condition = COND_GRUB_MKFONT;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -214,8 +283,11 @@ program = {
|
||||||
sparc64_ieee1275 = util/ieee1275/ofpath.c;
|
sparc64_ieee1275 = util/ieee1275/ofpath.c;
|
||||||
sparc64_ieee1275 = util/ieee1275/devicemap.c;
|
sparc64_ieee1275 = util/ieee1275/devicemap.c;
|
||||||
|
|
||||||
ldadd = libgrub.a;
|
ldadd = libgrubmods.a;
|
||||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL)';
|
ldadd = libgrubgcry.a;
|
||||||
|
ldadd = libgrubkern.a;
|
||||||
|
ldadd = grub-core/gnulib/libgnu.a;
|
||||||
|
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||||
};
|
};
|
||||||
|
|
||||||
program = {
|
program = {
|
||||||
|
@ -224,8 +296,11 @@ program = {
|
||||||
mansection = 8;
|
mansection = 8;
|
||||||
common = util/grub-probe.c;
|
common = util/grub-probe.c;
|
||||||
|
|
||||||
ldadd = libgrub.a;
|
ldadd = libgrubmods.a;
|
||||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL)';
|
ldadd = libgrubgcry.a;
|
||||||
|
ldadd = libgrubkern.a;
|
||||||
|
ldadd = grub-core/gnulib/libgnu.a;
|
||||||
|
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||||
};
|
};
|
||||||
|
|
||||||
program = {
|
program = {
|
||||||
|
@ -233,13 +308,16 @@ program = {
|
||||||
installdir = sbin;
|
installdir = sbin;
|
||||||
mansection = 8;
|
mansection = 8;
|
||||||
common = util/grub-setup.c;
|
common = util/grub-setup.c;
|
||||||
common = util/raid.c;
|
|
||||||
common = util/lvm.c;
|
common = util/lvm.c;
|
||||||
|
common = grub-core/lib/reed_solomon.c;
|
||||||
|
|
||||||
sparc64_ieee1275 = util/ieee1275/ofpath.c;
|
sparc64_ieee1275 = util/ieee1275/ofpath.c;
|
||||||
|
|
||||||
ldadd = libgrub.a;
|
ldadd = libgrubmods.a;
|
||||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL)';
|
ldadd = libgrubkern.a;
|
||||||
|
ldadd = libgrubgcry.a;
|
||||||
|
ldadd = grub-core/gnulib/libgnu.a;
|
||||||
|
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||||
|
|
||||||
enable = i386_pc;
|
enable = i386_pc;
|
||||||
enable = sparc64_ieee1275;
|
enable = sparc64_ieee1275;
|
||||||
|
@ -248,14 +326,32 @@ program = {
|
||||||
program = {
|
program = {
|
||||||
name = grub-ofpathname;
|
name = grub-ofpathname;
|
||||||
installdir = sbin;
|
installdir = sbin;
|
||||||
|
mansection = 8;
|
||||||
ieee1275 = util/ieee1275/grub-ofpathname.c;
|
ieee1275 = util/ieee1275/grub-ofpathname.c;
|
||||||
ieee1275 = util/ieee1275/ofpath.c;
|
ieee1275 = util/ieee1275/ofpath.c;
|
||||||
|
|
||||||
ldadd = libgrub.a;
|
ldadd = libgrubmods.a;
|
||||||
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL)';
|
ldadd = libgrubgcry.a;
|
||||||
|
ldadd = libgrubkern.a;
|
||||||
|
ldadd = grub-core/gnulib/libgnu.a;
|
||||||
|
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBUTIL) $(LIBGEOM)';
|
||||||
|
|
||||||
enable = sparc64_ieee1275;
|
enable = sparc64_ieee1275;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
program = {
|
||||||
|
name = grub-mklayout;
|
||||||
|
mansection = 1;
|
||||||
|
|
||||||
|
common = util/grub-mklayout.c;
|
||||||
|
|
||||||
|
ldadd = libgrubmods.a;
|
||||||
|
ldadd = libgrubgcry.a;
|
||||||
|
ldadd = libgrubkern.a;
|
||||||
|
ldadd = grub-core/gnulib/libgnu.a;
|
||||||
|
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||||
|
};
|
||||||
|
|
||||||
data = {
|
data = {
|
||||||
common = util/grub.d/README;
|
common = util/grub.d/README;
|
||||||
installdir = grubconf;
|
installdir = grubconf;
|
||||||
|
@ -288,6 +384,13 @@ script = {
|
||||||
condition = COND_HOST_KFREEBSD;
|
condition = COND_HOST_KFREEBSD;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
script = {
|
||||||
|
name = '10_illumos';
|
||||||
|
common = util/grub.d/10_illumos.in;
|
||||||
|
installdir = grubconf;
|
||||||
|
condition = COND_HOST_ILLUMOS;
|
||||||
|
};
|
||||||
|
|
||||||
script = {
|
script = {
|
||||||
name = '10_netbsd';
|
name = '10_netbsd';
|
||||||
common = util/grub.d/10_netbsd.in;
|
common = util/grub.d/10_netbsd.in;
|
||||||
|
@ -333,29 +436,26 @@ script = {
|
||||||
x86 = util/grub-mkrescue.in;
|
x86 = util/grub-mkrescue.in;
|
||||||
powerpc_ieee1275 = util/powerpc/ieee1275/grub-mkrescue.in;
|
powerpc_ieee1275 = util/powerpc/ieee1275/grub-mkrescue.in;
|
||||||
enable = i386_pc;
|
enable = i386_pc;
|
||||||
enable = x86_efi;
|
enable = i386_efi;
|
||||||
|
enable = x86_64_efi;
|
||||||
enable = i386_qemu;
|
enable = i386_qemu;
|
||||||
enable = i386_multiboot;
|
enable = i386_multiboot;
|
||||||
enable = i386_coreboot;
|
enable = i386_coreboot;
|
||||||
enable = powerpc_ieee1275;
|
enable = powerpc_ieee1275;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
script = {
|
||||||
|
mansection = 1;
|
||||||
|
name = grub-mkstandalone;
|
||||||
|
common = util/grub-mkstandalone.in;
|
||||||
|
};
|
||||||
|
|
||||||
script = {
|
script = {
|
||||||
mansection = 8;
|
mansection = 8;
|
||||||
installdir = sbin;
|
installdir = sbin;
|
||||||
name = grub-install;
|
name = grub-install;
|
||||||
|
|
||||||
mips = util/grub-install.in;
|
common = util/grub-install.in;
|
||||||
i386_pc = util/grub-install.in;
|
|
||||||
i386_qemu = util/grub-install.in;
|
|
||||||
i386_coreboot = util/grub-install.in;
|
|
||||||
i386_multiboot = util/grub-install.in;
|
|
||||||
sparc64_ieee1275 = util/grub-install.in;
|
|
||||||
|
|
||||||
x86_efi = util/i386/efi/grub-install.in;
|
|
||||||
i386_ieee1275 = util/ieee1275/grub-install.in;
|
|
||||||
powerpc_ieee1275 = util/ieee1275/grub-install.in;
|
|
||||||
|
|
||||||
enable = noemu;
|
enable = noemu;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -400,6 +500,11 @@ script = {
|
||||||
installdir = noinst;
|
installdir = noinst;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
script = {
|
||||||
|
name = grub-kbdcomp;
|
||||||
|
common = util/grub-kbdcomp.in;
|
||||||
|
};
|
||||||
|
|
||||||
script = {
|
script = {
|
||||||
name = grub-shell;
|
name = grub-shell;
|
||||||
common = tests/util/grub-shell.in;
|
common = tests/util/grub-shell.in;
|
||||||
|
@ -550,6 +655,12 @@ script = {
|
||||||
common = tests/partmap_test.in;
|
common = tests/partmap_test.in;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
script = {
|
||||||
|
testcase;
|
||||||
|
name = grub_cmd_echo;
|
||||||
|
common = tests/grub_cmd_echo.in;
|
||||||
|
};
|
||||||
|
|
||||||
program = {
|
program = {
|
||||||
testcase;
|
testcase;
|
||||||
name = example_unit_test;
|
name = example_unit_test;
|
||||||
|
@ -559,6 +670,38 @@ program = {
|
||||||
common = grub-core/kern/misc.c;
|
common = grub-core/kern/misc.c;
|
||||||
common = grub-core/tests/lib/test.c;
|
common = grub-core/tests/lib/test.c;
|
||||||
cflags = -Wno-format;
|
cflags = -Wno-format;
|
||||||
ldadd = libgrub.a;
|
ldadd = libgrubmods.a;
|
||||||
ldadd = '$(LIBDEVMAPPER)';
|
ldadd = libgrubgcry.a;
|
||||||
|
ldadd = libgrubkern.a;
|
||||||
|
ldadd = grub-core/gnulib/libgnu.a;
|
||||||
|
ldadd = '$(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||||
|
};
|
||||||
|
|
||||||
|
program = {
|
||||||
|
testcase;
|
||||||
|
name = printf_test;
|
||||||
|
common = tests/printf_unit_test.c;
|
||||||
|
common = tests/lib/unit_test.c;
|
||||||
|
common = grub-core/kern/list.c;
|
||||||
|
common = grub-core/kern/misc.c;
|
||||||
|
common = grub-core/tests/lib/test.c;
|
||||||
|
ldadd = libgrubmods.a;
|
||||||
|
ldadd = libgrubgcry.a;
|
||||||
|
ldadd = libgrubkern.a;
|
||||||
|
ldadd = grub-core/gnulib/libgnu.a;
|
||||||
|
ldadd = '$(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||||
|
};
|
||||||
|
|
||||||
|
program = {
|
||||||
|
name = grub-menulst2cfg;
|
||||||
|
mansection = 1;
|
||||||
|
common = util/grub-menulst2cfg.c;
|
||||||
|
common = grub-core/lib/legacy_parse.c;
|
||||||
|
common = grub-core/lib/i386/pc/vesa_modes_table.c;
|
||||||
|
|
||||||
|
ldadd = libgrubmods.a;
|
||||||
|
ldadd = libgrubgcry.a;
|
||||||
|
ldadd = libgrubkern.a;
|
||||||
|
ldadd = grub-core/gnulib/libgnu.a;
|
||||||
|
ldadd = '$(LIBINTL) $(LIBDEVMAPPER) $(LIBZFS) $(LIBNVPAIR) $(LIBGEOM)';
|
||||||
};
|
};
|
||||||
|
|
58
NEWS
58
NEWS
|
@ -1,5 +1,47 @@
|
||||||
New in 1.99:
|
New in 1.99:
|
||||||
|
|
||||||
|
* Keyboard layouts support.
|
||||||
|
|
||||||
|
* New `lsapm' command (i386-pc only).
|
||||||
|
|
||||||
|
* Parser for GRUB Legacy configuration files.
|
||||||
|
|
||||||
|
* Support RAID on virtio devices.
|
||||||
|
|
||||||
|
* Remove deprecated `root' command.
|
||||||
|
|
||||||
|
* New `euro.pf2' font which supports most European languages.
|
||||||
|
|
||||||
|
* Avoid opening the same device twice on Open Firmware platforms.
|
||||||
|
|
||||||
|
* Extend `vbeinfo' and `vbetest' commands to non-VBE graphics, as
|
||||||
|
`videoinfo' and `videotest'.
|
||||||
|
|
||||||
|
* New `lsefisystab', `lssal', and `lsefimmap' commands on EFI platforms.
|
||||||
|
|
||||||
|
* Support explicit user claim that a device is BIOS-visible. Devices
|
||||||
|
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.
|
||||||
|
|
||||||
|
* Use ACPI to shut down if possible.
|
||||||
|
|
||||||
|
* New `lsacpi' command.
|
||||||
|
|
||||||
|
* Btrfs support.
|
||||||
|
|
||||||
|
* New `--boot-directory' option to `grub-install', `grub-reboot', and
|
||||||
|
`grub-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
|
||||||
|
netboot directory trees.
|
||||||
|
|
||||||
* New relocator. Allows for more kernel support and more
|
* New relocator. Allows for more kernel support and more
|
||||||
straightforward loader writing.
|
straightforward loader writing.
|
||||||
|
|
||||||
|
@ -9,9 +51,7 @@ New in 1.99:
|
||||||
|
|
||||||
* Add `sendkey' command (i386-pc only).
|
* Add `sendkey' command (i386-pc only).
|
||||||
|
|
||||||
* ZFS support in `grub-install' and `grub-mkconfig'. Note: complete
|
* ZFS support.
|
||||||
functionality requires external ZFS implementation (available from
|
|
||||||
grub-extras).
|
|
||||||
|
|
||||||
* Support 1.x versions of mdadm metadata.
|
* Support 1.x versions of mdadm metadata.
|
||||||
|
|
||||||
|
@ -43,10 +83,6 @@ New in 1.99:
|
||||||
|
|
||||||
* Extensive updates to the Texinfo documentation.
|
* Extensive updates to the Texinfo documentation.
|
||||||
|
|
||||||
* Add `grub-probe' support for the btrfs filesystem, permitting / to
|
|
||||||
reside on btrfs as long as /boot is on a filesystem natively supported
|
|
||||||
by GRUB.
|
|
||||||
|
|
||||||
* Handle symbolic links under /dev/mapper on GNU/Linux.
|
* Handle symbolic links under /dev/mapper on GNU/Linux.
|
||||||
|
|
||||||
* Handle installation across multiple partition table types.
|
* Handle installation across multiple partition table types.
|
||||||
|
@ -60,7 +96,8 @@ New in 1.99:
|
||||||
|
|
||||||
* `grub-mkrescue' support for EFI, coreboot, and QEMU platforms.
|
* `grub-mkrescue' support for EFI, coreboot, and QEMU platforms.
|
||||||
|
|
||||||
* Unify `grub-mkimage' source code across platforms.
|
* Unify `grub-mkimage', `grub-setup', and `grub-install' source code
|
||||||
|
across platforms.
|
||||||
|
|
||||||
* Fix VGA (as opposed to VBE) video driver, formerly a terminal driver.
|
* Fix VGA (as opposed to VBE) video driver, formerly a terminal driver.
|
||||||
|
|
||||||
|
@ -83,8 +120,9 @@ New in 1.99:
|
||||||
* sunpc partition table support.
|
* sunpc partition table support.
|
||||||
|
|
||||||
* Add a number of new language features to GRUB script: `for', `while',
|
* Add a number of new language features to GRUB script: `for', `while',
|
||||||
`until', `elif', function parameters, `break', `continue', and
|
`until', `elif', function parameters, `break', `continue', `shift',
|
||||||
`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. GRUB now prefers to name partitions
|
||||||
in the form `(hd0,msdos1,bsd1)' rather than `(hd0,1,a)'.
|
in the form `(hd0,msdos1,bsd1)' rather than `(hd0,1,a)'.
|
||||||
|
|
77
acinclude.m4
77
acinclude.m4
|
@ -58,18 +58,15 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if $EGREP '(^|[^_[:alnum]])_func' conftest.s >/dev/null 2>&1; then
|
if $EGREP '(^|[^_[:alnum]])_func' conftest.s >/dev/null 2>&1; then
|
||||||
|
HAVE_ASM_USCORE=1
|
||||||
grub_cv_asm_uscore=yes
|
grub_cv_asm_uscore=yes
|
||||||
else
|
else
|
||||||
|
HAVE_ASM_USCORE=0
|
||||||
grub_cv_asm_uscore=no
|
grub_cv_asm_uscore=no
|
||||||
fi
|
fi
|
||||||
|
|
||||||
rm -f conftest*])
|
rm -f conftest*])
|
||||||
|
|
||||||
if test "x$grub_cv_asm_uscore" = xyes; then
|
|
||||||
AC_DEFINE_UNQUOTED([HAVE_ASM_USCORE], $grub_cv_asm_uscore,
|
|
||||||
[Define if C symbols get an underscore after compilation])
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_MSG_RESULT([$grub_cv_asm_uscore])
|
AC_MSG_RESULT([$grub_cv_asm_uscore])
|
||||||
])
|
])
|
||||||
|
|
||||||
|
@ -237,44 +234,12 @@ else
|
||||||
grub_tmp_data32="data32;"
|
grub_tmp_data32="data32;"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_DEFINE_UNQUOTED([ADDR32], $grub_tmp_addr32,
|
ADDR32=$grub_tmp_addr32
|
||||||
[Define it to \"addr32\" or \"addr32;\" to make GAS happy])
|
DATA32=$grub_tmp_data32
|
||||||
AC_DEFINE_UNQUOTED([DATA32], $grub_tmp_data32,
|
|
||||||
[Define it to \"data32\" or \"data32;\" to make GAS happy])
|
|
||||||
|
|
||||||
AC_MSG_RESULT([$grub_cv_i386_asm_prefix_requirement])])
|
AC_MSG_RESULT([$grub_cv_i386_asm_prefix_requirement])])
|
||||||
|
|
||||||
|
|
||||||
dnl Older versions of GAS require that absolute indirect calls/jumps are
|
|
||||||
dnl not prefixed with `*', while later versions warn if not prefixed.
|
|
||||||
AC_DEFUN([grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK],
|
|
||||||
[AC_REQUIRE([AC_PROG_CC])
|
|
||||||
AC_MSG_CHECKING(dnl
|
|
||||||
[whether an absolute indirect call/jump must not be prefixed with an asterisk])
|
|
||||||
AC_CACHE_VAL(grub_cv_i386_asm_absolute_without_asterisk,
|
|
||||||
[cat > conftest.s <<\EOF
|
|
||||||
lcall *(offset)
|
|
||||||
offset:
|
|
||||||
.long 0
|
|
||||||
.word 0
|
|
||||||
EOF
|
|
||||||
|
|
||||||
if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -c conftest.s]) && test -s conftest.o; then
|
|
||||||
grub_cv_i386_asm_absolute_without_asterisk=no
|
|
||||||
else
|
|
||||||
grub_cv_i386_asm_absolute_without_asterisk=yes
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -f conftest*])
|
|
||||||
|
|
||||||
if test "x$grub_cv_i386_asm_absolute_without_asterisk" = xyes; then
|
|
||||||
AC_DEFINE([ABSOLUTE_WITHOUT_ASTERISK], 1,
|
|
||||||
[Define it if GAS requires that absolute indirect calls/jumps are not prefixed with an asterisk])
|
|
||||||
fi
|
|
||||||
|
|
||||||
AC_MSG_RESULT([$grub_cv_i386_asm_absolute_without_asterisk])])
|
|
||||||
|
|
||||||
|
|
||||||
dnl Check what symbol is defined as a bss start symbol.
|
dnl Check what symbol is defined as a bss start symbol.
|
||||||
dnl Written by Michael Hohmoth and Yoshinori K. Okuji.
|
dnl Written by Michael Hohmoth and Yoshinori K. Okuji.
|
||||||
AC_DEFUN([grub_CHECK_BSS_START_SYMBOL],
|
AC_DEFUN([grub_CHECK_BSS_START_SYMBOL],
|
||||||
|
@ -306,14 +271,12 @@ AC_CACHE_VAL(grub_cv_check_uscore_edata_symbol,
|
||||||
|
|
||||||
AC_MSG_RESULT([$grub_cv_check_uscore_edata_symbol])
|
AC_MSG_RESULT([$grub_cv_check_uscore_edata_symbol])
|
||||||
|
|
||||||
AH_TEMPLATE([BSS_START_SYMBOL], [Define it to one of __bss_start, edata and _edata])
|
|
||||||
|
|
||||||
if test "x$grub_cv_check_uscore_uscore_bss_start_symbol" = xyes; then
|
if test "x$grub_cv_check_uscore_uscore_bss_start_symbol" = xyes; then
|
||||||
AC_DEFINE([BSS_START_SYMBOL], [__bss_start])
|
BSS_START_SYMBOL=__bss_start
|
||||||
elif test "x$grub_cv_check_edata_symbol" = xyes; then
|
elif test "x$grub_cv_check_edata_symbol" = xyes; then
|
||||||
AC_DEFINE([BSS_START_SYMBOL], [edata])
|
BSS_START_SYMBOL=edata
|
||||||
elif test "x$grub_cv_check_uscore_edata_symbol" = xyes; then
|
elif test "x$grub_cv_check_uscore_edata_symbol" = xyes; then
|
||||||
AC_DEFINE([BSS_START_SYMBOL], [_edata])
|
BSS_START_SYMBOL=_edata
|
||||||
else
|
else
|
||||||
AC_MSG_ERROR([none of __bss_start, edata or _edata is defined])
|
AC_MSG_ERROR([none of __bss_start, edata or _edata is defined])
|
||||||
fi
|
fi
|
||||||
|
@ -341,12 +304,10 @@ AC_CACHE_VAL(grub_cv_check_uscore_end_symbol,
|
||||||
|
|
||||||
AC_MSG_RESULT([$grub_cv_check_uscore_end_symbol])
|
AC_MSG_RESULT([$grub_cv_check_uscore_end_symbol])
|
||||||
|
|
||||||
AH_TEMPLATE([END_SYMBOL], [Define it to either end or _end])
|
|
||||||
|
|
||||||
if test "x$grub_cv_check_end_symbol" = xyes; then
|
if test "x$grub_cv_check_end_symbol" = xyes; then
|
||||||
AC_DEFINE([END_SYMBOL], [end])
|
END_SYMBOL=end
|
||||||
elif test "x$grub_cv_check_uscore_end_symbol" = xyes; then
|
elif test "x$grub_cv_check_uscore_end_symbol" = xyes; then
|
||||||
AC_DEFINE([END_SYMBOL], [_end])
|
END_SYMBOL=_end
|
||||||
else
|
else
|
||||||
AC_MSG_ERROR([neither end nor _end is defined])
|
AC_MSG_ERROR([neither end nor _end is defined])
|
||||||
fi
|
fi
|
||||||
|
@ -355,24 +316,24 @@ fi
|
||||||
dnl Check if the C compiler generates calls to `__enable_execute_stack()'.
|
dnl Check if the C compiler generates calls to `__enable_execute_stack()'.
|
||||||
AC_DEFUN([grub_CHECK_ENABLE_EXECUTE_STACK],[
|
AC_DEFUN([grub_CHECK_ENABLE_EXECUTE_STACK],[
|
||||||
AC_MSG_CHECKING([whether `$CC' generates calls to `__enable_execute_stack()'])
|
AC_MSG_CHECKING([whether `$CC' generates calls to `__enable_execute_stack()'])
|
||||||
AC_LANG_CONFTEST([[
|
AC_LANG_CONFTEST([AC_LANG_SOURCE([[
|
||||||
void f (int (*p) (void));
|
void f (int (*p) (void));
|
||||||
void g (int i)
|
void g (int i)
|
||||||
{
|
{
|
||||||
int nestedfunc (void) { return i; }
|
int nestedfunc (void) { return i; }
|
||||||
f (nestedfunc);
|
f (nestedfunc);
|
||||||
}
|
}
|
||||||
]])
|
]])])
|
||||||
if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -S conftest.c]) && test -s conftest.s; then
|
if AC_TRY_COMMAND([${CC-cc} ${CFLAGS} -S conftest.c]) && test -s conftest.s; then
|
||||||
true
|
true
|
||||||
else
|
else
|
||||||
AC_MSG_ERROR([${CC-cc} failed to produce assembly code])
|
AC_MSG_ERROR([${CC-cc} failed to produce assembly code])
|
||||||
fi
|
fi
|
||||||
if grep __enable_execute_stack conftest.s >/dev/null 2>&1; then
|
if grep __enable_execute_stack conftest.s >/dev/null 2>&1; then
|
||||||
AC_DEFINE([NEED_ENABLE_EXECUTE_STACK], 1,
|
NEED_ENABLE_EXECUTE_STACK=1
|
||||||
[Define to 1 if GCC generates calls to __enable_execute_stack()])
|
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
else
|
else
|
||||||
|
NEED_ENABLE_EXECUTE_STACK=0
|
||||||
AC_MSG_RESULT([no])
|
AC_MSG_RESULT([no])
|
||||||
fi
|
fi
|
||||||
rm -f conftest*
|
rm -f conftest*
|
||||||
|
@ -385,7 +346,9 @@ AC_DEFUN([grub_CHECK_STACK_PROTECTOR],[
|
||||||
ssp_possible=yes]
|
ssp_possible=yes]
|
||||||
AC_MSG_CHECKING([whether `$CC' accepts `-fstack-protector'])
|
AC_MSG_CHECKING([whether `$CC' accepts `-fstack-protector'])
|
||||||
# Is this a reliable test case?
|
# Is this a reliable test case?
|
||||||
AC_LANG_CONFTEST([[void foo (void) { volatile char a[8]; a[3]; }]])
|
AC_LANG_CONFTEST([AC_LANG_SOURCE([[
|
||||||
|
void foo (void) { volatile char a[8]; a[3]; }
|
||||||
|
]])])
|
||||||
[# `$CC -c -o ...' might not be portable. But, oh, well... Is calling
|
[# `$CC -c -o ...' might not be portable. But, oh, well... Is calling
|
||||||
# `ac_compile' like this correct, after all?
|
# `ac_compile' like this correct, after all?
|
||||||
if eval "$ac_compile -S -fstack-protector -o conftest.s" 2> /dev/null; then]
|
if eval "$ac_compile -S -fstack-protector -o conftest.s" 2> /dev/null; then]
|
||||||
|
@ -403,7 +366,9 @@ AC_DEFUN([grub_CHECK_STACK_ARG_PROBE],[
|
||||||
[# Smashing stack arg probe.
|
[# Smashing stack arg probe.
|
||||||
sap_possible=yes]
|
sap_possible=yes]
|
||||||
AC_MSG_CHECKING([whether `$CC' accepts `-mstack-arg-probe'])
|
AC_MSG_CHECKING([whether `$CC' accepts `-mstack-arg-probe'])
|
||||||
AC_LANG_CONFTEST([[void foo (void) { volatile char a[8]; a[3]; }]])
|
AC_LANG_CONFTEST([AC_LANG_SOURCE([[
|
||||||
|
void foo (void) { volatile char a[8]; a[3]; }
|
||||||
|
]])])
|
||||||
[if eval "$ac_compile -S -mstack-arg-probe -o conftest.s" 2> /dev/null; then]
|
[if eval "$ac_compile -S -mstack-arg-probe -o conftest.s" 2> /dev/null; then]
|
||||||
AC_MSG_RESULT([yes])
|
AC_MSG_RESULT([yes])
|
||||||
[# Should we clear up other files as well, having called `AC_LANG_CONFTEST'?
|
[# Should we clear up other files as well, having called `AC_LANG_CONFTEST'?
|
||||||
|
@ -438,7 +403,7 @@ AC_DEFUN([grub_CHECK_PIE],[
|
||||||
pie_possible=yes]
|
pie_possible=yes]
|
||||||
AC_MSG_CHECKING([whether `$CC' has `-fPIE' as default])
|
AC_MSG_CHECKING([whether `$CC' has `-fPIE' as default])
|
||||||
# Is this a reliable test case?
|
# Is this a reliable test case?
|
||||||
AC_LANG_CONFTEST([[
|
AC_LANG_CONFTEST([AC_LANG_SOURCE([[
|
||||||
#ifdef __PIE__
|
#ifdef __PIE__
|
||||||
int main() {
|
int main() {
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -446,7 +411,7 @@ int main() {
|
||||||
#else
|
#else
|
||||||
#error NO __PIE__ DEFINED
|
#error NO __PIE__ DEFINED
|
||||||
#endif
|
#endif
|
||||||
]])
|
]])])
|
||||||
|
|
||||||
[# `$CC -c -o ...' might not be portable. But, oh, well... Is calling
|
[# `$CC -c -o ...' might not be portable. But, oh, well... Is calling
|
||||||
# `ac_compile' like this correct, after all?
|
# `ac_compile' like this correct, after all?
|
||||||
|
|
51
autogen.sh
51
autogen.sh
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
set -e
|
set -e
|
||||||
|
|
||||||
|
export LC_CTYPE=C
|
||||||
|
export LC_COLLATE=C
|
||||||
|
unset LC_ALL
|
||||||
|
|
||||||
autogen --version >/dev/null || exit 1
|
autogen --version >/dev/null || exit 1
|
||||||
|
|
||||||
echo "Importing unicode..."
|
echo "Importing unicode..."
|
||||||
|
@ -14,9 +18,50 @@ echo "Creating Makefile.tpl..."
|
||||||
python gentpl.py | sed -e '/^$/{N;/^\n$/D;}' > Makefile.tpl
|
python gentpl.py | sed -e '/^$/{N;/^\n$/D;}' > Makefile.tpl
|
||||||
|
|
||||||
echo "Running autogen..."
|
echo "Running autogen..."
|
||||||
autogen -T Makefile.tpl Makefile.util.def | sed -e '/^$/{N;/^\n$/D;}' > Makefile.util.am
|
|
||||||
autogen -T Makefile.tpl grub-core/Makefile.core.def | sed -e '/^$/{N;/^\n$/D;}' > grub-core/Makefile.core.am
|
# Automake doesn't like including files from a path outside the project.
|
||||||
autogen -T Makefile.tpl grub-core/Makefile.gcry.def | sed -e '/^$/{N;/^\n$/D;}' > grub-core/Makefile.gcry.am
|
rm -f contrib grub-core/contrib
|
||||||
|
if [ "x${GRUB_CONTRIB}" != x ]; then
|
||||||
|
[ "${GRUB_CONTRIB}" = contrib ] || ln -s "${GRUB_CONTRIB}" contrib
|
||||||
|
[ "${GRUB_CONTRIB}" = grub-core/contrib ] || ln -s ../contrib grub-core/contrib
|
||||||
|
fi
|
||||||
|
|
||||||
|
UTIL_DEFS='Makefile.util.def Makefile.utilgcry.def'
|
||||||
|
CORE_DEFS='grub-core/Makefile.core.def grub-core/Makefile.gcry.def'
|
||||||
|
|
||||||
|
for extra in contrib/*/Makefile.util.def; do
|
||||||
|
if test -e "$extra"; then
|
||||||
|
UTIL_DEFS="$UTIL_DEFS $extra"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
for extra in contrib/*/Makefile.core.def; do
|
||||||
|
if test -e "$extra"; then
|
||||||
|
CORE_DEFS="$CORE_DEFS $extra"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
cat $UTIL_DEFS | autogen -T Makefile.tpl | sed -e '/^$/{N;/^\n$/D;}' > Makefile.util.am
|
||||||
|
cat $CORE_DEFS | autogen -T Makefile.tpl | sed -e '/^$/{N;/^\n$/D;}' > grub-core/Makefile.core.am
|
||||||
|
|
||||||
|
for extra in contrib/*/Makefile.common; do
|
||||||
|
if test -e "$extra"; then
|
||||||
|
echo "include $extra" >> Makefile.util.am
|
||||||
|
echo "include $extra" >> grub-core/Makefile.core.am
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
for extra in contrib/*/Makefile.util.common; do
|
||||||
|
if test -e "$extra"; then
|
||||||
|
echo "include $extra" >> Makefile.util.am
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
for extra in contrib/*/Makefile.core.common; do
|
||||||
|
if test -e "$extra"; then
|
||||||
|
echo "include $extra" >> grub-core/Makefile.core.am
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
echo "Saving timestamps..."
|
echo "Saving timestamps..."
|
||||||
echo timestamp > stamp-h.in
|
echo timestamp > stamp-h.in
|
||||||
|
|
26
build-aux/arg-nonnull.h
Normal file
26
build-aux/arg-nonnull.h
Normal file
|
@ -0,0 +1,26 @@
|
||||||
|
/* A C macro for declaring that specific arguments must not be NULL.
|
||||||
|
Copyright (C) 2009, 2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program 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.
|
||||||
|
|
||||||
|
This program 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
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
/* _GL_ARG_NONNULL((n,...,m)) tells the compiler and static analyzer tools
|
||||||
|
that the values passed as arguments n, ..., m must be non-NULL pointers.
|
||||||
|
n = 1 stands for the first argument, n = 2 for the second argument etc. */
|
||||||
|
#ifndef _GL_ARG_NONNULL
|
||||||
|
# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 3) || __GNUC__ > 3
|
||||||
|
# define _GL_ARG_NONNULL(params) __attribute__ ((__nonnull__ params))
|
||||||
|
# else
|
||||||
|
# define _GL_ARG_NONNULL(params)
|
||||||
|
# endif
|
||||||
|
#endif
|
271
build-aux/c++defs.h
Normal file
271
build-aux/c++defs.h
Normal file
|
@ -0,0 +1,271 @@
|
||||||
|
/* C++ compatible function declaration macros.
|
||||||
|
Copyright (C) 2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program 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.
|
||||||
|
|
||||||
|
This program 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
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
#ifndef _GL_CXXDEFS_H
|
||||||
|
#define _GL_CXXDEFS_H
|
||||||
|
|
||||||
|
/* The three most frequent use cases of these macros are:
|
||||||
|
|
||||||
|
* For providing a substitute for a function that is missing on some
|
||||||
|
platforms, but is declared and works fine on the platforms on which
|
||||||
|
it exists:
|
||||||
|
|
||||||
|
#if @GNULIB_FOO@
|
||||||
|
# if !@HAVE_FOO@
|
||||||
|
_GL_FUNCDECL_SYS (foo, ...);
|
||||||
|
# endif
|
||||||
|
_GL_CXXALIAS_SYS (foo, ...);
|
||||||
|
_GL_CXXALIASWARN (foo);
|
||||||
|
#elif defined GNULIB_POSIXCHECK
|
||||||
|
...
|
||||||
|
#endif
|
||||||
|
|
||||||
|
* For providing a replacement for a function that exists on all platforms,
|
||||||
|
but is broken/insufficient and needs to be replaced on some platforms:
|
||||||
|
|
||||||
|
#if @GNULIB_FOO@
|
||||||
|
# if @REPLACE_FOO@
|
||||||
|
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||||
|
# undef foo
|
||||||
|
# define foo rpl_foo
|
||||||
|
# endif
|
||||||
|
_GL_FUNCDECL_RPL (foo, ...);
|
||||||
|
_GL_CXXALIAS_RPL (foo, ...);
|
||||||
|
# else
|
||||||
|
_GL_CXXALIAS_SYS (foo, ...);
|
||||||
|
# endif
|
||||||
|
_GL_CXXALIASWARN (foo);
|
||||||
|
#elif defined GNULIB_POSIXCHECK
|
||||||
|
...
|
||||||
|
#endif
|
||||||
|
|
||||||
|
* For providing a replacement for a function that exists on some platforms
|
||||||
|
but is broken/insufficient and needs to be replaced on some of them and
|
||||||
|
is additionally either missing or undeclared on some other platforms:
|
||||||
|
|
||||||
|
#if @GNULIB_FOO@
|
||||||
|
# if @REPLACE_FOO@
|
||||||
|
# if !(defined __cplusplus && defined GNULIB_NAMESPACE)
|
||||||
|
# undef foo
|
||||||
|
# define foo rpl_foo
|
||||||
|
# endif
|
||||||
|
_GL_FUNCDECL_RPL (foo, ...);
|
||||||
|
_GL_CXXALIAS_RPL (foo, ...);
|
||||||
|
# else
|
||||||
|
# if !@HAVE_FOO@ or if !@HAVE_DECL_FOO@
|
||||||
|
_GL_FUNCDECL_SYS (foo, ...);
|
||||||
|
# endif
|
||||||
|
_GL_CXXALIAS_SYS (foo, ...);
|
||||||
|
# endif
|
||||||
|
_GL_CXXALIASWARN (foo);
|
||||||
|
#elif defined GNULIB_POSIXCHECK
|
||||||
|
...
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* _GL_EXTERN_C declaration;
|
||||||
|
performs the declaration with C linkage. */
|
||||||
|
#if defined __cplusplus
|
||||||
|
# define _GL_EXTERN_C extern "C"
|
||||||
|
#else
|
||||||
|
# define _GL_EXTERN_C extern
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* _GL_FUNCDECL_RPL (func, rettype, parameters_and_attributes);
|
||||||
|
declares a replacement function, named rpl_func, with the given prototype,
|
||||||
|
consisting of return type, parameters, and attributes.
|
||||||
|
Example:
|
||||||
|
_GL_FUNCDECL_RPL (open, int, (const char *filename, int flags, ...)
|
||||||
|
_GL_ARG_NONNULL ((1)));
|
||||||
|
*/
|
||||||
|
#define _GL_FUNCDECL_RPL(func,rettype,parameters_and_attributes) \
|
||||||
|
_GL_FUNCDECL_RPL_1 (rpl_##func, rettype, parameters_and_attributes)
|
||||||
|
#define _GL_FUNCDECL_RPL_1(rpl_func,rettype,parameters_and_attributes) \
|
||||||
|
_GL_EXTERN_C rettype rpl_func parameters_and_attributes
|
||||||
|
|
||||||
|
/* _GL_FUNCDECL_SYS (func, rettype, parameters_and_attributes);
|
||||||
|
declares the system function, named func, with the given prototype,
|
||||||
|
consisting of return type, parameters, and attributes.
|
||||||
|
Example:
|
||||||
|
_GL_FUNCDECL_SYS (open, int, (const char *filename, int flags, ...)
|
||||||
|
_GL_ARG_NONNULL ((1)));
|
||||||
|
*/
|
||||||
|
#define _GL_FUNCDECL_SYS(func,rettype,parameters_and_attributes) \
|
||||||
|
_GL_EXTERN_C rettype func parameters_and_attributes
|
||||||
|
|
||||||
|
/* _GL_CXXALIAS_RPL (func, rettype, parameters);
|
||||||
|
declares a C++ alias called GNULIB_NAMESPACE::func
|
||||||
|
that redirects to rpl_func, if GNULIB_NAMESPACE is defined.
|
||||||
|
Example:
|
||||||
|
_GL_CXXALIAS_RPL (open, int, (const char *filename, int flags, ...));
|
||||||
|
*/
|
||||||
|
#define _GL_CXXALIAS_RPL(func,rettype,parameters) \
|
||||||
|
_GL_CXXALIAS_RPL_1 (func, rpl_##func, rettype, parameters)
|
||||||
|
#if defined __cplusplus && defined GNULIB_NAMESPACE
|
||||||
|
# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
|
||||||
|
namespace GNULIB_NAMESPACE \
|
||||||
|
{ \
|
||||||
|
rettype (*const func) parameters = ::rpl_func; \
|
||||||
|
} \
|
||||||
|
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||||
|
#else
|
||||||
|
# define _GL_CXXALIAS_RPL_1(func,rpl_func,rettype,parameters) \
|
||||||
|
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* _GL_CXXALIAS_RPL_CAST_1 (func, rpl_func, rettype, parameters);
|
||||||
|
is like _GL_CXXALIAS_RPL_1 (func, rpl_func, rettype, parameters);
|
||||||
|
except that the C function rpl_func may have a slightly different
|
||||||
|
declaration. A cast is used to silence the "invalid conversion" error
|
||||||
|
that would otherwise occur. */
|
||||||
|
#if defined __cplusplus && defined GNULIB_NAMESPACE
|
||||||
|
# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
|
||||||
|
namespace GNULIB_NAMESPACE \
|
||||||
|
{ \
|
||||||
|
rettype (*const func) parameters = \
|
||||||
|
reinterpret_cast<rettype(*)parameters>(::rpl_func); \
|
||||||
|
} \
|
||||||
|
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||||
|
#else
|
||||||
|
# define _GL_CXXALIAS_RPL_CAST_1(func,rpl_func,rettype,parameters) \
|
||||||
|
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* _GL_CXXALIAS_SYS (func, rettype, parameters);
|
||||||
|
declares a C++ alias called GNULIB_NAMESPACE::func
|
||||||
|
that redirects to the system provided function func, if GNULIB_NAMESPACE
|
||||||
|
is defined.
|
||||||
|
Example:
|
||||||
|
_GL_CXXALIAS_SYS (open, int, (const char *filename, int flags, ...));
|
||||||
|
*/
|
||||||
|
#if defined __cplusplus && defined GNULIB_NAMESPACE
|
||||||
|
/* If we were to write
|
||||||
|
rettype (*const func) parameters = ::func;
|
||||||
|
like above in _GL_CXXALIAS_RPL_1, the compiler could optimize calls
|
||||||
|
better (remove an indirection through a 'static' pointer variable),
|
||||||
|
but then the _GL_CXXALIASWARN macro below would cause a warning not only
|
||||||
|
for uses of ::func but also for uses of GNULIB_NAMESPACE::func. */
|
||||||
|
# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
|
||||||
|
namespace GNULIB_NAMESPACE \
|
||||||
|
{ \
|
||||||
|
static rettype (*func) parameters = ::func; \
|
||||||
|
} \
|
||||||
|
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||||
|
#else
|
||||||
|
# define _GL_CXXALIAS_SYS(func,rettype,parameters) \
|
||||||
|
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* _GL_CXXALIAS_SYS_CAST (func, rettype, parameters);
|
||||||
|
is like _GL_CXXALIAS_SYS (func, rettype, parameters);
|
||||||
|
except that the C function func may have a slightly different declaration.
|
||||||
|
A cast is used to silence the "invalid conversion" error that would
|
||||||
|
otherwise occur. */
|
||||||
|
#if defined __cplusplus && defined GNULIB_NAMESPACE
|
||||||
|
# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
|
||||||
|
namespace GNULIB_NAMESPACE \
|
||||||
|
{ \
|
||||||
|
static rettype (*func) parameters = \
|
||||||
|
reinterpret_cast<rettype(*)parameters>(::func); \
|
||||||
|
} \
|
||||||
|
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||||
|
#else
|
||||||
|
# define _GL_CXXALIAS_SYS_CAST(func,rettype,parameters) \
|
||||||
|
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* _GL_CXXALIAS_SYS_CAST2 (func, rettype, parameters, rettype2, parameters2);
|
||||||
|
is like _GL_CXXALIAS_SYS (func, rettype, parameters);
|
||||||
|
except that the C function is picked among a set of overloaded functions,
|
||||||
|
namely the one with rettype2 and parameters2. Two consecutive casts
|
||||||
|
are used to silence the "cannot find a match" and "invalid conversion"
|
||||||
|
errors that would otherwise occur. */
|
||||||
|
#if defined __cplusplus && defined GNULIB_NAMESPACE
|
||||||
|
/* The outer cast must be a reinterpret_cast.
|
||||||
|
The inner cast: When the function is defined as a set of overloaded
|
||||||
|
functions, it works as a static_cast<>, choosing the designated variant.
|
||||||
|
When the function is defined as a single variant, it works as a
|
||||||
|
reinterpret_cast<>. The parenthesized cast syntax works both ways. */
|
||||||
|
# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
|
||||||
|
namespace GNULIB_NAMESPACE \
|
||||||
|
{ \
|
||||||
|
static rettype (*func) parameters = \
|
||||||
|
reinterpret_cast<rettype(*)parameters>( \
|
||||||
|
(rettype2(*)parameters2)(::func)); \
|
||||||
|
} \
|
||||||
|
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||||
|
#else
|
||||||
|
# define _GL_CXXALIAS_SYS_CAST2(func,rettype,parameters,rettype2,parameters2) \
|
||||||
|
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* _GL_CXXALIASWARN (func);
|
||||||
|
causes a warning to be emitted when ::func is used but not when
|
||||||
|
GNULIB_NAMESPACE::func is used. func must be defined without overloaded
|
||||||
|
variants. */
|
||||||
|
#if defined __cplusplus && defined GNULIB_NAMESPACE
|
||||||
|
# define _GL_CXXALIASWARN(func) \
|
||||||
|
_GL_CXXALIASWARN_1 (func, GNULIB_NAMESPACE)
|
||||||
|
# define _GL_CXXALIASWARN_1(func,namespace) \
|
||||||
|
_GL_CXXALIASWARN_2 (func, namespace)
|
||||||
|
/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
|
||||||
|
we enable the warning only when not optimizing. */
|
||||||
|
# if !__OPTIMIZE__
|
||||||
|
# define _GL_CXXALIASWARN_2(func,namespace) \
|
||||||
|
_GL_WARN_ON_USE (func, \
|
||||||
|
"The symbol ::" #func " refers to the system function. " \
|
||||||
|
"Use " #namespace "::" #func " instead.")
|
||||||
|
# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
|
||||||
|
# define _GL_CXXALIASWARN_2(func,namespace) \
|
||||||
|
extern __typeof__ (func) func
|
||||||
|
# else
|
||||||
|
# define _GL_CXXALIASWARN_2(func,namespace) \
|
||||||
|
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# define _GL_CXXALIASWARN(func) \
|
||||||
|
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* _GL_CXXALIASWARN1 (func, rettype, parameters_and_attributes);
|
||||||
|
causes a warning to be emitted when the given overloaded variant of ::func
|
||||||
|
is used but not when GNULIB_NAMESPACE::func is used. */
|
||||||
|
#if defined __cplusplus && defined GNULIB_NAMESPACE
|
||||||
|
# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
|
||||||
|
_GL_CXXALIASWARN1_1 (func, rettype, parameters_and_attributes, \
|
||||||
|
GNULIB_NAMESPACE)
|
||||||
|
# define _GL_CXXALIASWARN1_1(func,rettype,parameters_and_attributes,namespace) \
|
||||||
|
_GL_CXXALIASWARN1_2 (func, rettype, parameters_and_attributes, namespace)
|
||||||
|
/* To work around GCC bug <http://gcc.gnu.org/bugzilla/show_bug.cgi?id=43881>,
|
||||||
|
we enable the warning only when not optimizing. */
|
||||||
|
# if !__OPTIMIZE__
|
||||||
|
# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
|
||||||
|
_GL_WARN_ON_USE_CXX (func, rettype, parameters_and_attributes, \
|
||||||
|
"The symbol ::" #func " refers to the system function. " \
|
||||||
|
"Use " #namespace "::" #func " instead.")
|
||||||
|
# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
|
||||||
|
# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
|
||||||
|
extern __typeof__ (func) func
|
||||||
|
# else
|
||||||
|
# define _GL_CXXALIASWARN1_2(func,rettype,parameters_and_attributes,namespace) \
|
||||||
|
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||||
|
# endif
|
||||||
|
#else
|
||||||
|
# define _GL_CXXALIASWARN1(func,rettype,parameters_and_attributes) \
|
||||||
|
_GL_EXTERN_C int _gl_cxxalias_dummy
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _GL_CXXDEFS_H */
|
|
@ -2,7 +2,7 @@
|
||||||
# Output a system dependent set of variables, describing how to set the
|
# Output a system dependent set of variables, describing how to set the
|
||||||
# run time search path of shared libraries in an executable.
|
# run time search path of shared libraries in an executable.
|
||||||
#
|
#
|
||||||
# Copyright 1996-2008 Free Software Foundation, Inc.
|
# Copyright 1996-2006 Free Software Foundation, Inc.
|
||||||
# Taken from GNU libtool, 2001
|
# Taken from GNU libtool, 2001
|
||||||
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
|
||||||
#
|
#
|
||||||
|
@ -47,7 +47,7 @@ for cc_temp in $CC""; do
|
||||||
done
|
done
|
||||||
cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
|
cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
|
||||||
|
|
||||||
# Code taken from libtool.m4's _LT_COMPILER_PIC.
|
# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
|
||||||
|
|
||||||
wl=
|
wl=
|
||||||
if test "$GCC" = yes; then
|
if test "$GCC" = yes; then
|
||||||
|
@ -64,7 +64,7 @@ else
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
;;
|
;;
|
||||||
mingw* | cygwin* | pw32* | os2* | cegcc*)
|
mingw* | pw32* | os2*)
|
||||||
;;
|
;;
|
||||||
hpux9* | hpux10* | hpux11*)
|
hpux9* | hpux10* | hpux11*)
|
||||||
wl='-Wl,'
|
wl='-Wl,'
|
||||||
|
@ -74,15 +74,9 @@ else
|
||||||
;;
|
;;
|
||||||
newsos6)
|
newsos6)
|
||||||
;;
|
;;
|
||||||
linux* | k*bsd*-gnu)
|
linux*)
|
||||||
case $cc_basename in
|
case $cc_basename in
|
||||||
ecc*)
|
icc* | ecc*)
|
||||||
wl='-Wl,'
|
|
||||||
;;
|
|
||||||
icc* | ifort*)
|
|
||||||
wl='-Wl,'
|
|
||||||
;;
|
|
||||||
lf95*)
|
|
||||||
wl='-Wl,'
|
wl='-Wl,'
|
||||||
;;
|
;;
|
||||||
pgcc | pgf77 | pgf90)
|
pgcc | pgf77 | pgf90)
|
||||||
|
@ -106,7 +100,7 @@ else
|
||||||
osf3* | osf4* | osf5*)
|
osf3* | osf4* | osf5*)
|
||||||
wl='-Wl,'
|
wl='-Wl,'
|
||||||
;;
|
;;
|
||||||
rdos*)
|
sco3.2v5*)
|
||||||
;;
|
;;
|
||||||
solaris*)
|
solaris*)
|
||||||
wl='-Wl,'
|
wl='-Wl,'
|
||||||
|
@ -114,14 +108,11 @@ else
|
||||||
sunos4*)
|
sunos4*)
|
||||||
wl='-Qoption ld '
|
wl='-Qoption ld '
|
||||||
;;
|
;;
|
||||||
sysv4 | sysv4.2uw2* | sysv4.3*)
|
sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
|
||||||
wl='-Wl,'
|
wl='-Wl,'
|
||||||
;;
|
;;
|
||||||
sysv4*MP*)
|
sysv4*MP*)
|
||||||
;;
|
;;
|
||||||
sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
|
|
||||||
wl='-Wl,'
|
|
||||||
;;
|
|
||||||
unicos*)
|
unicos*)
|
||||||
wl='-Wl,'
|
wl='-Wl,'
|
||||||
;;
|
;;
|
||||||
|
@ -130,7 +121,7 @@ else
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Code taken from libtool.m4's _LT_LINKER_SHLIBS.
|
# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
|
||||||
|
|
||||||
hardcode_libdir_flag_spec=
|
hardcode_libdir_flag_spec=
|
||||||
hardcode_libdir_separator=
|
hardcode_libdir_separator=
|
||||||
|
@ -138,7 +129,7 @@ hardcode_direct=no
|
||||||
hardcode_minus_L=no
|
hardcode_minus_L=no
|
||||||
|
|
||||||
case "$host_os" in
|
case "$host_os" in
|
||||||
cygwin* | mingw* | pw32* | cegcc*)
|
cygwin* | mingw* | pw32*)
|
||||||
# FIXME: the MSVC++ port hasn't been tested in a loooong time
|
# FIXME: the MSVC++ port hasn't been tested in a loooong time
|
||||||
# When not using gcc, we currently assume that we are using
|
# When not using gcc, we currently assume that we are using
|
||||||
# Microsoft Visual C++.
|
# Microsoft Visual C++.
|
||||||
|
@ -164,7 +155,7 @@ if test "$with_gnu_ld" = yes; then
|
||||||
# option of GNU ld is called -rpath, not --rpath.
|
# option of GNU ld is called -rpath, not --rpath.
|
||||||
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
|
||||||
case "$host_os" in
|
case "$host_os" in
|
||||||
aix[3-9]*)
|
aix3* | aix4* | aix5*)
|
||||||
# On AIX/PPC, the GNU linker is very broken
|
# On AIX/PPC, the GNU linker is very broken
|
||||||
if test "$host_cpu" != ia64; then
|
if test "$host_cpu" != ia64; then
|
||||||
ld_shlibs=no
|
ld_shlibs=no
|
||||||
|
@ -188,7 +179,7 @@ if test "$with_gnu_ld" = yes; then
|
||||||
ld_shlibs=no
|
ld_shlibs=no
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
cygwin* | mingw* | pw32* | cegcc*)
|
cygwin* | mingw* | pw32*)
|
||||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||||
# no search path for DLLs.
|
# no search path for DLLs.
|
||||||
hardcode_libdir_flag_spec='-L$libdir'
|
hardcode_libdir_flag_spec='-L$libdir'
|
||||||
|
@ -198,11 +189,11 @@ if test "$with_gnu_ld" = yes; then
|
||||||
ld_shlibs=no
|
ld_shlibs=no
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
interix[3-9]*)
|
interix3*)
|
||||||
hardcode_direct=no
|
hardcode_direct=no
|
||||||
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||||
;;
|
;;
|
||||||
gnu* | linux* | k*bsd*-gnu)
|
linux*)
|
||||||
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
|
||||||
:
|
:
|
||||||
else
|
else
|
||||||
|
@ -260,7 +251,7 @@ else
|
||||||
hardcode_direct=unsupported
|
hardcode_direct=unsupported
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
aix[4-9]*)
|
aix4* | aix5*)
|
||||||
if test "$host_cpu" = ia64; then
|
if test "$host_cpu" = ia64; then
|
||||||
# On IA64, the linker does run time linking by default, so we don't
|
# On IA64, the linker does run time linking by default, so we don't
|
||||||
# have to do anything special.
|
# have to do anything special.
|
||||||
|
@ -270,7 +261,7 @@ else
|
||||||
# Test if we are trying to use run time linking or normal
|
# Test if we are trying to use run time linking or normal
|
||||||
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
|
# AIX style linking. If -brtl is somewhere in LDFLAGS, we
|
||||||
# need to do runtime linking.
|
# need to do runtime linking.
|
||||||
case $host_os in aix4.[23]|aix4.[23].*|aix[5-9]*)
|
case $host_os in aix4.[23]|aix4.[23].*|aix5*)
|
||||||
for ld_flag in $LDFLAGS; do
|
for ld_flag in $LDFLAGS; do
|
||||||
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
|
if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
|
||||||
aix_use_runtimelinking=yes
|
aix_use_runtimelinking=yes
|
||||||
|
@ -289,7 +280,7 @@ else
|
||||||
strings "$collect2name" | grep resolve_lib_name >/dev/null
|
strings "$collect2name" | grep resolve_lib_name >/dev/null
|
||||||
then
|
then
|
||||||
# We have reworked collect2
|
# We have reworked collect2
|
||||||
:
|
hardcode_direct=yes
|
||||||
else
|
else
|
||||||
# We have old collect2
|
# We have old collect2
|
||||||
hardcode_direct=unsupported
|
hardcode_direct=unsupported
|
||||||
|
@ -332,7 +323,7 @@ else
|
||||||
;;
|
;;
|
||||||
bsdi[45]*)
|
bsdi[45]*)
|
||||||
;;
|
;;
|
||||||
cygwin* | mingw* | pw32* | cegcc*)
|
cygwin* | mingw* | pw32*)
|
||||||
# When not using gcc, we currently assume that we are using
|
# When not using gcc, we currently assume that we are using
|
||||||
# Microsoft Visual C++.
|
# Microsoft Visual C++.
|
||||||
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
# hardcode_libdir_flag_spec is actually meaningless, as there is
|
||||||
|
@ -368,7 +359,7 @@ else
|
||||||
hardcode_direct=yes
|
hardcode_direct=yes
|
||||||
hardcode_minus_L=yes
|
hardcode_minus_L=yes
|
||||||
;;
|
;;
|
||||||
freebsd* | dragonfly*)
|
freebsd* | kfreebsd*-gnu | dragonfly*)
|
||||||
hardcode_libdir_flag_spec='-R$libdir'
|
hardcode_libdir_flag_spec='-R$libdir'
|
||||||
hardcode_direct=yes
|
hardcode_direct=yes
|
||||||
;;
|
;;
|
||||||
|
@ -421,7 +412,6 @@ else
|
||||||
hardcode_libdir_separator=:
|
hardcode_libdir_separator=:
|
||||||
;;
|
;;
|
||||||
openbsd*)
|
openbsd*)
|
||||||
if test -f /usr/libexec/ld.so; then
|
|
||||||
hardcode_direct=yes
|
hardcode_direct=yes
|
||||||
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
|
if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
|
||||||
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
|
||||||
|
@ -435,9 +425,6 @@ else
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
ld_shlibs=no
|
|
||||||
fi
|
|
||||||
;;
|
;;
|
||||||
os2*)
|
os2*)
|
||||||
hardcode_libdir_flag_spec='-L$libdir'
|
hardcode_libdir_flag_spec='-L$libdir'
|
||||||
|
@ -484,7 +471,7 @@ else
|
||||||
ld_shlibs=yes
|
ld_shlibs=yes
|
||||||
fi
|
fi
|
||||||
;;
|
;;
|
||||||
sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
|
sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*)
|
||||||
;;
|
;;
|
||||||
sysv5* | sco3.2v5* | sco5v6*)
|
sysv5* | sco3.2v5* | sco5v6*)
|
||||||
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
|
hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
|
||||||
|
@ -500,52 +487,34 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check dynamic linker characteristics
|
# Check dynamic linker characteristics
|
||||||
# Code taken from libtool.m4's _LT_SYS_DYNAMIC_LINKER.
|
# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
|
||||||
# Unlike libtool.m4, here we don't care about _all_ names of the library, but
|
|
||||||
# only about the one the linker finds when passed -lNAME. This is the last
|
|
||||||
# element of library_names_spec in libtool.m4, or possibly two of them if the
|
|
||||||
# linker has special search rules.
|
|
||||||
library_names_spec= # the last element of library_names_spec in libtool.m4
|
|
||||||
libname_spec='lib$name'
|
libname_spec='lib$name'
|
||||||
case "$host_os" in
|
case "$host_os" in
|
||||||
aix3*)
|
aix3*)
|
||||||
library_names_spec='$libname.a'
|
|
||||||
;;
|
;;
|
||||||
aix[4-9]*)
|
aix4* | aix5*)
|
||||||
library_names_spec='$libname$shrext'
|
|
||||||
;;
|
;;
|
||||||
amigaos*)
|
amigaos*)
|
||||||
library_names_spec='$libname.a'
|
|
||||||
;;
|
;;
|
||||||
beos*)
|
beos*)
|
||||||
library_names_spec='$libname$shrext'
|
|
||||||
;;
|
;;
|
||||||
bsdi[45]*)
|
bsdi[45]*)
|
||||||
library_names_spec='$libname$shrext'
|
|
||||||
;;
|
;;
|
||||||
cygwin* | mingw* | pw32* | cegcc*)
|
cygwin* | mingw* | pw32*)
|
||||||
shrext=.dll
|
shrext=.dll
|
||||||
library_names_spec='$libname.dll.a $libname.lib'
|
|
||||||
;;
|
;;
|
||||||
darwin* | rhapsody*)
|
darwin* | rhapsody*)
|
||||||
shrext=.dylib
|
shrext=.dylib
|
||||||
library_names_spec='$libname$shrext'
|
|
||||||
;;
|
;;
|
||||||
dgux*)
|
dgux*)
|
||||||
library_names_spec='$libname$shrext'
|
|
||||||
;;
|
;;
|
||||||
freebsd1*)
|
freebsd1*)
|
||||||
;;
|
;;
|
||||||
|
kfreebsd*-gnu)
|
||||||
|
;;
|
||||||
freebsd* | dragonfly*)
|
freebsd* | dragonfly*)
|
||||||
case "$host_os" in
|
|
||||||
freebsd[123]*)
|
|
||||||
library_names_spec='$libname$shrext$versuffix' ;;
|
|
||||||
*)
|
|
||||||
library_names_spec='$libname$shrext' ;;
|
|
||||||
esac
|
|
||||||
;;
|
;;
|
||||||
gnu*)
|
gnu*)
|
||||||
library_names_spec='$libname$shrext'
|
|
||||||
;;
|
;;
|
||||||
hpux9* | hpux10* | hpux11*)
|
hpux9* | hpux10* | hpux11*)
|
||||||
case $host_cpu in
|
case $host_cpu in
|
||||||
|
@ -559,13 +528,10 @@ case "$host_os" in
|
||||||
shrext=.sl
|
shrext=.sl
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
library_names_spec='$libname$shrext'
|
|
||||||
;;
|
;;
|
||||||
interix[3-9]*)
|
interix3*)
|
||||||
library_names_spec='$libname$shrext'
|
|
||||||
;;
|
;;
|
||||||
irix5* | irix6* | nonstopux*)
|
irix5* | irix6* | nonstopux*)
|
||||||
library_names_spec='$libname$shrext'
|
|
||||||
case "$host_os" in
|
case "$host_os" in
|
||||||
irix5* | nonstopux*)
|
irix5* | nonstopux*)
|
||||||
libsuff= shlibsuff=
|
libsuff= shlibsuff=
|
||||||
|
@ -582,59 +548,41 @@ case "$host_os" in
|
||||||
;;
|
;;
|
||||||
linux*oldld* | linux*aout* | linux*coff*)
|
linux*oldld* | linux*aout* | linux*coff*)
|
||||||
;;
|
;;
|
||||||
linux* | k*bsd*-gnu)
|
linux*)
|
||||||
library_names_spec='$libname$shrext'
|
|
||||||
;;
|
;;
|
||||||
knetbsd*-gnu)
|
knetbsd*-gnu)
|
||||||
library_names_spec='$libname$shrext'
|
|
||||||
;;
|
;;
|
||||||
netbsd*)
|
netbsd*)
|
||||||
library_names_spec='$libname$shrext'
|
|
||||||
;;
|
;;
|
||||||
newsos6)
|
newsos6)
|
||||||
library_names_spec='$libname$shrext'
|
|
||||||
;;
|
;;
|
||||||
nto-qnx*)
|
nto-qnx*)
|
||||||
library_names_spec='$libname$shrext'
|
|
||||||
;;
|
;;
|
||||||
openbsd*)
|
openbsd*)
|
||||||
library_names_spec='$libname$shrext$versuffix'
|
|
||||||
;;
|
;;
|
||||||
os2*)
|
os2*)
|
||||||
libname_spec='$name'
|
libname_spec='$name'
|
||||||
shrext=.dll
|
shrext=.dll
|
||||||
library_names_spec='$libname.a'
|
|
||||||
;;
|
;;
|
||||||
osf3* | osf4* | osf5*)
|
osf3* | osf4* | osf5*)
|
||||||
library_names_spec='$libname$shrext'
|
|
||||||
;;
|
|
||||||
rdos*)
|
|
||||||
;;
|
;;
|
||||||
solaris*)
|
solaris*)
|
||||||
library_names_spec='$libname$shrext'
|
|
||||||
;;
|
;;
|
||||||
sunos4*)
|
sunos4*)
|
||||||
library_names_spec='$libname$shrext$versuffix'
|
|
||||||
;;
|
;;
|
||||||
sysv4 | sysv4.3*)
|
sysv4 | sysv4.3*)
|
||||||
library_names_spec='$libname$shrext'
|
|
||||||
;;
|
;;
|
||||||
sysv4*MP*)
|
sysv4*MP*)
|
||||||
library_names_spec='$libname$shrext'
|
|
||||||
;;
|
;;
|
||||||
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
|
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
|
||||||
library_names_spec='$libname$shrext'
|
|
||||||
;;
|
;;
|
||||||
uts4*)
|
uts4*)
|
||||||
library_names_spec='$libname$shrext'
|
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
|
sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
|
||||||
escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||||
shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
|
shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
|
||||||
escaped_libname_spec=`echo "X$libname_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
|
||||||
escaped_library_names_spec=`echo "X$library_names_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
|
||||||
escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
|
||||||
|
|
||||||
LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
|
LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
|
||||||
|
@ -648,12 +596,6 @@ libext="$libext"
|
||||||
# Shared library suffix (normally "so").
|
# Shared library suffix (normally "so").
|
||||||
shlibext="$shlibext"
|
shlibext="$shlibext"
|
||||||
|
|
||||||
# Format of library name prefix.
|
|
||||||
libname_spec="$escaped_libname_spec"
|
|
||||||
|
|
||||||
# Library names that the linker finds when passed -lNAME.
|
|
||||||
library_names_spec="$escaped_library_names_spec"
|
|
||||||
|
|
||||||
# Flag to hardcode \$libdir into a binary during linking.
|
# Flag to hardcode \$libdir into a binary during linking.
|
||||||
# This must work even if \$libdir does not exist.
|
# This must work even if \$libdir does not exist.
|
||||||
hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
|
hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
|
109
build-aux/warn-on-use.h
Normal file
109
build-aux/warn-on-use.h
Normal file
|
@ -0,0 +1,109 @@
|
||||||
|
/* A C macro for emitting warnings if a function is used.
|
||||||
|
Copyright (C) 2010 Free Software Foundation, Inc.
|
||||||
|
|
||||||
|
This program 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.
|
||||||
|
|
||||||
|
This program 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
|
||||||
|
Lesser General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
|
/* _GL_WARN_ON_USE (function, "literal string") issues a declaration
|
||||||
|
for FUNCTION which will then trigger a compiler warning containing
|
||||||
|
the text of "literal string" anywhere that function is called, if
|
||||||
|
supported by the compiler. If the compiler does not support this
|
||||||
|
feature, the macro expands to an unused extern declaration.
|
||||||
|
|
||||||
|
This macro is useful for marking a function as a potential
|
||||||
|
portability trap, with the intent that "literal string" include
|
||||||
|
instructions on the replacement function that should be used
|
||||||
|
instead. However, one of the reasons that a function is a
|
||||||
|
portability trap is if it has the wrong signature. Declaring
|
||||||
|
FUNCTION with a different signature in C is a compilation error, so
|
||||||
|
this macro must use the same type as any existing declaration so
|
||||||
|
that programs that avoid the problematic FUNCTION do not fail to
|
||||||
|
compile merely because they included a header that poisoned the
|
||||||
|
function. But this implies that _GL_WARN_ON_USE is only safe to
|
||||||
|
use if FUNCTION is known to already have a declaration. Use of
|
||||||
|
this macro implies that there must not be any other macro hiding
|
||||||
|
the declaration of FUNCTION; but undefining FUNCTION first is part
|
||||||
|
of the poisoning process anyway (although for symbols that are
|
||||||
|
provided only via a macro, the result is a compilation error rather
|
||||||
|
than a warning containing "literal string"). Also note that in
|
||||||
|
C++, it is only safe to use if FUNCTION has no overloads.
|
||||||
|
|
||||||
|
For an example, it is possible to poison 'getline' by:
|
||||||
|
- adding a call to gl_WARN_ON_USE_PREPARE([[#include <stdio.h>]],
|
||||||
|
[getline]) in configure.ac, which potentially defines
|
||||||
|
HAVE_RAW_DECL_GETLINE
|
||||||
|
- adding this code to a header that wraps the system <stdio.h>:
|
||||||
|
#undef getline
|
||||||
|
#if HAVE_RAW_DECL_GETLINE
|
||||||
|
_GL_WARN_ON_USE (getline, "getline is required by POSIX 2008, but"
|
||||||
|
"not universally present; use the gnulib module getline");
|
||||||
|
#endif
|
||||||
|
|
||||||
|
It is not possible to directly poison global variables. But it is
|
||||||
|
possible to write a wrapper accessor function, and poison that
|
||||||
|
(less common usage, like &environ, will cause a compilation error
|
||||||
|
rather than issue the nice warning, but the end result of informing
|
||||||
|
the developer about their portability problem is still achieved):
|
||||||
|
#if HAVE_RAW_DECL_ENVIRON
|
||||||
|
static inline char ***rpl_environ (void) { return &environ; }
|
||||||
|
_GL_WARN_ON_USE (rpl_environ, "environ is not always properly declared");
|
||||||
|
# undef environ
|
||||||
|
# define environ (*rpl_environ ())
|
||||||
|
#endif
|
||||||
|
*/
|
||||||
|
#ifndef _GL_WARN_ON_USE
|
||||||
|
|
||||||
|
# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
|
||||||
|
/* A compiler attribute is available in gcc versions 4.3.0 and later. */
|
||||||
|
# define _GL_WARN_ON_USE(function, message) \
|
||||||
|
extern __typeof__ (function) function __attribute__ ((__warning__ (message)))
|
||||||
|
# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
|
||||||
|
/* Verify the existence of the function. */
|
||||||
|
# define _GL_WARN_ON_USE(function, message) \
|
||||||
|
extern __typeof__ (function) function
|
||||||
|
# else /* Unsupported. */
|
||||||
|
# define _GL_WARN_ON_USE(function, message) \
|
||||||
|
_GL_WARN_EXTERN_C int _gl_warn_on_use
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* _GL_WARN_ON_USE_CXX (function, rettype, parameters_and_attributes, "string")
|
||||||
|
is like _GL_WARN_ON_USE (function, "string"), except that the function is
|
||||||
|
declared with the given prototype, consisting of return type, parameters,
|
||||||
|
and attributes.
|
||||||
|
This variant is useful for overloaded functions in C++. _GL_WARN_ON_USE does
|
||||||
|
not work in this case. */
|
||||||
|
#ifndef _GL_WARN_ON_USE_CXX
|
||||||
|
# if 4 < __GNUC__ || (__GNUC__ == 4 && 3 <= __GNUC_MINOR__)
|
||||||
|
# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
|
||||||
|
extern rettype function parameters_and_attributes \
|
||||||
|
__attribute__ ((__warning__ (msg)))
|
||||||
|
# elif __GNUC__ >= 3 && GNULIB_STRICT_CHECKING
|
||||||
|
/* Verify the existence of the function. */
|
||||||
|
# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
|
||||||
|
extern rettype function parameters_and_attributes
|
||||||
|
# else /* Unsupported. */
|
||||||
|
# define _GL_WARN_ON_USE_CXX(function,rettype,parameters_and_attributes,msg) \
|
||||||
|
_GL_WARN_EXTERN_C int _gl_warn_on_use
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* _GL_WARN_EXTERN_C declaration;
|
||||||
|
performs the declaration with C linkage. */
|
||||||
|
#ifndef _GL_WARN_EXTERN_C
|
||||||
|
# if defined __cplusplus
|
||||||
|
# define _GL_WARN_EXTERN_C extern "C"
|
||||||
|
# else
|
||||||
|
# define _GL_WARN_EXTERN_C extern
|
||||||
|
# endif
|
||||||
|
#endif
|
|
@ -2,6 +2,10 @@
|
||||||
|
|
||||||
CFLAGS_PLATFORM=
|
CFLAGS_PLATFORM=
|
||||||
|
|
||||||
|
export LC_COLLATE := C
|
||||||
|
export LC_CTYPE := C
|
||||||
|
unexport LC_ALL
|
||||||
|
|
||||||
# Platform specific options
|
# Platform specific options
|
||||||
if COND_i386_pc
|
if COND_i386_pc
|
||||||
CFLAGS_PLATFORM += -mrtd -mregparm=3
|
CFLAGS_PLATFORM += -mrtd -mregparm=3
|
||||||
|
@ -21,13 +25,13 @@ endif
|
||||||
if COND_i386_ieee1275
|
if COND_i386_ieee1275
|
||||||
CFLAGS_PLATFORM += -mrtd -mregparm=3
|
CFLAGS_PLATFORM += -mrtd -mregparm=3
|
||||||
endif
|
endif
|
||||||
if COND_mips_yeeloong
|
if COND_mips_loongson
|
||||||
CFLAGS_PLATFORM += -march=mips3 -mexplicit-relocs
|
CFLAGS_PLATFORM += -mexplicit-relocs
|
||||||
CPPFLAGS_PLATFORM = -DUSE_ASCII_FAILBACK
|
CPPFLAGS_PLATFORM = -DUSE_ASCII_FAILBACK
|
||||||
CCASFLAGS_PLATFORM = -march=mips3
|
|
||||||
endif
|
endif
|
||||||
if COND_mips
|
if COND_mips
|
||||||
CFLAGS_PLATFORM += -mflush-func=grub_cpu_flush_cache
|
CFLAGS_PLATFORM += -mflush-func=grub_cpu_flush_cache
|
||||||
|
CCASFLAGS_PLATFORM = -march=mips3
|
||||||
endif
|
endif
|
||||||
if COND_sparc64_ieee1275
|
if COND_sparc64_ieee1275
|
||||||
CFLAGS_PLATFORM += -mno-app-regs
|
CFLAGS_PLATFORM += -mno-app-regs
|
||||||
|
@ -45,12 +49,33 @@ CPPFLAGS_DEFAULT += -I$(top_srcdir)/include
|
||||||
CPPFLAGS_DEFAULT += -I$(top_builddir)/include
|
CPPFLAGS_DEFAULT += -I$(top_builddir)/include
|
||||||
CCASFLAGS_DEFAULT = -DASM_FILE=1
|
CCASFLAGS_DEFAULT = -DASM_FILE=1
|
||||||
|
|
||||||
LDADD_KERNEL = -lgcc
|
LDADD_KERNEL =
|
||||||
|
|
||||||
|
if ! COND_i386_pc
|
||||||
|
if ! COND_i386_efi
|
||||||
|
if ! COND_i386_qemu
|
||||||
|
if ! COND_i386_coreboot
|
||||||
|
if ! COND_i386_multiboot
|
||||||
|
if ! COND_i386_ieee1275
|
||||||
|
if ! COND_x86_64_efi
|
||||||
|
LDADD_KERNEL += -lgcc
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
endif
|
||||||
|
|
||||||
CFLAGS_KERNEL = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding
|
CFLAGS_KERNEL = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding
|
||||||
LDFLAGS_KERNEL = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib -Wl,-N -static-libgcc
|
LDFLAGS_KERNEL = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib -Wl,-N -static-libgcc
|
||||||
CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
|
CPPFLAGS_KERNEL = $(CPPFLAGS_CPU) $(CPPFLAGS_PLATFORM)
|
||||||
CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
|
CCASFLAGS_KERNEL = $(CCASFLAGS_CPU) $(CCASFLAGS_PLATFORM)
|
||||||
|
if COND_CYGWIN
|
||||||
|
STRIPFLAGS_KERNEL = -F elf32-i386 -R .rel.dyn -R .reginfo -R .note -R .comment -R .drectve
|
||||||
|
else
|
||||||
STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment
|
STRIPFLAGS_KERNEL = -R .rel.dyn -R .reginfo -R .note -R .comment
|
||||||
|
endif
|
||||||
|
|
||||||
CFLAGS_MODULE = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding
|
CFLAGS_MODULE = $(CFLAGS_CPU) $(CFLAGS_PLATFORM) -ffreestanding
|
||||||
LDFLAGS_MODULE = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib -Wl,-N,-r,-d
|
LDFLAGS_MODULE = $(LDFLAGS_CPU) $(LDFLAGS_PLATFORM) -nostdlib -Wl,-N,-r,-d
|
||||||
|
@ -67,9 +92,9 @@ LDFLAGS_PROGRAM =
|
||||||
CPPFLAGS_PROGRAM =
|
CPPFLAGS_PROGRAM =
|
||||||
CCASFLAGS_PROGRAM =
|
CCASFLAGS_PROGRAM =
|
||||||
|
|
||||||
CFLAGS_LIBRARY = $(CFLAGS_PROGRAM)
|
CFLAGS_LIBRARY =
|
||||||
CPPFLAGS_LIBRARY = $(CPPFLAGS_PROGRAM)
|
CPPFLAGS_LIBRARY =
|
||||||
CCASFLAGS_LIBRARY = $(CCASFLAGS_PROGRAM)
|
CCASFLAGS_LIBRARY =
|
||||||
|
|
||||||
# Other variables
|
# Other variables
|
||||||
|
|
||||||
|
@ -80,28 +105,34 @@ platformdir = $(pkglibrootdir)/$(target_cpu)-$(platform)
|
||||||
CFLAGS_GCRY = -Wno-error -Wno-missing-field-initializers
|
CFLAGS_GCRY = -Wno-error -Wno-missing-field-initializers
|
||||||
CPPFLAGS_GCRY = -I$(top_srcdir)/grub-core/lib/libgcrypt_wrap
|
CPPFLAGS_GCRY = -I$(top_srcdir)/grub-core/lib/libgcrypt_wrap
|
||||||
|
|
||||||
CFLAGS_GNULIB = -Wno-undef -Wno-sign-compare -Wno-unused -D_GL_UNUSED="__attribute__ ((unused))"
|
CFLAGS_GNULIB = -Wno-undef -Wno-sign-compare -Wno-unused -Wno-unused-parameter
|
||||||
CPPFLAGS_GNULIB = -I$(top_srcdir)/grub-core/gnulib
|
CPPFLAGS_GNULIB = -I$(top_builddir)/grub-core/gnulib -I$(top_srcdir)/grub-core/gnulib
|
||||||
|
|
||||||
CFLAGS_POSIX = -fno-builtin
|
CFLAGS_POSIX = -fno-builtin
|
||||||
CPPFLAGS_POSIX = -I$(top_srcdir)/grub-core/lib/posix_wrap
|
CPPFLAGS_POSIX = -I$(top_srcdir)/grub-core/lib/posix_wrap
|
||||||
|
|
||||||
CPPFLAGS_EFIEMU = -I$(top_srcdir)/grub-core/efiemu/runtime
|
CPPFLAGS_EFIEMU = -I$(top_srcdir)/grub-core/efiemu/runtime
|
||||||
|
|
||||||
|
# List file macros for recognizing /interesting/ modules
|
||||||
|
CPPFLAGS_FS_LIST = -Dgrub_fs_register=FS_LIST_MARKER
|
||||||
|
CPPFLAGS_VIDEO_LIST= -Dgrub_video_register=VIDEO_LIST_MARKER
|
||||||
|
CPPFLAGS_PARTMAP_LIST = -Dgrub_partition_map_register=PARTMAP_LIST_MARKER
|
||||||
|
CPPFLAGS_PARTTOOL_LIST = -Dgrub_parttool_register=PARTTOOL_LIST_MARKER
|
||||||
|
CPPFLAGS_TERMINAL_LIST = '-Dgrub_term_register_input(...)=INPUT_TERMINAL_LIST_MARKER(__VA_ARGS__)'
|
||||||
|
CPPFLAGS_TERMINAL_LIST += '-Dgrub_term_register_output(...)=OUTPUT_TERMINAL_LIST_MARKER(__VA_ARGS__)'
|
||||||
|
CPPFLAGS_COMMAND_LIST = '-Dgrub_register_command(...)=COMMAND_LIST_MARKER(__VA_ARGS__)'
|
||||||
|
CPPFLAGS_COMMAND_LIST += '-Dgrub_register_extcmd(...)=EXTCOMMAND_LIST_MARKER(__VA_ARGS__)'
|
||||||
|
CPPFLAGS_COMMAND_LIST += '-Dgrub_register_command_p1(...)=P1COMMAND_LIST_MARKER(__VA_ARGS__)'
|
||||||
|
CPPFLAGS_MARKER = $(CPPFLAGS_FS_LIST) $(CPPFLAGS_VIDEO_LIST) \
|
||||||
|
$(CPPFLAGS_PARTTOOL_LIST) $(CPPFLAGS_PARTMAP_LIST) \
|
||||||
|
$(CPPFLAGS_TERMINAL_LIST) $(CPPFLAGS_COMMAND_LIST)
|
||||||
|
|
||||||
# Define these variables to calm down automake
|
# Define these variables to calm down automake
|
||||||
|
|
||||||
FS_FILES =
|
|
||||||
DEF_FILES =
|
|
||||||
UND_FILES =
|
|
||||||
IMG_FILES =
|
IMG_FILES =
|
||||||
MOD_FILES =
|
MOD_FILES =
|
||||||
VIDEO_FILES =
|
|
||||||
MODULE_FILES =
|
MODULE_FILES =
|
||||||
HANDLER_FILES =
|
MARKER_FILES =
|
||||||
PARTMAP_FILES =
|
|
||||||
COMMAND_FILES =
|
|
||||||
PARTTOOL_FILES =
|
|
||||||
TERMINAL_FILES =
|
|
||||||
KERNEL_HEADER_FILES =
|
KERNEL_HEADER_FILES =
|
||||||
|
|
||||||
man_MANS =
|
man_MANS =
|
||||||
|
@ -140,11 +171,7 @@ $(top_srcdir)/Makefile.util.am: $(top_srcdir)/Makefile.util.def $(top_srcdir)/Ma
|
||||||
mv $@.new $@
|
mv $@.new $@
|
||||||
|
|
||||||
.PRECIOUS: $(top_srcdir)/grub-core/Makefile.core.am
|
.PRECIOUS: $(top_srcdir)/grub-core/Makefile.core.am
|
||||||
$(top_srcdir)/grub-core/Makefile.core.am: $(top_srcdir)/grub-core/Makefile.core.def $(top_srcdir)/Makefile.tpl
|
$(top_srcdir)/grub-core/Makefile.core.am: $(top_srcdir)/grub-core/Makefile.core.def $(top_srcdir)/grub-core/Makefile.gcry.def $(top_srcdir)/Makefile.tpl
|
||||||
autogen -T $(top_srcdir)/Makefile.tpl $< | sed -e '/^$$/{N;/^\\n$$/D;}' > $@.new || (rm -f $@.new; exit 1)
|
if [ "x$$GRUB_CONTRIB" != x ]; then echo "You need to run ./autogen.sh manually." >&2; exit 1; fi
|
||||||
mv $@.new $@
|
autogen -T $(top_srcdir)/Makefile.tpl $(top_srcdir)/grub-core/Makefile.core.def $(top_srcdir)/grub-core/Makefile.gcry.def | sed -e '/^$$/{N;/^\\n$$/D;}' > $@.new || (rm -f $@.new; exit 1)
|
||||||
|
|
||||||
.PRECIOUS: $(top_srcdir)/grub-core/Makefile.gcry.am
|
|
||||||
$(top_srcdir)/grub-core/Makefile.gcry.am: $(top_srcdir)/grub-core/Makefile.gcry.def $(top_srcdir)/Makefile.tpl
|
|
||||||
autogen -T $(top_srcdir)/Makefile.tpl $< | sed -e '/^$$/{N;/^\\n$$/D;}' > $@.new || (rm -f $@.new; exit 1)
|
|
||||||
mv $@.new $@
|
mv $@.new $@
|
||||||
|
|
|
@ -19,20 +19,16 @@ EXTRA_DIST += grub-core/Makefile.core.def
|
||||||
EXTRA_DIST += grub-core/Makefile.gcry.def
|
EXTRA_DIST += grub-core/Makefile.gcry.def
|
||||||
|
|
||||||
EXTRA_DIST += grub-core/genmoddep.awk
|
EXTRA_DIST += grub-core/genmoddep.awk
|
||||||
EXTRA_DIST += grub-core/genmodsrc.sh
|
EXTRA_DIST += grub-core/genmod.sh.in
|
||||||
EXTRA_DIST += grub-core/genfslist.sh
|
EXTRA_DIST += grub-core/gensyminfo.sh.in
|
||||||
EXTRA_DIST += grub-core/gencmdlist.sh
|
|
||||||
EXTRA_DIST += grub-core/gensymlist.sh
|
EXTRA_DIST += grub-core/gensymlist.sh
|
||||||
EXTRA_DIST += grub-core/genemuinit.sh
|
EXTRA_DIST += grub-core/genemuinit.sh
|
||||||
EXTRA_DIST += grub-core/genvideolist.sh
|
|
||||||
EXTRA_DIST += grub-core/genhandlerlist.sh
|
|
||||||
EXTRA_DIST += grub-core/genpartmaplist.sh
|
|
||||||
EXTRA_DIST += grub-core/genterminallist.sh
|
|
||||||
EXTRA_DIST += grub-core/genparttoollist.sh
|
|
||||||
EXTRA_DIST += grub-core/genemuinitheader.sh
|
EXTRA_DIST += grub-core/genemuinitheader.sh
|
||||||
|
|
||||||
EXTRA_DIST += grub-core/lib/libgcrypt/cipher
|
EXTRA_DIST += grub-core/lib/libgcrypt/cipher
|
||||||
EXTRA_DIST += $(shell find $(top_srcdir)/include -name '*.h')
|
EXTRA_DIST += $(shell find $(top_srcdir)/include -name '*.h')
|
||||||
|
EXTRA_DIST += $(shell find $(top_srcdir)/grub-core/lib -name '*.h')
|
||||||
EXTRA_DIST += $(shell find $(top_srcdir)/grub-core/gnulib -name '*.h')
|
EXTRA_DIST += $(shell find $(top_srcdir)/grub-core/gnulib -name '*.h')
|
||||||
EXTRA_DIST += $(shell find $(top_srcdir)/grub-core/efiemu -name '*.h')
|
EXTRA_DIST += $(shell find $(top_srcdir)/grub-core/efiemu -name '*.h')
|
||||||
EXTRA_DIST += $(shell find $(top_srcdir)/grub-core/lib -name '*.h')
|
|
||||||
|
EXTRA_DIST += m4/gnulib-cache.m4
|
||||||
|
|
|
@ -13,15 +13,9 @@ SECTIONS
|
||||||
__data_start__ = . ;
|
__data_start__ = . ;
|
||||||
*(.data)
|
*(.data)
|
||||||
__data_end__ = . ;
|
__data_end__ = . ;
|
||||||
}
|
|
||||||
.rdata :
|
|
||||||
{
|
|
||||||
__rdata_start__ = . ;
|
__rdata_start__ = . ;
|
||||||
*(.rdata)
|
*(.rdata)
|
||||||
__rdata_end__ = . ;
|
__rdata_end__ = . ;
|
||||||
}
|
|
||||||
.pdata :
|
|
||||||
{
|
|
||||||
*(.pdata)
|
*(.pdata)
|
||||||
edata = . ;
|
edata = . ;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
# -*- makefile -*-
|
|
||||||
LINK_BASE = 0x80010000
|
|
||||||
target_machine=qemu-mips
|
|
||||||
COMMON_CFLAGS += -march=mips3
|
|
||||||
COMMON_ASFLAGS += -march=mips3
|
|
||||||
include $(srcdir)/conf/mips.mk
|
|
||||||
|
|
||||||
pkglib_PROGRAMS = kernel.img
|
|
||||||
kernel_img_SOURCES = kern/$(target_cpu)/startup.S \
|
|
||||||
kern/main.c kern/device.c kern/$(target_cpu)/init.c \
|
|
||||||
kern/$(target_cpu)/$(target_machine)/init.c \
|
|
||||||
kern/disk.c kern/dl.c kern/err.c kern/file.c kern/fs.c \
|
|
||||||
kern/misc.c kern/mm.c kern/term.c \
|
|
||||||
kern/rescue_parser.c kern/rescue_reader.c \
|
|
||||||
kern/list.c kern/command.c kern/corecmd.c \
|
|
||||||
kern/parser.c kern/partition.c kern/env.c kern/$(target_cpu)/dl.c \
|
|
||||||
kern/generic/millisleep.c kern/generic/rtc_get_time_ms.c kern/time.c \
|
|
||||||
symlist.c kern/$(target_cpu)/cache.S
|
|
||||||
kernel_img_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
kernel_img_ASFLAGS = $(COMMON_ASFLAGS)
|
|
||||||
kernel_img_LDFLAGS = $(COMMON_LDFLAGS) -Wl,-N,-S,-Ttext,$(LINK_BASE),-Bstatic
|
|
||||||
kernel_img_FORMAT = binary
|
|
||||||
|
|
||||||
# For serial.mod.
|
|
||||||
pkglib_MODULES += serial.mod
|
|
||||||
serial_mod_SOURCES = term/serial.c
|
|
||||||
serial_mod_CFLAGS = $(COMMON_CFLAGS)
|
|
||||||
serial_mod_LDFLAGS = $(COMMON_LDFLAGS)
|
|
48
config.h.in
Normal file
48
config.h.in
Normal file
|
@ -0,0 +1,48 @@
|
||||||
|
#undef _LARGEFILE_SOURCE
|
||||||
|
#undef _FILE_OFFSET_BITS
|
||||||
|
#define _LARGEFILE_SOURCE
|
||||||
|
#define _FILE_OFFSET_BITS 64
|
||||||
|
#if defined (GRUB_UTIL) || !defined (GRUB_MACHINE)
|
||||||
|
#include <config-util.h>
|
||||||
|
#define NESTED_FUNC_ATTR
|
||||||
|
#else
|
||||||
|
/* Define if C symbols get an underscore after compilation. */
|
||||||
|
#define HAVE_ASM_USCORE @HAVE_ASM_USCORE@
|
||||||
|
/* Define it to \"addr32\" or \"addr32;\" to make GAS happy. */
|
||||||
|
#define ADDR32 @ADDR32@
|
||||||
|
/* Define it to \"data32\" or \"data32;\" to make GAS happy. */
|
||||||
|
#define DATA32 @DATA32@
|
||||||
|
/* Define it to one of __bss_start, edata and _edata. */
|
||||||
|
#define BSS_START_SYMBOL @BSS_START_SYMBOL@
|
||||||
|
/* Define it to either end or _end. */
|
||||||
|
#define END_SYMBOL @END_SYMBOL@
|
||||||
|
/* Name of package. */
|
||||||
|
#define PACKAGE "@PACKAGE@"
|
||||||
|
/* Version number of package. */
|
||||||
|
#define VERSION "@VERSION@"
|
||||||
|
/* Define to the full name and version of this package. */
|
||||||
|
#define PACKAGE_STRING "@PACKAGE_STRING@"
|
||||||
|
/* Define to the version of this package. */
|
||||||
|
#define PACKAGE_VERSION "@PACKAGE_VERSION@"
|
||||||
|
/* Define to the full name of this package. */
|
||||||
|
#define PACKAGE_NAME "@PACKAGE_NAME@"
|
||||||
|
/* Define to the address where bug reports for this package should be sent. */
|
||||||
|
#define PACKAGE_BUGREPORT "@PACKAGE_BUGREPORT@"
|
||||||
|
/* Default boot directory name" */
|
||||||
|
#define GRUB_BOOT_DIR_NAME "@bootdirname@"
|
||||||
|
/* Default grub directory name */
|
||||||
|
#define GRUB_DIR_NAME "@grubdirname@"
|
||||||
|
/* Define to 1 if GCC generates calls to __enable_execute_stack(). */
|
||||||
|
#define NEED_ENABLE_EXECUTE_STACK @NEED_ENABLE_EXECUTE_STACK@
|
||||||
|
/* Define to 1 if GCC generates calls to __register_frame_info(). */
|
||||||
|
#define NEED_REGISTER_FRAME_INFO @NEED_REGISTER_FRAME_INFO@
|
||||||
|
/* Define to 1 to enable disk cache statistics. */
|
||||||
|
#define DISK_CACHE_STATS @DISK_CACHE_STATS@
|
||||||
|
|
||||||
|
#if defined(__i386__)
|
||||||
|
#define NESTED_FUNC_ATTR __attribute__ ((__regparm__ (1)))
|
||||||
|
#else
|
||||||
|
#define NESTED_FUNC_ATTR
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
234
configure.ac
234
configure.ac
|
@ -32,7 +32,9 @@ dnl type, so there is no conflict. Variables with the prefix "TARGET_"
|
||||||
dnl (such as TARGET_CC, TARGET_CFLAGS, etc.) are used for the target
|
dnl (such as TARGET_CC, TARGET_CFLAGS, etc.) are used for the target
|
||||||
dnl type.
|
dnl type.
|
||||||
|
|
||||||
AC_INIT([GRUB],[1.98],[bug-grub@gnu.org])
|
AC_INIT([GRUB],[1.99],[bug-grub@gnu.org])
|
||||||
|
|
||||||
|
AC_CONFIG_AUX_DIR([build-aux])
|
||||||
|
|
||||||
# We don't want -g -O2 by default in CFLAGS
|
# We don't want -g -O2 by default in CFLAGS
|
||||||
: ${CFLAGS=""}
|
: ${CFLAGS=""}
|
||||||
|
@ -44,7 +46,7 @@ AC_CANONICAL_TARGET
|
||||||
AM_INIT_AUTOMAKE()
|
AM_INIT_AUTOMAKE()
|
||||||
AC_PREREQ(2.60)
|
AC_PREREQ(2.60)
|
||||||
AC_CONFIG_SRCDIR([include/grub/dl.h])
|
AC_CONFIG_SRCDIR([include/grub/dl.h])
|
||||||
AC_CONFIG_HEADER([config.h])
|
AC_CONFIG_HEADER([config-util.h])
|
||||||
|
|
||||||
# Program name transformations
|
# Program name transformations
|
||||||
AC_ARG_PROGRAM
|
AC_ARG_PROGRAM
|
||||||
|
@ -70,7 +72,7 @@ case "$target_cpu" in
|
||||||
amd64) target_cpu=x86_64 ;;
|
amd64) target_cpu=x86_64 ;;
|
||||||
sparc) target_cpu=sparc64 ;;
|
sparc) target_cpu=sparc64 ;;
|
||||||
mipsel|mips64el)
|
mipsel|mips64el)
|
||||||
target_cpu=mips;
|
target_cpu=mipsel;
|
||||||
machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPSEL=1";
|
machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_CPU_MIPSEL=1";
|
||||||
;;
|
;;
|
||||||
mips|mips64)
|
mips|mips64)
|
||||||
|
@ -94,22 +96,21 @@ if test "x$with_platform" = x; then
|
||||||
powerpc-*) platform=ieee1275 ;;
|
powerpc-*) platform=ieee1275 ;;
|
||||||
powerpc64-*) platform=ieee1275 ;;
|
powerpc64-*) platform=ieee1275 ;;
|
||||||
sparc64-*) platform=ieee1275 ;;
|
sparc64-*) platform=ieee1275 ;;
|
||||||
mips-*) platform=yeeloong ;;
|
mipsel-*) platform=loongson ;;
|
||||||
|
mips-*) platform=arc ;;
|
||||||
|
ia64-*) platform=efi ;;
|
||||||
*) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;;
|
*) AC_MSG_ERROR([unsupported CPU: "$target_cpu"]) ;;
|
||||||
esac
|
esac
|
||||||
else
|
else
|
||||||
platform="$with_platform"
|
platform="$with_platform"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Adjust CPU unless target was explicitly specified.
|
|
||||||
if test -z "$target_alias"; then
|
|
||||||
case "$target_cpu"-"$platform" in
|
case "$target_cpu"-"$platform" in
|
||||||
x86_64-efi) ;;
|
x86_64-efi) ;;
|
||||||
x86_64-emu) ;;
|
x86_64-emu) ;;
|
||||||
x86_64-*) target_cpu=i386 ;;
|
x86_64-*) target_cpu=i386 ;;
|
||||||
powerpc64-ieee1275) target_cpu=powerpc ;;
|
powerpc64-ieee1275) target_cpu=powerpc ;;
|
||||||
esac
|
esac
|
||||||
fi
|
|
||||||
|
|
||||||
# Check if the platform is supported, make final adjustments.
|
# Check if the platform is supported, make final adjustments.
|
||||||
case "$target_cpu"-"$platform" in
|
case "$target_cpu"-"$platform" in
|
||||||
|
@ -123,8 +124,15 @@ case "$target_cpu"-"$platform" in
|
||||||
i386-qemu) ;;
|
i386-qemu) ;;
|
||||||
powerpc-ieee1275) ;;
|
powerpc-ieee1275) ;;
|
||||||
sparc64-ieee1275) ;;
|
sparc64-ieee1275) ;;
|
||||||
mips-qemu-mips) ;;
|
ia64-efi) ;;
|
||||||
mips-yeeloong) ;;
|
mips-qemu_mips) ;;
|
||||||
|
mips-qemu-mips) platform=qemu_mips;;
|
||||||
|
mips-arc) ;;
|
||||||
|
mipsel-qemu_mips) ;;
|
||||||
|
mipsel-qemu-mips) platform=qemu_mips;;
|
||||||
|
mipsel-yeeloong) platform=loongson ;;
|
||||||
|
mipsel-fuloong) platform=loongson ;;
|
||||||
|
mipsel-loongson) ;;
|
||||||
*-emu) ;;
|
*-emu) ;;
|
||||||
*) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
|
*) AC_MSG_ERROR([platform "$platform" is not supported for target CPU "$target_cpu"]) ;;
|
||||||
esac
|
esac
|
||||||
|
@ -146,6 +154,7 @@ case "$host_os" in
|
||||||
linux*) host_kernel=linux ;;
|
linux*) host_kernel=linux ;;
|
||||||
freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;;
|
freebsd* | kfreebsd*-gnu) host_kernel=kfreebsd ;;
|
||||||
netbsd*) host_kernel=netbsd ;;
|
netbsd*) host_kernel=netbsd ;;
|
||||||
|
solaris*) host_kernel=illumos ;;
|
||||||
cygwin) host_kernel=windows ;;
|
cygwin) host_kernel=windows ;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
|
@ -157,14 +166,19 @@ case "$platform" in
|
||||||
qemu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_QEMU=1" ;;
|
qemu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_QEMU=1" ;;
|
||||||
pc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_PCBIOS=1" ;;
|
pc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_PCBIOS=1" ;;
|
||||||
emu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EMU=1" ;;
|
emu) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_EMU=1" ;;
|
||||||
yeeloong) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_YEELOONG=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
|
loongson) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_LOONGSON=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
|
||||||
qemu-mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
|
qemu_mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS_QEMU_MIPS=1 -DGRUB_MACHINE_MIPS_BONITO=1" ;;
|
||||||
|
arc) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_ARC=1" ;;
|
||||||
esac
|
esac
|
||||||
case "$target_cpu" in
|
case "$target_cpu" in
|
||||||
mips) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS=1" ;;
|
mips |mipsel) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_MIPS=1" ;;
|
||||||
sparc64) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_SPARC64=1" ;;
|
sparc64) machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE_SPARC64=1" ;;
|
||||||
esac
|
esac
|
||||||
machine_CPPFLAGS="$machine_CPPFLAGS -DMACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
|
if test x${target_cpu} = xmipsel ; then
|
||||||
|
machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo mips_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
|
||||||
|
else
|
||||||
|
machine_CPPFLAGS="$machine_CPPFLAGS -DGRUB_MACHINE=`echo ${target_cpu}_$platform | sed y,abcdefghijklmnopqrstuvwxyz,ABCDEFGHIJKLMNOPQRSTUVWXYZ,`"
|
||||||
|
fi
|
||||||
|
|
||||||
HOST_CPPFLAGS="$HOST_CPPFLAGS $machine_CPPFLAGS"
|
HOST_CPPFLAGS="$HOST_CPPFLAGS $machine_CPPFLAGS"
|
||||||
TARGET_CPPFLAGS="$TARGET_CPPFLAGS $machine_CPPFLAGS"
|
TARGET_CPPFLAGS="$TARGET_CPPFLAGS $machine_CPPFLAGS"
|
||||||
|
@ -185,9 +199,13 @@ case "$host_os" in
|
||||||
esac
|
esac
|
||||||
bootdirname=`echo "$bootdirname" | sed "$program_transform_name"`
|
bootdirname=`echo "$bootdirname" | sed "$program_transform_name"`
|
||||||
AC_SUBST(bootdirname)
|
AC_SUBST(bootdirname)
|
||||||
|
AC_DEFINE_UNQUOTED(GRUB_BOOT_DIR_NAME, "$bootdirname",
|
||||||
|
[Default boot directory name]")
|
||||||
|
|
||||||
grubdirname=`echo "$PACKAGE" | sed "$program_transform_name"`
|
grubdirname=`echo "$PACKAGE" | sed "$program_transform_name"`
|
||||||
AC_SUBST(grubdirname)
|
AC_SUBST(grubdirname)
|
||||||
|
AC_DEFINE_UNQUOTED(GRUB_DIR_NAME, "$grubdirname",
|
||||||
|
[Default grub directory name])
|
||||||
|
|
||||||
#
|
#
|
||||||
# Checks for build programs.
|
# Checks for build programs.
|
||||||
|
@ -216,8 +234,8 @@ for ext in pcf pcf.gz bdf bdf.gz ttf ttf.gz; do
|
||||||
done
|
done
|
||||||
done
|
done
|
||||||
|
|
||||||
if test "x$FONT_SOURCE" = x && ( test "x$platform" = xqemu || test "x$platform" = xyeeloong ); then
|
if test "x$FONT_SOURCE" = x && ( test "x$platform" = xqemu || test "x$platform" = xloongson ); then
|
||||||
AC_MSG_ERROR([qemu and yeeloong ports need unifont])
|
AC_MSG_ERROR([qemu and loongson ports need unifont])
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_SUBST([FONT_SOURCE])
|
AC_SUBST([FONT_SOURCE])
|
||||||
|
@ -229,6 +247,7 @@ AC_PROG_LEX
|
||||||
AC_PROG_YACC
|
AC_PROG_YACC
|
||||||
AC_PROG_MAKE_SET
|
AC_PROG_MAKE_SET
|
||||||
AC_PROG_MKDIR_P
|
AC_PROG_MKDIR_P
|
||||||
|
AC_PROG_LN_S
|
||||||
|
|
||||||
if test "x$LEX" = "x:"; then
|
if test "x$LEX" = "x:"; then
|
||||||
AC_MSG_ERROR([flex is not found])
|
AC_MSG_ERROR([flex is not found])
|
||||||
|
@ -242,13 +261,14 @@ else
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# These are not a "must".
|
# These are not a "must".
|
||||||
AC_PATH_PROG(MAKEINFO, makeinfo)
|
AC_PATH_PROGS(MAKEINFO, makeinfo true)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Checks for host programs.
|
# Checks for host programs.
|
||||||
#
|
#
|
||||||
|
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
|
gl_EARLY
|
||||||
AM_PROG_CC_C_O
|
AM_PROG_CC_C_O
|
||||||
AM_PROG_AS
|
AM_PROG_AS
|
||||||
|
|
||||||
|
@ -309,6 +329,9 @@ HOST_CC=$CC
|
||||||
AC_CHECK_PROGS(BUILD_CC, [gcc egcs cc],
|
AC_CHECK_PROGS(BUILD_CC, [gcc egcs cc],
|
||||||
[AC_MSG_ERROR([none of gcc, egcs and cc is found. set BUILD_CC manually.])])
|
[AC_MSG_ERROR([none of gcc, egcs and cc is found. set BUILD_CC manually.])])
|
||||||
|
|
||||||
|
# For gnulib.
|
||||||
|
gl_INIT
|
||||||
|
|
||||||
#
|
#
|
||||||
# Check for target programs.
|
# Check for target programs.
|
||||||
#
|
#
|
||||||
|
@ -390,6 +413,23 @@ if test "x$grub_cv_cc_fno_dwarf2_cfi_asm" = xyes; then
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
|
TARGET_CFLAGS="$TARGET_CFLAGS -fno-dwarf2-cfi-asm"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# By default, GCC 4.6 generates .eh_frame sections containing unwind
|
||||||
|
# information in some cases where it previously did not. GRUB doesn't need
|
||||||
|
# these and they just use up vital space. Restore the old compiler
|
||||||
|
# behaviour.
|
||||||
|
AC_CACHE_CHECK([whether -fno-asynchronous-unwind-tables works], [grub_cv_cc_fno_asynchronous_unwind_tables], [
|
||||||
|
SAVE_CFLAGS="$CFLAGS"
|
||||||
|
CFLAGS="$CFLAGS -fno-dwarf2-cfi-asm"
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[]], [[]])],
|
||||||
|
[grub_cv_cc_fno_asynchronous_unwind_tables=yes],
|
||||||
|
[grub_cv_cc_fno_asynchronous_unwind_tables=no])
|
||||||
|
CFLAGS="$SAVE_CFLAGS"
|
||||||
|
])
|
||||||
|
|
||||||
|
if test "x$grub_cv_cc_fno_asynchronous_unwind_tables" = xyes; then
|
||||||
|
TARGET_CFLAGS="$TARGET_CFLAGS -fno-asynchronous-unwind-tables"
|
||||||
|
fi
|
||||||
|
|
||||||
grub_apple_target_cc
|
grub_apple_target_cc
|
||||||
if test x$grub_cv_apple_target_cc = xyes ; then
|
if test x$grub_cv_apple_target_cc = xyes ; then
|
||||||
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -DAPPLE_CC=1"
|
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -DAPPLE_CC=1"
|
||||||
|
@ -429,12 +469,11 @@ fi
|
||||||
# For platforms where ELF is not the default link format.
|
# For platforms where ELF is not the default link format.
|
||||||
AC_MSG_CHECKING([for command to convert module to ELF format])
|
AC_MSG_CHECKING([for command to convert module to ELF format])
|
||||||
case "${host_os}" in
|
case "${host_os}" in
|
||||||
cygwin) TARGET_OBJ2ELF='$(grub_utildir)/grub-pe2elf';
|
cygwin) TARGET_OBJ2ELF='$(top_builddir)/grub-pe2elf';
|
||||||
# FIXME: put proper test here
|
# FIXME: put proper test here
|
||||||
AC_DEFINE([NEED_REGISTER_FRAME_INFO], 1,
|
NEED_REGISTER_FRAME_INFO=1
|
||||||
[Define to 1 if GCC generates calls to __register_frame_info()])
|
|
||||||
;;
|
;;
|
||||||
*) ;;
|
*) NEED_REGISTER_FRAME_INFO=0 ;;
|
||||||
esac
|
esac
|
||||||
AC_MSG_RESULT([$TARGET_OBJ2ELF])
|
AC_MSG_RESULT([$TARGET_OBJ2ELF])
|
||||||
|
|
||||||
|
@ -442,6 +481,7 @@ if test "x$target_m32" = x1; then
|
||||||
# Force 32-bit mode.
|
# Force 32-bit mode.
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS -m32"
|
TARGET_CFLAGS="$TARGET_CFLAGS -m32"
|
||||||
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m32"
|
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m32"
|
||||||
|
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m32"
|
||||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
|
TARGET_LDFLAGS="$TARGET_LDFLAGS -m32"
|
||||||
TARGET_MODULE_FORMAT="elf32"
|
TARGET_MODULE_FORMAT="elf32"
|
||||||
fi
|
fi
|
||||||
|
@ -450,6 +490,7 @@ if test "x$target_m64" = x1; then
|
||||||
# Force 64-bit mode.
|
# Force 64-bit mode.
|
||||||
TARGET_CFLAGS="$TARGET_CFLAGS -m64"
|
TARGET_CFLAGS="$TARGET_CFLAGS -m64"
|
||||||
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m64"
|
TARGET_CCASFLAGS="$TARGET_CCASFLAGS -m64"
|
||||||
|
TARGET_CPPFLAGS="$TARGET_CPPFLAGS -m64"
|
||||||
TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
|
TARGET_LDFLAGS="$TARGET_LDFLAGS -m64"
|
||||||
TARGET_MODULE_FORMAT="elf64"
|
TARGET_MODULE_FORMAT="elf64"
|
||||||
fi
|
fi
|
||||||
|
@ -552,8 +593,11 @@ else
|
||||||
CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100 -Wno-error"
|
CFLAGS="$TARGET_CFLAGS -nostdlib -Wl,--defsym,___main=0x8100 -Wno-error"
|
||||||
fi
|
fi
|
||||||
CPPFLAGS="$TARGET_CPPFLAGS"
|
CPPFLAGS="$TARGET_CPPFLAGS"
|
||||||
LDFLAGS="$TARGET_LDFLAGS"
|
if test x$target_cpu = xi386 || test x$target_cpu = xx86_64 ; then
|
||||||
|
LIBS=
|
||||||
|
else
|
||||||
LIBS=-lgcc
|
LIBS=-lgcc
|
||||||
|
fi
|
||||||
|
|
||||||
grub_ASM_USCORE
|
grub_ASM_USCORE
|
||||||
if test x$grub_cv_asm_uscore = xyes; then
|
if test x$grub_cv_asm_uscore = xyes; then
|
||||||
|
@ -563,7 +607,7 @@ CFLAGS="$CFLAGS -Wl,--defsym,abort=main"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Check for libgcc symbols
|
# Check for libgcc symbols
|
||||||
AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __trampoline_setup __ucmpdi2 _restgpr_14_x)
|
AC_CHECK_FUNCS(__bswapsi2 __bswapdi2 __ashldi3 __ashrdi3 __lshrdi3 __trampoline_setup __ucmpdi2 _restgpr_14_x __ia64_trampoline __udivsi3 __umoddi3 __udivdi3 __divsi3 __modsi3 __umodsi3 __moddi3 __divdi3 __ctzdi2 __ctzsi2)
|
||||||
|
|
||||||
if test "x$TARGET_APPLE_CC" = x1 ; then
|
if test "x$TARGET_APPLE_CC" = x1 ; then
|
||||||
CFLAGS="$TARGET_CFLAGS -nostdlib"
|
CFLAGS="$TARGET_CFLAGS -nostdlib"
|
||||||
|
@ -590,17 +634,8 @@ if test "x$target_cpu" = xi386; then
|
||||||
CFLAGS="$TARGET_CFLAGS"
|
CFLAGS="$TARGET_CFLAGS"
|
||||||
grub_I386_ASM_PREFIX_REQUIREMENT
|
grub_I386_ASM_PREFIX_REQUIREMENT
|
||||||
grub_I386_ASM_ADDR32
|
grub_I386_ASM_ADDR32
|
||||||
grub_I386_ASM_ABSOLUTE_WITHOUT_ASTERISK
|
|
||||||
else
|
|
||||||
AC_DEFINE([NESTED_FUNC_ATTR], [], [Catch gcc bug])
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AH_BOTTOM([#if defined(__i386__) && !defined(GRUB_UTIL)
|
|
||||||
#define NESTED_FUNC_ATTR __attribute__ ((__regparm__ (1)))
|
|
||||||
#else
|
|
||||||
#define NESTED_FUNC_ATTR
|
|
||||||
#endif])
|
|
||||||
|
|
||||||
AC_ARG_ENABLE([efiemu],
|
AC_ARG_ENABLE([efiemu],
|
||||||
[AS_HELP_STRING([--enable-efiemu],
|
[AS_HELP_STRING([--enable-efiemu],
|
||||||
[build and install the efiemu runtimes (default=guessed)])])
|
[build and install the efiemu runtimes (default=guessed)])])
|
||||||
|
@ -650,6 +685,23 @@ if test x"$grub_cv_cc_isystem" = xyes ; then
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
AC_CACHE_CHECK([whether -Wno-trampolines work], [grub_cv_cc_wnotrampolines], [
|
||||||
|
SAVED_CFLAGS="$CFLAGS"
|
||||||
|
# Test for -Wtrampolines rather than -Wno-trampolines to reduce confusion
|
||||||
|
# in the event of later failures (since -Wno-* is always accepted, but
|
||||||
|
# produces a diagnostic if something else is wrong).
|
||||||
|
CFLAGS="$TARGET_CFLAGS -Wtrampolines"
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <stdarg.h>
|
||||||
|
int va_arg_func (int fixed, va_list args);]], [[]])],
|
||||||
|
[grub_cv_cc_wnotrampolines=yes],
|
||||||
|
[grub_cv_cc_wnotrampolines=no])
|
||||||
|
CFLAGS="$SAVED_CFLAGS"
|
||||||
|
])
|
||||||
|
|
||||||
|
if test x"$grub_cv_cc_wnotrampolines" = xyes ; then
|
||||||
|
TARGET_CFLAGS="$TARGET_CFLAGS -Wno-trampolines"
|
||||||
|
fi
|
||||||
|
|
||||||
# Restore the flags.
|
# Restore the flags.
|
||||||
CC="$tmp_CC"
|
CC="$tmp_CC"
|
||||||
CFLAGS="$tmp_CFLAGS"
|
CFLAGS="$tmp_CFLAGS"
|
||||||
|
@ -668,6 +720,17 @@ AC_ARG_ENABLE([mm-debug],
|
||||||
[AC_DEFINE([MM_DEBUG], [1],
|
[AC_DEFINE([MM_DEBUG], [1],
|
||||||
[Define to 1 if you enable memory manager debugging.])])
|
[Define to 1 if you enable memory manager debugging.])])
|
||||||
|
|
||||||
|
AC_ARG_ENABLE([cache-stats],
|
||||||
|
AS_HELP_STRING([--enable-cache-stats],
|
||||||
|
[enable disk cache statistics collection]))
|
||||||
|
|
||||||
|
if test x$enable_cache_stats = xyes; then
|
||||||
|
DISK_CACHE_STATS=1
|
||||||
|
else
|
||||||
|
DISK_CACHE_STATS=0
|
||||||
|
fi
|
||||||
|
AC_SUBST([DISK_CACHE_STATS])
|
||||||
|
|
||||||
AC_ARG_ENABLE([grub-emu-usb],
|
AC_ARG_ENABLE([grub-emu-usb],
|
||||||
[AS_HELP_STRING([--enable-grub-emu-usb],
|
[AS_HELP_STRING([--enable-grub-emu-usb],
|
||||||
[build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
|
[build and install the `grub-emu' debugging utility with USB support (default=guessed)])])
|
||||||
|
@ -796,12 +859,12 @@ if test x"$grub_mkfont_excuse" = x ; then
|
||||||
if test "x$FREETYPE" = x ; then
|
if test "x$FREETYPE" = x ; then
|
||||||
grub_mkfont_excuse=["need freetype2 library"]
|
grub_mkfont_excuse=["need freetype2 library"]
|
||||||
fi
|
fi
|
||||||
freetype_cflags=`freetype-config --cflags`
|
|
||||||
freetype_libs=`freetype-config --libs`
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if test x"$grub_mkfont_excuse" = x ; then
|
if test x"$grub_mkfont_excuse" = x ; then
|
||||||
# Check for freetype libraries.
|
# Check for freetype libraries.
|
||||||
|
freetype_cflags=`freetype-config --cflags`
|
||||||
|
freetype_libs=`freetype-config --libs`
|
||||||
SAVED_CPPFLAGS="$CPPFLAGS"
|
SAVED_CPPFLAGS="$CPPFLAGS"
|
||||||
CPPFLAGS="$CPPFLAGS $freetype_cflags"
|
CPPFLAGS="$CPPFLAGS $freetype_cflags"
|
||||||
AC_CHECK_HEADERS([ft2build.h], [],
|
AC_CHECK_HEADERS([ft2build.h], [],
|
||||||
|
@ -817,10 +880,44 @@ enable_grub_mkfont=yes
|
||||||
else
|
else
|
||||||
enable_grub_mkfont=no
|
enable_grub_mkfont=no
|
||||||
fi
|
fi
|
||||||
|
if test x"$enable_grub_mkfont" = xno && test "x$platform" = xloongson; then
|
||||||
|
AC_MSG_ERROR([loongson port needs grub-mkfont])
|
||||||
|
fi
|
||||||
AC_SUBST([enable_grub_mkfont])
|
AC_SUBST([enable_grub_mkfont])
|
||||||
AC_SUBST([freetype_cflags])
|
AC_SUBST([freetype_cflags])
|
||||||
AC_SUBST([freetype_libs])
|
AC_SUBST([freetype_libs])
|
||||||
|
|
||||||
|
AC_ARG_ENABLE([grub-mount],
|
||||||
|
[AS_HELP_STRING([--enable-grub-mount],
|
||||||
|
[build and install the `grub-mount' utility (default=guessed)])])
|
||||||
|
if test x"$enable_grub_mount" = xno ; then
|
||||||
|
grub_mount_excuse="explicitly disabled"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test x"$grub_mount_excuse" = x ; then
|
||||||
|
AC_CHECK_LIB([fuse], [fuse_main_real], [],
|
||||||
|
[grub_mount_excuse="need FUSE library"])
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test x"$grub_mount_excuse" = x ; then
|
||||||
|
# Check for fuse headers.
|
||||||
|
SAVED_CPPFLAGS="$CPPFLAGS"
|
||||||
|
CPPFLAGS="$CPPFLAGS -D_FILE_OFFSET_BITS=64 -DFUSE_USE_VERSION=26"
|
||||||
|
AC_CHECK_HEADERS([fuse/fuse.h], [],
|
||||||
|
[grub_mount_excuse=["need FUSE headers"]])
|
||||||
|
CPPFLAGS="$SAVED_CPPFLAGS"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test x"$enable_grub_mount" = xyes && test x"$grub_mount_excuse" != x ; then
|
||||||
|
AC_MSG_ERROR([grub-mount was explicitly requested but can't be compiled])
|
||||||
|
fi
|
||||||
|
if test x"$grub_mount_excuse" = x ; then
|
||||||
|
enable_grub_mount=yes
|
||||||
|
else
|
||||||
|
enable_grub_mount=no
|
||||||
|
fi
|
||||||
|
AC_SUBST([enable_grub_mount])
|
||||||
|
|
||||||
AC_ARG_ENABLE([device-mapper],
|
AC_ARG_ENABLE([device-mapper],
|
||||||
[AS_HELP_STRING([--enable-device-mapper],
|
[AS_HELP_STRING([--enable-device-mapper],
|
||||||
[enable Linux device-mapper support (default=guessed)])])
|
[enable Linux device-mapper support (default=guessed)])])
|
||||||
|
@ -828,6 +925,12 @@ if test x"$enable_device_mapper" = xno ; then
|
||||||
device_mapper_excuse="explicitly disabled"
|
device_mapper_excuse="explicitly disabled"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test x"$device_mapper_excuse" = x ; then
|
||||||
|
# Check for device-mapper header.
|
||||||
|
AC_CHECK_HEADER([libdevmapper.h], [],
|
||||||
|
[device_mapper_excuse="need libdevmapper header"])
|
||||||
|
fi
|
||||||
|
|
||||||
if test x"$device_mapper_excuse" = x ; then
|
if test x"$device_mapper_excuse" = x ; then
|
||||||
# Check for device-mapper library.
|
# Check for device-mapper library.
|
||||||
AC_CHECK_LIB([devmapper], [dm_task_create], [],
|
AC_CHECK_LIB([devmapper], [dm_task_create], [],
|
||||||
|
@ -849,6 +952,21 @@ fi
|
||||||
|
|
||||||
AC_SUBST([LIBDEVMAPPER])
|
AC_SUBST([LIBDEVMAPPER])
|
||||||
|
|
||||||
|
LIBGEOM=
|
||||||
|
if test x$host_kernel = xkfreebsd; then
|
||||||
|
AC_CHECK_LIB([geom], [geom_gettree], [],
|
||||||
|
[AC_MSG_ERROR([Your platform requires libgeom])])
|
||||||
|
LIBGEOM="-lgeom"
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_SUBST([LIBGEOM])
|
||||||
|
|
||||||
|
AC_CHECK_LIB([lzma], [lzma_code],
|
||||||
|
[LIBLZMA="-llzma"
|
||||||
|
AC_DEFINE([HAVE_LIBLZMA], [1],
|
||||||
|
[Define to 1 if you have the LZMA library.])],)
|
||||||
|
AC_SUBST([LIBLZMA])
|
||||||
|
|
||||||
AC_CHECK_LIB([zfs], [libzfs_init],
|
AC_CHECK_LIB([zfs], [libzfs_init],
|
||||||
[LIBZFS="-lzfs"
|
[LIBZFS="-lzfs"
|
||||||
AC_DEFINE([HAVE_LIBZFS], [1],
|
AC_DEFINE([HAVE_LIBZFS], [1],
|
||||||
|
@ -872,6 +990,16 @@ AS_IF([test x$target_cpu = xi386 -a x$platform = xqemu],
|
||||||
AS_IF([test x$TARGET_APPLE_CC = x1],
|
AS_IF([test x$TARGET_APPLE_CC = x1],
|
||||||
[AC_SUBST([USE_APPLE_CC_FIXES], yes)])
|
[AC_SUBST([USE_APPLE_CC_FIXES], yes)])
|
||||||
|
|
||||||
|
AC_SUBST(HAVE_ASM_USCORE)
|
||||||
|
AC_SUBST(ADDR32)
|
||||||
|
AC_SUBST(DATA32)
|
||||||
|
AC_SUBST(BSS_START_SYMBOL)
|
||||||
|
AC_SUBST(END_SYMBOL)
|
||||||
|
AC_SUBST(PACKAGE)
|
||||||
|
AC_SUBST(VERSION)
|
||||||
|
AC_SUBST(NEED_ENABLE_EXECUTE_STACK)
|
||||||
|
AC_SUBST(NEED_REGISTER_FRAME_INFO)
|
||||||
|
|
||||||
#
|
#
|
||||||
# Automake conditionals
|
# Automake conditionals
|
||||||
#
|
#
|
||||||
|
@ -879,56 +1007,70 @@ AS_IF([test x$TARGET_APPLE_CC = x1],
|
||||||
AM_CONDITIONAL([COND_emu], [test x$platform = xemu])
|
AM_CONDITIONAL([COND_emu], [test x$platform = xemu])
|
||||||
AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc])
|
AM_CONDITIONAL([COND_i386_pc], [test x$target_cpu = xi386 -a x$platform = xpc])
|
||||||
AM_CONDITIONAL([COND_i386_efi], [test x$target_cpu = xi386 -a x$platform = xefi])
|
AM_CONDITIONAL([COND_i386_efi], [test x$target_cpu = xi386 -a x$platform = xefi])
|
||||||
|
AM_CONDITIONAL([COND_ia64_efi], [test x$target_cpu = xia64 -a x$platform = xefi])
|
||||||
AM_CONDITIONAL([COND_i386_qemu], [test x$target_cpu = xi386 -a x$platform = xqemu])
|
AM_CONDITIONAL([COND_i386_qemu], [test x$target_cpu = xi386 -a x$platform = xqemu])
|
||||||
AM_CONDITIONAL([COND_i386_ieee1275], [test x$target_cpu = xi386 -a x$platform = xieee1275])
|
AM_CONDITIONAL([COND_i386_ieee1275], [test x$target_cpu = xi386 -a x$platform = xieee1275])
|
||||||
AM_CONDITIONAL([COND_i386_coreboot], [test x$target_cpu = xi386 -a x$platform = xcoreboot])
|
AM_CONDITIONAL([COND_i386_coreboot], [test x$target_cpu = xi386 -a x$platform = xcoreboot])
|
||||||
AM_CONDITIONAL([COND_i386_multiboot], [test x$target_cpu = xi386 -a x$platform = xmultiboot])
|
AM_CONDITIONAL([COND_i386_multiboot], [test x$target_cpu = xi386 -a x$platform = xmultiboot])
|
||||||
AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi])
|
AM_CONDITIONAL([COND_x86_64_efi], [test x$target_cpu = xx86_64 -a x$platform = xefi])
|
||||||
AM_CONDITIONAL([COND_mips_yeeloong], [test x$target_cpu = xmips -a x$platform = xyeeloong])
|
AM_CONDITIONAL([COND_mips_loongson], [test x$target_cpu = xmipsel -a x$platform = xloongson])
|
||||||
AM_CONDITIONAL([COND_mips_qemu_mips], [test x$target_cpu = xmips -a x$platform = xqemu_mips])
|
AM_CONDITIONAL([COND_mips_qemu_mips], [test "(" x$target_cpu = xmips -o x$target_cpu = xmipsel ")" -a x$platform = xqemu_mips])
|
||||||
|
AM_CONDITIONAL([COND_mips_arc], [test x$target_cpu = xmips -a x$platform = xarc])
|
||||||
AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275])
|
AM_CONDITIONAL([COND_sparc64_ieee1275], [test x$target_cpu = xsparc64 -a x$platform = xieee1275])
|
||||||
AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275])
|
AM_CONDITIONAL([COND_powerpc_ieee1275], [test x$target_cpu = xpowerpc -a x$platform = xieee1275])
|
||||||
AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips])
|
AM_CONDITIONAL([COND_mips], [test x$target_cpu = xmips -o x$target_cpu = xmipsel])
|
||||||
|
|
||||||
AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd])
|
AM_CONDITIONAL([COND_HOST_HURD], [test x$host_kernel = xhurd])
|
||||||
AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux])
|
AM_CONDITIONAL([COND_HOST_LINUX], [test x$host_kernel = xlinux])
|
||||||
AM_CONDITIONAL([COND_HOST_NETBSD], [test x$host_kernel = xnetbsd])
|
AM_CONDITIONAL([COND_HOST_NETBSD], [test x$host_kernel = xnetbsd])
|
||||||
AM_CONDITIONAL([COND_HOST_WINDOWS], [test x$host_kernel = xwindows])
|
AM_CONDITIONAL([COND_HOST_WINDOWS], [test x$host_kernel = xwindows])
|
||||||
AM_CONDITIONAL([COND_HOST_KFREEBSD], [test x$host_kernel = xkfreebsd])
|
AM_CONDITIONAL([COND_HOST_KFREEBSD], [test x$host_kernel = xkfreebsd])
|
||||||
|
AM_CONDITIONAL([COND_HOST_ILLUMOS], [test x$host_kernel = xillumos])
|
||||||
|
|
||||||
AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x])
|
AM_CONDITIONAL([COND_MAN_PAGES], [test x$cross_compiling = xno -a x$HELP2MAN != x])
|
||||||
AM_CONDITIONAL([COND_GRUB_EMU_USB], [test x$enable_grub_emu_usb = xyes])
|
AM_CONDITIONAL([COND_GRUB_EMU_USB], [test x$enable_grub_emu_usb = xyes])
|
||||||
AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes])
|
AM_CONDITIONAL([COND_GRUB_EMU_SDL], [test x$enable_grub_emu_sdl = xyes])
|
||||||
AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes])
|
AM_CONDITIONAL([COND_GRUB_EMU_PCI], [test x$enable_grub_emu_pci = xyes])
|
||||||
AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes])
|
AM_CONDITIONAL([COND_GRUB_MKFONT], [test x$enable_grub_mkfont = xyes])
|
||||||
|
AM_CONDITIONAL([COND_GRUB_MOUNT], [test x$enable_grub_mount = xyes])
|
||||||
AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x])
|
AM_CONDITIONAL([COND_HAVE_FONT_SOURCE], [test x$FONT_SOURCE != x])
|
||||||
AM_CONDITIONAL([COND_GRUB_PE2ELF], [test x$TARGET_OBJ2ELF != x])
|
AM_CONDITIONAL([COND_GRUB_PE2ELF], [test x$TARGET_OBJ2ELF != x])
|
||||||
AM_CONDITIONAL([COND_APPLE_CC], [test x$TARGET_APPLE_CC = x1])
|
AM_CONDITIONAL([COND_APPLE_CC], [test x$TARGET_APPLE_CC = x1])
|
||||||
AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes])
|
AM_CONDITIONAL([COND_ENABLE_EFIEMU], [test x$enable_efiemu = xyes])
|
||||||
|
AM_CONDITIONAL([COND_ENABLE_CACHE_STATS], [test x$DISK_CACHE_STATS = x1])
|
||||||
|
|
||||||
|
AM_CONDITIONAL([COND_HAVE_ASM_USCORE], [test x$HAVE_ASM_USCORE = x1])
|
||||||
|
AM_CONDITIONAL([COND_CYGWIN], [test x$host_os = xcygwin])
|
||||||
|
|
||||||
# Output files.
|
# Output files.
|
||||||
|
cpudir="${target_cpu}"
|
||||||
|
if test x${cpudir} = xmipsel; then
|
||||||
|
cpudir=mips;
|
||||||
|
fi
|
||||||
grub_CHECK_LINK_DIR
|
grub_CHECK_LINK_DIR
|
||||||
if test x"$link_dir" = xyes ; then
|
if test x"$link_dir" = xyes ; then
|
||||||
AC_CONFIG_LINKS([include/grub/cpu:include/grub/$target_cpu])
|
AC_CONFIG_LINKS([include/grub/cpu:include/grub/$cpudir])
|
||||||
if test "$platform" != emu ; then
|
if test "$platform" != emu ; then
|
||||||
AC_CONFIG_LINKS([include/grub/machine:include/grub/$target_cpu/$platform])
|
AC_CONFIG_LINKS([include/grub/machine:include/grub/$cpudir/$platform])
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
mkdir -p include/grub 2>/dev/null
|
mkdir -p include/grub 2>/dev/null
|
||||||
rm -rf include/grub/cpu
|
rm -rf include/grub/cpu
|
||||||
cp -rp $srcdir/include/grub/$target_cpu include/grub/cpu 2>/dev/null
|
cp -rp $srcdir/include/grub/$cpudir include/grub/cpu 2>/dev/null
|
||||||
if test "$platform" != emu ; then
|
if test "$platform" != emu ; then
|
||||||
rm -rf include/grub/machine
|
rm -rf include/grub/machine
|
||||||
cp -rp $srcdir/include/grub/$target_cpu/$platform include/grub/machine 2>/dev/null
|
cp -rp $srcdir/include/grub/$cpudir/$platform include/grub/machine 2>/dev/null
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_CONFIG_FILES([Makefile])
|
AC_CONFIG_FILES([Makefile])
|
||||||
AC_CONFIG_FILES([grub-core/Makefile])
|
AC_CONFIG_FILES([grub-core/Makefile])
|
||||||
AC_CONFIG_FILES([po/Makefile])
|
AC_CONFIG_FILES([grub-core/gnulib/Makefile])
|
||||||
|
AC_CONFIG_FILES([po/Makefile.in])
|
||||||
AC_CONFIG_FILES([docs/Makefile])
|
AC_CONFIG_FILES([docs/Makefile])
|
||||||
AC_CONFIG_FILES([util/bash-completion.d/Makefile])
|
AC_CONFIG_FILES([util/bash-completion.d/Makefile])
|
||||||
AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
|
AC_CONFIG_FILES([stamp-h], [echo timestamp > stamp-h])
|
||||||
|
AC_CONFIG_FILES([config.h])
|
||||||
|
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
[
|
[
|
||||||
|
@ -962,6 +1104,11 @@ echo With memory debugging: Yes
|
||||||
else
|
else
|
||||||
echo With memory debugging: No
|
echo With memory debugging: No
|
||||||
fi
|
fi
|
||||||
|
if [ x"$enable_cache_stats" = xyes ]; then
|
||||||
|
echo With disk cache statistics: Yes
|
||||||
|
else
|
||||||
|
echo With disk cache statistics: No
|
||||||
|
fi
|
||||||
if [ x"$efiemu_excuse" = x ]; then
|
if [ x"$efiemu_excuse" = x ]; then
|
||||||
echo efiemu runtime: Yes
|
echo efiemu runtime: Yes
|
||||||
else
|
else
|
||||||
|
@ -972,5 +1119,10 @@ echo grub-mkfont: Yes
|
||||||
else
|
else
|
||||||
echo grub-mkfont: No "($grub_mkfont_excuse)"
|
echo grub-mkfont: No "($grub_mkfont_excuse)"
|
||||||
fi
|
fi
|
||||||
|
if [ x"$grub_mount_excuse" = x ]; then
|
||||||
|
echo grub-mount: Yes
|
||||||
|
else
|
||||||
|
echo grub-mount: No "($grub_mount_excuse)"
|
||||||
|
fi
|
||||||
echo "*******************************************************"
|
echo "*******************************************************"
|
||||||
]
|
]
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
AUTOMAKE_OPTIONS = subdir-objects
|
AUTOMAKE_OPTIONS = subdir-objects
|
||||||
|
|
||||||
# AM_MAKEINFOFLAGS = --no-split --no-validate
|
# AM_MAKEINFOFLAGS = --no-split --no-validate
|
||||||
info_TEXINFOS = grub.texi
|
info_TEXINFOS = grub.texi grub-dev.texi
|
||||||
grub_TEXINFOS = fdl.texi
|
grub_TEXINFOS = fdl.texi
|
||||||
|
|
||||||
|
|
||||||
|
|
BIN
docs/font_char_metrics.png
Normal file
BIN
docs/font_char_metrics.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 16 KiB |
1
docs/font_char_metrics.txt
Normal file
1
docs/font_char_metrics.txt
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Please fill this in.
|
1533
docs/grub-dev.texi
Normal file
1533
docs/grub-dev.texi
Normal file
File diff suppressed because it is too large
Load diff
1182
docs/grub.texi
1182
docs/grub.texi
File diff suppressed because it is too large
Load diff
|
@ -1,2 +0,0 @@
|
||||||
[NAME]
|
|
||||||
grub-bin2h \- convert a binary file to a C header
|
|
|
@ -1,2 +1,5 @@
|
||||||
[NAME]
|
[NAME]
|
||||||
grub-editenv \- edit GRUB environment block
|
grub-editenv \- edit GRUB environment block
|
||||||
|
[SEE ALSO]
|
||||||
|
.BR grub-reboot (8),
|
||||||
|
.BR grub-set-default (8)
|
||||||
|
|
|
@ -1,2 +1,6 @@
|
||||||
[NAME]
|
[NAME]
|
||||||
grub-emu \- GRUB emulator
|
grub-emu \- GRUB emulator
|
||||||
|
[SEE ALSO]
|
||||||
|
If you are trying to install GRUB, then you should use
|
||||||
|
.BR grub-install (8)
|
||||||
|
rather than this program.
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
[NAME]
|
[NAME]
|
||||||
grub-fstest \- debug tool for GRUB filesystem drivers
|
grub-fstest \- debug tool for GRUB filesystem drivers
|
||||||
|
[SEE ALSO]
|
||||||
|
.BR grub-probe (8)
|
||||||
|
|
|
@ -1,2 +1,7 @@
|
||||||
[NAME]
|
[NAME]
|
||||||
grub-install \- install GRUB to a device
|
grub-install \- install GRUB to a device
|
||||||
|
[SEE ALSO]
|
||||||
|
.BR grub-mkconfig (8),
|
||||||
|
.BR grub-mkimage (1),
|
||||||
|
.BR grub-setup (8),
|
||||||
|
.BR grub-mkrescue (1)
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
[NAME]
|
[NAME]
|
||||||
grub-macho2img \- convert Mach-O to raw image
|
grub-macho2img \- convert Mach-O to raw image
|
||||||
|
[SEE ALSO]
|
||||||
|
.BR grub-mkimage (1)
|
||||||
|
|
4
docs/man/grub-menulst2cfg.h2m
Normal file
4
docs/man/grub-menulst2cfg.h2m
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
[NAME]
|
||||||
|
grub-menulst2cfg \- transform legacy menu.lst into grub.cfg
|
||||||
|
[SEE ALSO]
|
||||||
|
.BR grub-mkconfig (8)
|
|
@ -1,2 +1,4 @@
|
||||||
[NAME]
|
[NAME]
|
||||||
grub-mkconfig \- generate a GRUB configuration file
|
grub-mkconfig \- generate a GRUB configuration file
|
||||||
|
[SEE ALSO]
|
||||||
|
.BR grub-install (8)
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
[NAME]
|
[NAME]
|
||||||
grub-mkdevicemap \- generate a GRUB device map file automatically
|
grub-mkdevicemap \- generate a GRUB device map file automatically
|
||||||
|
[SEE ALSO]
|
||||||
|
.BR grub-install (8)
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
[NAME]
|
[NAME]
|
||||||
grub-mkfont \- make GRUB font files
|
grub-mkfont \- make GRUB font files
|
||||||
|
[SEE ALSO]
|
||||||
|
.BR grub-mkconfig (8)
|
||||||
|
|
|
@ -1,2 +1,7 @@
|
||||||
[NAME]
|
[NAME]
|
||||||
grub-mkimage \- make a bootable image of GRUB
|
grub-mkimage \- make a bootable image of GRUB
|
||||||
|
[SEE ALSO]
|
||||||
|
.BR grub-install (8),
|
||||||
|
.BR grub-setup (8),
|
||||||
|
.BR grub-mkrescue (1),
|
||||||
|
.BR grub-mknetdir (8)
|
||||||
|
|
10
docs/man/grub-mklayout.h2m
Normal file
10
docs/man/grub-mklayout.h2m
Normal file
|
@ -0,0 +1,10 @@
|
||||||
|
[NAME]
|
||||||
|
grub-mklayout \- generate a GRUB keyboard layout file
|
||||||
|
[DESCRIPTION]
|
||||||
|
grub-mklayout processes a keyboard layout description in
|
||||||
|
.BR keymaps (5)
|
||||||
|
format into a format that can be used by GRUB's
|
||||||
|
.B keymap
|
||||||
|
command.
|
||||||
|
[SEE ALSO]
|
||||||
|
.BR grub-mkconfig (8)
|
|
@ -1,2 +1,4 @@
|
||||||
[NAME]
|
[NAME]
|
||||||
grub-mknetdir \- prepare a GRUB netboot directory.
|
grub-mknetdir \- prepare a GRUB netboot directory.
|
||||||
|
[SEE ALSO]
|
||||||
|
.BR grub-mkimage (1)
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
[NAME]
|
[NAME]
|
||||||
grub-mkpasswd-pbkdf2 \- generate hashed password for GRUB
|
grub-mkpasswd-pbkdf2 \- generate hashed password for GRUB
|
||||||
|
[SEE ALSO]
|
||||||
|
.BR grub-mkconfig (8)
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
[NAME]
|
[NAME]
|
||||||
grub-mkrelpath \- make a system path relative to its root
|
grub-mkrelpath \- make a system path relative to its root
|
||||||
|
[SEE ALSO]
|
||||||
|
.BR grub-probe (8)
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
[NAME]
|
[NAME]
|
||||||
grub-mkrescue \- make a GRUB rescue image
|
grub-mkrescue \- make a GRUB rescue image
|
||||||
|
[SEE ALSO]
|
||||||
|
.BR grub-mkimage (1)
|
||||||
|
|
4
docs/man/grub-mkstandalone.h2m
Normal file
4
docs/man/grub-mkstandalone.h2m
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
[NAME]
|
||||||
|
grub-mkstandalone \- make a memdisk-based GRUB image
|
||||||
|
[SEE ALSO]
|
||||||
|
.BR grub-mkimage (1)
|
2
docs/man/grub-mount.h2m
Normal file
2
docs/man/grub-mount.h2m
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
[NAME]
|
||||||
|
grub-mount \- export GRUB filesystem with FUSE
|
|
@ -1,2 +1,4 @@
|
||||||
[NAME]
|
[NAME]
|
||||||
grub-ofpathname \- find OpenBOOT path for a device
|
grub-ofpathname \- find OpenBOOT path for a device
|
||||||
|
[SEE ALSO]
|
||||||
|
.BR grub-probe (8)
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
[NAME]
|
[NAME]
|
||||||
grub-pe2elf \- convert PE image to ELF
|
grub-pe2elf \- convert PE image to ELF
|
||||||
|
[SEE ALSO]
|
||||||
|
.BR grub-mkimage (1)
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
[NAME]
|
[NAME]
|
||||||
grub-probe \- probe device information for GRUB
|
grub-probe \- probe device information for GRUB
|
||||||
|
[SEE ALSO]
|
||||||
|
.BR grub-fstest (1)
|
||||||
|
|
|
@ -1,2 +1,5 @@
|
||||||
[NAME]
|
[NAME]
|
||||||
grub-reboot \- set the default boot entry for GRUB, for the next boot only
|
grub-reboot \- set the default boot entry for GRUB, for the next boot only
|
||||||
|
[SEE ALSO]
|
||||||
|
.BR grub-set-default (8),
|
||||||
|
.BR grub-editenv (1)
|
||||||
|
|
|
@ -1,2 +1,4 @@
|
||||||
[NAME]
|
[NAME]
|
||||||
grub-script-check \- check grub.cfg for syntax errors
|
grub-script-check \- check grub.cfg for syntax errors
|
||||||
|
[SEE ALSO]
|
||||||
|
.BR grub-mkconfig (8)
|
||||||
|
|
|
@ -1,2 +1,5 @@
|
||||||
[NAME]
|
[NAME]
|
||||||
grub-set-default \- set the default boot entry for GRUB
|
grub-set-default \- set the saved default boot entry for GRUB
|
||||||
|
[SEE ALSO]
|
||||||
|
.BR grub-reboot (8),
|
||||||
|
.BR grub-editenv (1)
|
||||||
|
|
|
@ -1,2 +1,6 @@
|
||||||
[NAME]
|
[NAME]
|
||||||
grub-setup \- set up a device to boot using GRUB
|
grub-setup \- set up a device to boot using GRUB
|
||||||
|
[SEE ALSO]
|
||||||
|
.BR grub-install (8),
|
||||||
|
.BR grub-mkimage (1),
|
||||||
|
.BR grub-mkrescue (1)
|
||||||
|
|
326
gentpl.py
326
gentpl.py
|
@ -6,8 +6,9 @@
|
||||||
|
|
||||||
GRUB_PLATFORMS = [ "emu", "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot",
|
GRUB_PLATFORMS = [ "emu", "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot",
|
||||||
"i386_multiboot", "i386_ieee1275", "x86_64_efi",
|
"i386_multiboot", "i386_ieee1275", "x86_64_efi",
|
||||||
"mips_yeeloong", "sparc64_ieee1275",
|
"mips_loongson", "sparc64_ieee1275",
|
||||||
"powerpc_ieee1275" ]
|
"powerpc_ieee1275", "mips_arc", "ia64_efi",
|
||||||
|
"mips_qemu_mips" ]
|
||||||
|
|
||||||
GROUPS = {}
|
GROUPS = {}
|
||||||
|
|
||||||
|
@ -17,27 +18,34 @@ GROUPS["common"] = GRUB_PLATFORMS[:]
|
||||||
GROUPS["i386"] = [ "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot", "i386_multiboot", "i386_ieee1275" ]
|
GROUPS["i386"] = [ "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot", "i386_multiboot", "i386_ieee1275" ]
|
||||||
GROUPS["x86_64"] = [ "x86_64_efi" ]
|
GROUPS["x86_64"] = [ "x86_64_efi" ]
|
||||||
GROUPS["x86"] = GROUPS["i386"] + GROUPS["x86_64"]
|
GROUPS["x86"] = GROUPS["i386"] + GROUPS["x86_64"]
|
||||||
GROUPS["mips"] = [ "mips_yeeloong" ]
|
GROUPS["mips"] = [ "mips_loongson", "mips_qemu_mips", "mips_arc" ]
|
||||||
GROUPS["sparc64"] = [ "sparc64_ieee1275" ]
|
GROUPS["sparc64"] = [ "sparc64_ieee1275" ]
|
||||||
GROUPS["powerpc"] = [ "powerpc_ieee1275" ]
|
GROUPS["powerpc"] = [ "powerpc_ieee1275" ]
|
||||||
|
|
||||||
# Groups based on firmware
|
# Groups based on firmware
|
||||||
GROUPS["x86_efi"] = [ "i386_efi", "x86_64_efi" ]
|
GROUPS["efi"] = [ "i386_efi", "x86_64_efi", "ia64_efi" ]
|
||||||
GROUPS["ieee1275"] = [ "i386_ieee1275", "sparc64_ieee1275", "powerpc_ieee1275" ]
|
GROUPS["ieee1275"] = [ "i386_ieee1275", "sparc64_ieee1275", "powerpc_ieee1275" ]
|
||||||
|
|
||||||
# emu is a special case so many core functionality isn't needed on this platform
|
# emu is a special case so many core functionality isn't needed on this platform
|
||||||
GROUPS["noemu"] = GRUB_PLATFORMS[:]; GROUPS["noemu"].remove("emu")
|
GROUPS["noemu"] = GRUB_PLATFORMS[:]; GROUPS["noemu"].remove("emu")
|
||||||
|
|
||||||
# Groups based on hardware features
|
# Groups based on hardware features
|
||||||
GROUPS["cmos"] = GROUPS["x86"][:] + ["mips_yeeloong"]; GROUPS["cmos"].remove("i386_efi"); GROUPS["cmos"].remove("x86_64_efi")
|
GROUPS["cmos"] = GROUPS["x86"][:] + ["mips_loongson", "mips_qemu_mips",
|
||||||
GROUPS["pci"] = GROUPS["x86"] + GROUPS["mips"]
|
"sparc64_ieee1275", "powerpc_ieee1275"]
|
||||||
|
GROUPS["cmos"].remove("i386_efi"); GROUPS["cmos"].remove("x86_64_efi")
|
||||||
|
GROUPS["pci"] = GROUPS["x86"] + ["mips_loongson"]
|
||||||
GROUPS["usb"] = GROUPS["pci"]
|
GROUPS["usb"] = GROUPS["pci"]
|
||||||
|
|
||||||
# If gfxterm is main output console integrate it into kernel
|
# If gfxterm is main output console integrate it into kernel
|
||||||
GROUPS["videoinkernel"] = ["mips_yeeloong"]
|
GROUPS["videoinkernel"] = ["mips_loongson", "mips_qemu_mips"]
|
||||||
GROUPS["videomodules"] = GRUB_PLATFORMS[:];
|
GROUPS["videomodules"] = GRUB_PLATFORMS[:];
|
||||||
for i in GROUPS["videoinkernel"]: GROUPS["videomodules"].remove(i)
|
for i in GROUPS["videoinkernel"]: GROUPS["videomodules"].remove(i)
|
||||||
|
|
||||||
|
# Similar for terminfo
|
||||||
|
GROUPS["terminfoinkernel"] = ["mips_loongson", "mips_arc", "mips_qemu_mips" ] + GROUPS["ieee1275"];
|
||||||
|
GROUPS["terminfomodule"] = GRUB_PLATFORMS[:];
|
||||||
|
for i in GROUPS["terminfoinkernel"]: GROUPS["terminfomodule"].remove(i)
|
||||||
|
|
||||||
# Miscelaneous groups schedulded to disappear in future
|
# Miscelaneous groups schedulded to disappear in future
|
||||||
GROUPS["nosparc64"] = GRUB_PLATFORMS[:]; GROUPS["nosparc64"].remove("sparc64_ieee1275")
|
GROUPS["nosparc64"] = GRUB_PLATFORMS[:]; GROUPS["nosparc64"].remove("sparc64_ieee1275")
|
||||||
GROUPS["i386_coreboot_multiboot_qemu"] = ["i386_coreboot", "i386_multiboot", "i386_qemu"]
|
GROUPS["i386_coreboot_multiboot_qemu"] = ["i386_coreboot", "i386_multiboot", "i386_qemu"]
|
||||||
|
@ -70,16 +78,15 @@ for platform in GRUB_PLATFORMS:
|
||||||
#
|
#
|
||||||
# Global variables
|
# Global variables
|
||||||
#
|
#
|
||||||
GVARS = []
|
GVARS = set()
|
||||||
|
|
||||||
def gvar_add(var, value):
|
def gvar_add(var, value):
|
||||||
if var not in GVARS:
|
GVARS.add(var)
|
||||||
GVARS.append(var)
|
|
||||||
return var + " += " + value + "\n"
|
return var + " += " + value + "\n"
|
||||||
|
|
||||||
def global_variable_initializers():
|
def global_variable_initializers():
|
||||||
r = ""
|
r = ""
|
||||||
for var in GVARS:
|
for var in sorted(GVARS):
|
||||||
r += var + " ?= \n"
|
r += var + " ?= \n"
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
@ -87,6 +94,16 @@ def global_variable_initializers():
|
||||||
# Per PROGRAM/SCRIPT variables
|
# Per PROGRAM/SCRIPT variables
|
||||||
#
|
#
|
||||||
|
|
||||||
|
def vars_init(*var_list):
|
||||||
|
r = "[+ IF (if (not (assoc-ref seen-vars (get \".name\"))) \"seen\") +]"
|
||||||
|
r += "[+ (out-suspend \"v\") +]"
|
||||||
|
for var in var_list:
|
||||||
|
r += var + " = \n"
|
||||||
|
r += "[+ (out-resume \"v\") +]"
|
||||||
|
r += "[+ (set! seen-vars (assoc-set! seen-vars (get \".name\") 0)) +]"
|
||||||
|
r += "[+ ENDIF +]"
|
||||||
|
return first_time(r)
|
||||||
|
|
||||||
def var_set(var, value):
|
def var_set(var, value):
|
||||||
return var + " = " + value + "\n"
|
return var + " = " + value + "\n"
|
||||||
|
|
||||||
|
@ -166,6 +183,17 @@ def foreach_platform_specific_value(platform, suffix, nonetag, closure):
|
||||||
r += "[+ ELSE +][+ FOR " + nonetag + " +]" + closure("[+ ." + nonetag + " +]") + "[+ ENDFOR +][+ ENDIF +]"
|
r += "[+ ELSE +][+ FOR " + nonetag + " +]" + closure("[+ ." + nonetag + " +]") + "[+ ENDFOR +][+ ENDIF +]"
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
#
|
||||||
|
# Returns autogen code that defines an autogen macro using the
|
||||||
|
# definition given in the 'snippet'.
|
||||||
|
#
|
||||||
|
def define_autogen_macro(name, snippet):
|
||||||
|
r = ""
|
||||||
|
r += "[+ DEFINE " + name + " +]"
|
||||||
|
r += snippet
|
||||||
|
r += "[+ ENDDEF +]\n"
|
||||||
|
return r
|
||||||
|
|
||||||
#
|
#
|
||||||
# Template for handling values from sum of all groups for a platform,
|
# Template for handling values from sum of all groups for a platform,
|
||||||
# for example:
|
# for example:
|
||||||
|
@ -224,14 +252,22 @@ def foreach_enabled_platform(closure):
|
||||||
# noemu = bus/usb/usbhub.c;
|
# noemu = bus/usb/usbhub.c;
|
||||||
# enable = emu;
|
# enable = emu;
|
||||||
# enable = i386;
|
# enable = i386;
|
||||||
# enable = mips_yeeloong;
|
# enable = mips_loongson;
|
||||||
# emu_condition = COND_GRUB_EMU_USB;
|
# emu_condition = COND_GRUB_EMU_USB;
|
||||||
# };
|
# };
|
||||||
#
|
#
|
||||||
|
def define_macro_for_platform_conditionals_if_statement(p):
|
||||||
|
return define_autogen_macro(
|
||||||
|
"if_" + p + "_conditionals",
|
||||||
|
foreach_platform_specific_value(platform, "_condition", "condition", lambda cond: "if " + cond + "\n"))
|
||||||
|
def define_macro_for_platform_conditionals_endif_statement(p):
|
||||||
|
return define_autogen_macro(
|
||||||
|
"endif_" + p + "_conditionals",
|
||||||
|
foreach_platform_specific_value(platform, "_condition", "condition", lambda cond: "endif " + cond + "\n"))
|
||||||
def under_platform_specific_conditionals(platform, snippet):
|
def under_platform_specific_conditionals(platform, snippet):
|
||||||
r = foreach_platform_specific_value(platform, "_condition", "condition", lambda cond: "if " + cond + "\n")
|
r = "[+ if_" + platform + "_conditionals +]"
|
||||||
r += snippet
|
r += snippet
|
||||||
r += foreach_platform_specific_value(platform, "_condition", "condition", lambda cond: "endif " + cond + "\n")
|
r += "[+ endif_" + platform + "_conditionals +]"
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def platform_specific_values(platform, suffix, nonetag):
|
def platform_specific_values(platform, suffix, nonetag):
|
||||||
|
@ -244,18 +280,78 @@ def platform_values(platform, suffix):
|
||||||
def extra_dist():
|
def extra_dist():
|
||||||
return foreach_value("extra_dist", lambda value: value + " ")
|
return foreach_value("extra_dist", lambda value: value + " ")
|
||||||
|
|
||||||
def platform_sources(p): return platform_values(p, "")
|
def define_macro_for_platform_sources(p):
|
||||||
def platform_nodist_sources(p): return platform_values(p, "_nodist")
|
return define_autogen_macro(
|
||||||
def platform_dependencies(p): return platform_values(p, "dependencies", "_dependencies")
|
"get_" + p + "_sources",
|
||||||
|
platform_values(p, ""))
|
||||||
|
def define_macro_for_platform_nodist_sources(p):
|
||||||
|
return define_autogen_macro(
|
||||||
|
"get_" + p + "_nodist_sources",
|
||||||
|
platform_values(p, "_nodist"))
|
||||||
|
def define_macro_for_platform_dependencies(p):
|
||||||
|
return define_autogen_macro(
|
||||||
|
"get_" + p + "_dependencies",
|
||||||
|
platform_values(p, "dependencies", "_dependencies"))
|
||||||
|
def platform_sources(p): return "[+ get_" + p + "_sources +]"
|
||||||
|
def platform_nodist_sources(p): return "[+ get_" + p + "_nodist_sources +]"
|
||||||
|
def platform_dependencies(p): return "[+ get_" + p + "_dependencies +]"
|
||||||
|
|
||||||
def platform_startup(p): return platform_specific_values(p, "_startup", "startup")
|
#
|
||||||
def platform_ldadd(p): return platform_specific_values(p, "_ldadd", "ldadd")
|
# Returns Autogen code which defines the autogen macros that collect
|
||||||
def platform_cflags(p): return platform_specific_values(p, "_cflags", "cflags")
|
# platform specific values for cflags, ldflags, etc. tags.
|
||||||
def platform_ldflags(p): return platform_specific_values(p, "_ldflags", "ldflags")
|
#
|
||||||
def platform_cppflags(p): return platform_specific_values(p, "_cppflags", "cppflags")
|
def define_macro_for_platform_startup(p):
|
||||||
def platform_ccasflags(p): return platform_specific_values(p, "_ccasflags", "ccasflags")
|
return define_autogen_macro(
|
||||||
def platform_stripflags(p): return platform_specific_values(p, "_stripflags", "stripflags")
|
"get_" + p + "_startup",
|
||||||
def platform_objcopyflags(p): return platform_specific_values(p, "_objcopyflags", "objcopyflags")
|
platform_specific_values(p, "_startup", "startup"))
|
||||||
|
def define_macro_for_platform_cflags(p):
|
||||||
|
return define_autogen_macro(
|
||||||
|
"get_" + p + "_cflags",
|
||||||
|
platform_specific_values(p, "_cflags", "cflags"))
|
||||||
|
def define_macro_for_platform_ldadd(p):
|
||||||
|
return define_autogen_macro(
|
||||||
|
"get_" + p + "_ldadd",
|
||||||
|
platform_specific_values(p, "_ldadd", "ldadd"))
|
||||||
|
def define_macro_for_platform_ldflags(p):
|
||||||
|
return define_autogen_macro(
|
||||||
|
"get_" + p + "_ldflags",
|
||||||
|
platform_specific_values(p, "_ldflags", "ldflags"))
|
||||||
|
def define_macro_for_platform_cppflags(p):
|
||||||
|
return define_autogen_macro(
|
||||||
|
"get_" + p + "_cppflags",
|
||||||
|
platform_specific_values(p, "_cppflags", "cppflags"))
|
||||||
|
def define_macro_for_platform_ccasflags(p):
|
||||||
|
return define_autogen_macro(
|
||||||
|
"get_" + p + "_ccasflags",
|
||||||
|
platform_specific_values(p, "_ccasflags", "ccasflags"))
|
||||||
|
def define_macro_for_platform_stripflags(p):
|
||||||
|
return define_autogen_macro(
|
||||||
|
"get_" + p + "_stripflags",
|
||||||
|
platform_specific_values(p, "_stripflags", "stripflags"))
|
||||||
|
def define_macro_for_platform_objcopyflags(p):
|
||||||
|
return define_autogen_macro(
|
||||||
|
"get_" + p + "_objcopyflags",
|
||||||
|
platform_specific_values(p, "_objcopyflags", "objcopyflags"))
|
||||||
|
#
|
||||||
|
# Autogen calls to invoke the above macros.
|
||||||
|
#
|
||||||
|
def platform_startup(p): return "[+ get_" + p + "_startup +]"
|
||||||
|
def platform_ldadd(p): return "[+ get_" + p + "_ldadd +]"
|
||||||
|
def platform_cflags(p): return "[+ get_" + p + "_cflags +]"
|
||||||
|
def platform_ldflags(p): return "[+ get_" + p + "_ldflags +]"
|
||||||
|
def platform_cppflags(p): return "[+ get_" + p + "_cppflags +]"
|
||||||
|
def platform_ccasflags(p): return "[+ get_" + p + "_ccasflags +]"
|
||||||
|
def platform_stripflags(p): return "[+ get_" + p + "_stripflags +]"
|
||||||
|
def platform_objcopyflags(p): return "[+ get_" + p + "_objcopyflags +]"
|
||||||
|
|
||||||
|
#
|
||||||
|
# Emit snippet only the first time through for the current name.
|
||||||
|
#
|
||||||
|
def first_time(snippet):
|
||||||
|
r = "[+ IF (if (not (assoc-ref seen-target (get \".name\"))) \"seen\") +]"
|
||||||
|
r += snippet
|
||||||
|
r += "[+ ENDIF +]"
|
||||||
|
return r
|
||||||
|
|
||||||
def module(platform):
|
def module(platform):
|
||||||
r = set_canonical_name_suffix(".module")
|
r = set_canonical_name_suffix(".module")
|
||||||
|
@ -276,75 +372,13 @@ def module(platform):
|
||||||
r += gvar_add("BUILT_SOURCES", "$(nodist_" + cname() + "_SOURCES)")
|
r += gvar_add("BUILT_SOURCES", "$(nodist_" + cname() + "_SOURCES)")
|
||||||
r += gvar_add("CLEANFILES", "$(nodist_" + cname() + "_SOURCES)")
|
r += gvar_add("CLEANFILES", "$(nodist_" + cname() + "_SOURCES)")
|
||||||
|
|
||||||
r += gvar_add("DEF_FILES", "def-[+ name +].lst")
|
|
||||||
r += gvar_add("UND_FILES", "und-[+ name +].lst")
|
|
||||||
r += gvar_add("MOD_FILES", "[+ name +].mod")
|
r += gvar_add("MOD_FILES", "[+ name +].mod")
|
||||||
r += gvar_add("platform_DATA", "[+ name +].mod")
|
r += gvar_add("MARKER_FILES", "[+ name +].marker")
|
||||||
r += gvar_add("CLEANFILES", "def-[+ name +].lst und-[+ name +].lst mod-[+ name +].c mod-[+ name +].o [+ name +].mod")
|
r += gvar_add("CLEANFILES", "[+ name +].marker")
|
||||||
|
|
||||||
r += gvar_add("COMMAND_FILES", "command-[+ name +].lst")
|
|
||||||
r += gvar_add("FS_FILES", "fs-[+ name +].lst")
|
|
||||||
r += gvar_add("VIDEO_FILES", "video-[+ name +].lst")
|
|
||||||
r += gvar_add("PARTMAP_FILES", "partmap-[+ name +].lst")
|
|
||||||
r += gvar_add("HANDLER_FILES", "handler-[+ name +].lst")
|
|
||||||
r += gvar_add("PARTTOOL_FILES", "parttool-[+ name +].lst")
|
|
||||||
r += gvar_add("TERMINAL_FILES", "terminal-[+ name +].lst")
|
|
||||||
r += gvar_add("CLEANFILES", "command-[+ name +].lst fs-[+ name +].lst")
|
|
||||||
r += gvar_add("CLEANFILES", "handler-[+ name +].lst terminal-[+ name +].lst")
|
|
||||||
r += gvar_add("CLEANFILES", "video-[+ name +].lst partmap-[+ name +].lst parttool-[+ name +].lst")
|
|
||||||
|
|
||||||
r += gvar_add("CLEANFILES", "[+ name +].pp")
|
|
||||||
r += """
|
r += """
|
||||||
[+ name +].pp: $(""" + cname() + """_SOURCES) $(nodist_""" + cname() + """_SOURCES)
|
[+ name +].marker: $(""" + cname() + """_SOURCES) $(nodist_""" + cname() + """_SOURCES)
|
||||||
$(TARGET_CPP) -DGRUB_LST_GENERATOR $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(""" + cname() + """_CPPFLAGS) $(CPPFLAGS) $^ > $@ || (rm -f $@; exit 1)
|
$(TARGET_CPP) -DGRUB_LST_GENERATOR $(CPPFLAGS_MARKER) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(""" + cname() + """_CPPFLAGS) $(CPPFLAGS) $^ > $@.new || (rm -f $@; exit 1)
|
||||||
|
grep 'MARKER' $@.new > $@; rm -f $@.new
|
||||||
def-[+ name +].lst: [+ name +].module$(EXEEXT)
|
|
||||||
if test x$(USE_APPLE_CC_FIXES) = xyes; then \
|
|
||||||
$(NM) -g -P -p $< | grep -E '^[a-zA-Z0-9_]* [TDS]' | sed "s/^\\([^ ]*\\).*/\\1 [+ name +]/" >> $@; \
|
|
||||||
else \
|
|
||||||
$(NM) -g --defined-only -P -p $< | sed "s/^\\([^ ]*\\).*/\\1 [+ name +]/" >> $@; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
und-[+ name +].lst: [+ name +].module$(EXEEXT)
|
|
||||||
$(NM) -u -P -p $< | sed "s/^\\([^ ]*\\).*/\\1 [+ name +]/" >> $@
|
|
||||||
|
|
||||||
mod-[+ name +].c: [+ name +].module$(EXEEXT) moddep.lst genmodsrc.sh
|
|
||||||
sh $(srcdir)/genmodsrc.sh [+ name +] moddep.lst > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
mod-[+ name +].o: mod-[+ name +].c
|
|
||||||
$(TARGET_CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(""" + cname() + """_CPPFLAGS) $(CPPFLAGS) $(""" + cname() + """_CFLAGS) $(CFLAGS) -c -o $@ $<
|
|
||||||
|
|
||||||
[+ name +].mod: [+ name +].module$(EXEEXT) mod-[+ name +].o
|
|
||||||
if test x$(USE_APPLE_CC_FIXES) = xyes; then \
|
|
||||||
$(CCLD) $(""" + cname() + """_LDFLAGS) $(LDFLAGS) -o $@.bin $^; \
|
|
||||||
$(OBJCONV) -f$(TARGET_MODULE_FORMAT) -nr:_grub_mod_init:grub_mod_init -nr:_grub_mod_fini:grub_mod_fini -wd1106 -nu -nd $@.bin $@; \
|
|
||||||
rm -f $@.bin; \
|
|
||||||
else \
|
|
||||||
$(CCLD) -o $@ $(""" + cname() + """_LDFLAGS) $(LDFLAGS) $^; \
|
|
||||||
if test ! -z '$(TARGET_OBJ2ELF)'; then $(TARGET_OBJ2ELF) $@ || (rm -f $@; exit 1); fi; \
|
|
||||||
$(STRIP) --strip-unneeded -K grub_mod_init -K grub_mod_fini -K _grub_mod_init -K _grub_mod_fini -R .note -R .comment $@; \
|
|
||||||
fi
|
|
||||||
|
|
||||||
command-[+ name +].lst: [+ name +].pp $(srcdir)/gencmdlist.sh
|
|
||||||
cat $< | sh $(srcdir)/gencmdlist.sh [+ name +] > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
fs-[+ name +].lst: [+ name +].pp $(srcdir)/genfslist.sh
|
|
||||||
cat $< | sh $(srcdir)/genfslist.sh [+ name +] > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
video-[+ name +].lst: [+ name +].pp $(srcdir)/genvideolist.sh
|
|
||||||
cat $< | sh $(srcdir)/genvideolist.sh [+ name +] > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
partmap-[+ name +].lst: [+ name +].pp $(srcdir)/genpartmaplist.sh
|
|
||||||
cat $< | sh $(srcdir)/genpartmaplist.sh [+ name +] > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
parttool-[+ name +].lst: [+ name +].pp $(srcdir)/genparttoollist.sh
|
|
||||||
cat $< | sh $(srcdir)/genparttoollist.sh [+ name +] > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
handler-[+ name +].lst: [+ name +].pp $(srcdir)/genhandlerlist.sh
|
|
||||||
cat $< | sh $(srcdir)/genhandlerlist.sh [+ name +] > $@ || (rm -f $@; exit 1)
|
|
||||||
|
|
||||||
terminal-[+ name +].lst: [+ name +].pp $(srcdir)/genterminallist.sh
|
|
||||||
cat $< | sh $(srcdir)/genterminallist.sh [+ name +] > $@ || (rm -f $@; exit 1)
|
|
||||||
"""
|
"""
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
@ -403,18 +437,25 @@ fi
|
||||||
|
|
||||||
def library(platform):
|
def library(platform):
|
||||||
r = set_canonical_name_suffix("")
|
r = set_canonical_name_suffix("")
|
||||||
r += gvar_add("noinst_LIBRARIES", "[+ name +]")
|
|
||||||
r += var_set(cname() + "_SOURCES", platform_sources(platform))
|
r += vars_init(cname() + "_SOURCES",
|
||||||
r += var_set("nodist_" + cname() + "_SOURCES", platform_nodist_sources(platform))
|
"nodist_" + cname() + "_SOURCES",
|
||||||
r += var_set(cname() + "_CFLAGS", "$(AM_CFLAGS) $(CFLAGS_LIBRARY) " + platform_cflags(platform))
|
cname() + "_CFLAGS",
|
||||||
r += var_set(cname() + "_CPPFLAGS", "$(AM_CPPFLAGS) $(CPPFLAGS_LIBRARY) " + platform_cppflags(platform))
|
cname() + "_CPPFLAGS",
|
||||||
r += var_set(cname() + "_CCASFLAGS", "$(AM_CCASFLAGS) $(CCASFLAGS_LIBRARY) " + platform_ccasflags(platform))
|
cname() + "_CCASFLAGS")
|
||||||
# r += var_set(cname() + "_DEPENDENCIES", platform_dependencies(platform) + " " + platform_ldadd(platform))
|
# cname() + "_DEPENDENCIES")
|
||||||
|
|
||||||
|
r += first_time(gvar_add("noinst_LIBRARIES", "[+ name +]"))
|
||||||
|
r += var_add(cname() + "_SOURCES", platform_sources(platform))
|
||||||
|
r += var_add("nodist_" + cname() + "_SOURCES", platform_nodist_sources(platform))
|
||||||
|
r += var_add(cname() + "_CFLAGS", first_time("$(AM_CFLAGS) $(CFLAGS_LIBRARY) ") + platform_cflags(platform))
|
||||||
|
r += var_add(cname() + "_CPPFLAGS", first_time("$(AM_CPPFLAGS) $(CPPFLAGS_LIBRARY) ") + platform_cppflags(platform))
|
||||||
|
r += var_add(cname() + "_CCASFLAGS", first_time("$(AM_CCASFLAGS) $(CCASFLAGS_LIBRARY) ") + platform_ccasflags(platform))
|
||||||
|
# r += var_add(cname() + "_DEPENDENCIES", platform_dependencies(platform) + " " + platform_ldadd(platform))
|
||||||
|
|
||||||
r += gvar_add("EXTRA_DIST", extra_dist())
|
r += gvar_add("EXTRA_DIST", extra_dist())
|
||||||
r += gvar_add("BUILT_SOURCES", "$(nodist_" + cname() + "_SOURCES)")
|
r += first_time(gvar_add("BUILT_SOURCES", "$(nodist_" + cname() + "_SOURCES)"))
|
||||||
r += gvar_add("CLEANFILES", "$(nodist_" + cname() + "_SOURCES)")
|
r += first_time(gvar_add("CLEANFILES", "$(nodist_" + cname() + "_SOURCES)"))
|
||||||
|
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def installdir(default="bin"):
|
def installdir(default="bin"):
|
||||||
|
@ -438,7 +479,7 @@ def program(platform, test=False):
|
||||||
r += gvar_add("check_PROGRAMS", "[+ name +]")
|
r += gvar_add("check_PROGRAMS", "[+ name +]")
|
||||||
r += gvar_add("TESTS", "[+ name +]")
|
r += gvar_add("TESTS", "[+ name +]")
|
||||||
r += "[+ ELSE +]"
|
r += "[+ ELSE +]"
|
||||||
r += gvar_add(installdir() + "_PROGRAMS", "[+ name +]")
|
r += var_add(installdir() + "_PROGRAMS", "[+ name +]")
|
||||||
r += "[+ IF mansection +]" + manpage() + "[+ ENDIF +]"
|
r += "[+ IF mansection +]" + manpage() + "[+ ENDIF +]"
|
||||||
r += "[+ ENDIF +]"
|
r += "[+ ENDIF +]"
|
||||||
|
|
||||||
|
@ -459,7 +500,7 @@ def program(platform, test=False):
|
||||||
def data(platform):
|
def data(platform):
|
||||||
r = gvar_add("EXTRA_DIST", platform_sources(platform))
|
r = gvar_add("EXTRA_DIST", platform_sources(platform))
|
||||||
r += gvar_add("EXTRA_DIST", extra_dist())
|
r += gvar_add("EXTRA_DIST", extra_dist())
|
||||||
r += gvar_add(installdir() + "_DATA", platform_sources(platform))
|
r += var_add(installdir() + "_DATA", platform_sources(platform))
|
||||||
return r
|
return r
|
||||||
|
|
||||||
def script(platform):
|
def script(platform):
|
||||||
|
@ -467,13 +508,12 @@ def script(platform):
|
||||||
r += gvar_add("check_SCRIPTS", "[+ name +]")
|
r += gvar_add("check_SCRIPTS", "[+ name +]")
|
||||||
r += gvar_add ("TESTS", "[+ name +]")
|
r += gvar_add ("TESTS", "[+ name +]")
|
||||||
r += "[+ ELSE +]"
|
r += "[+ ELSE +]"
|
||||||
r += gvar_add(installdir() + "_SCRIPTS", "[+ name +]")
|
r += var_add(installdir() + "_SCRIPTS", "[+ name +]")
|
||||||
r += "[+ IF mansection +]" + manpage() + "[+ ENDIF +]"
|
r += "[+ IF mansection +]" + manpage() + "[+ ENDIF +]"
|
||||||
r += "[+ ENDIF +]"
|
r += "[+ ENDIF +]"
|
||||||
|
|
||||||
r += rule("[+ name +]", "$(top_builddir)/config.status " + platform_sources(platform), """
|
r += rule("[+ name +]", platform_sources(platform) + " $(top_builddir)/config.status", """
|
||||||
$(top_builddir)/config.status --file=-:""" + platform_sources(platform) + """ \
|
$(top_builddir)/config.status --file=-:$< | sed -e 's,@pkglib_DATA@,$(pkglib_DATA),g' > $@
|
||||||
| sed -e 's,@pkglib_DATA@,$(pkglib_DATA),g' > $@
|
|
||||||
chmod a+x [+ name +]
|
chmod a+x [+ name +]
|
||||||
""")
|
""")
|
||||||
|
|
||||||
|
@ -481,35 +521,44 @@ chmod a+x [+ name +]
|
||||||
r += gvar_add("dist_noinst_DATA", platform_sources(platform))
|
r += gvar_add("dist_noinst_DATA", platform_sources(platform))
|
||||||
return r
|
return r
|
||||||
|
|
||||||
|
def rules(target, closure):
|
||||||
|
# Create association lists for the benefit of first_time and vars_init.
|
||||||
|
r = "[+ (define seen-target '()) +]"
|
||||||
|
r += "[+ (define seen-vars '()) +]"
|
||||||
|
# Most output goes to a diversion. This allows us to emit variable
|
||||||
|
# initializations before everything else.
|
||||||
|
r += "[+ (out-push-new) +]"
|
||||||
|
|
||||||
|
r += "[+ FOR " + target + " +]"
|
||||||
|
r += foreach_enabled_platform(
|
||||||
|
lambda p: under_platform_specific_conditionals(p, closure(p)))
|
||||||
|
# Remember that we've seen this target.
|
||||||
|
r += "[+ (set! seen-target (assoc-set! seen-target (get \".name\") 0)) +]"
|
||||||
|
r += "[+ ENDFOR +]"
|
||||||
|
r += "[+ (out-pop #t) +]"
|
||||||
|
return r
|
||||||
|
|
||||||
def module_rules():
|
def module_rules():
|
||||||
return "[+ FOR module +]" + foreach_enabled_platform(
|
return rules("module", module)
|
||||||
lambda p: under_platform_specific_conditionals(p, module(p))) + "[+ ENDFOR +]"
|
|
||||||
|
|
||||||
def kernel_rules():
|
def kernel_rules():
|
||||||
return "[+ FOR kernel +]" + foreach_enabled_platform(
|
return rules("kernel", kernel)
|
||||||
lambda p: under_platform_specific_conditionals(p, kernel(p))) + "[+ ENDFOR +]"
|
|
||||||
|
|
||||||
def image_rules():
|
def image_rules():
|
||||||
return "[+ FOR image +]" + foreach_enabled_platform(
|
return rules("image", image)
|
||||||
lambda p: under_platform_specific_conditionals(p, image(p))) + "[+ ENDFOR +]"
|
|
||||||
|
|
||||||
def library_rules():
|
def library_rules():
|
||||||
return "[+ FOR library +]" + foreach_enabled_platform(
|
return rules("library", library)
|
||||||
lambda p: under_platform_specific_conditionals(p, library(p))) + "[+ ENDFOR +]"
|
|
||||||
|
|
||||||
def program_rules():
|
def program_rules():
|
||||||
return "[+ FOR program +]" + foreach_enabled_platform(
|
return rules("program", program)
|
||||||
lambda p: under_platform_specific_conditionals(p, program(p))) + "[+ ENDFOR +]"
|
|
||||||
|
|
||||||
def script_rules():
|
def script_rules():
|
||||||
return "[+ FOR script +]" + foreach_enabled_platform(
|
return rules("script", script)
|
||||||
lambda p: under_platform_specific_conditionals(p, script(p))) + "[+ ENDFOR +]"
|
|
||||||
|
|
||||||
def data_rules():
|
def data_rules():
|
||||||
return "[+ FOR data +]" + foreach_enabled_platform(
|
return rules("data", data)
|
||||||
lambda p: under_platform_specific_conditionals(p, data(p))) + "[+ ENDFOR +]"
|
|
||||||
|
|
||||||
print "[+ AutoGen5 template +]\n"
|
|
||||||
a = module_rules()
|
a = module_rules()
|
||||||
b = kernel_rules()
|
b = kernel_rules()
|
||||||
c = image_rules()
|
c = image_rules()
|
||||||
|
@ -519,11 +568,28 @@ f = script_rules()
|
||||||
g = data_rules()
|
g = data_rules()
|
||||||
z = global_variable_initializers()
|
z = global_variable_initializers()
|
||||||
|
|
||||||
|
print ("[+ AutoGen5 template +]\n")
|
||||||
|
for p in GRUB_PLATFORMS:
|
||||||
|
print (define_macro_for_platform_sources(p))
|
||||||
|
print (define_macro_for_platform_nodist_sources(p))
|
||||||
|
# print define_macro_for_platform_dependencies(p)
|
||||||
|
|
||||||
|
print (define_macro_for_platform_startup(p))
|
||||||
|
print (define_macro_for_platform_cflags(p))
|
||||||
|
print (define_macro_for_platform_ldadd(p))
|
||||||
|
print (define_macro_for_platform_ldflags(p))
|
||||||
|
print (define_macro_for_platform_cppflags(p))
|
||||||
|
print (define_macro_for_platform_ccasflags(p))
|
||||||
|
print (define_macro_for_platform_stripflags(p))
|
||||||
|
print (define_macro_for_platform_objcopyflags(p))
|
||||||
|
|
||||||
|
print (define_macro_for_platform_conditionals_if_statement(p))
|
||||||
|
print (define_macro_for_platform_conditionals_endif_statement(p))
|
||||||
# print z # initializer for all vars
|
# print z # initializer for all vars
|
||||||
print a
|
print (a)
|
||||||
print b
|
print (b)
|
||||||
print c
|
print (c)
|
||||||
print d
|
print (d)
|
||||||
print e
|
print (e)
|
||||||
print f
|
print (f)
|
||||||
print g
|
print (g)
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
AUTOMAKE_OPTIONS = subdir-objects
|
AUTOMAKE_OPTIONS = subdir-objects -Wno-portability
|
||||||
|
|
||||||
DEPDIR=.deps-core
|
DEPDIR=.deps-core
|
||||||
|
|
||||||
|
@ -30,7 +30,7 @@ CCASFLAGS_LIBRARY += $(CCASFLAGS_PLATFORM)
|
||||||
|
|
||||||
# gentrigtables
|
# gentrigtables
|
||||||
gentrigtables: gentrigtables.c
|
gentrigtables: gentrigtables.c
|
||||||
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(CPPFLAGS) -lm $<
|
$(BUILD_CC) -o $@ -I$(top_srcdir)/include $(CPPFLAGS) $< -lm
|
||||||
CLEANFILES += gentrigtables
|
CLEANFILES += gentrigtables
|
||||||
|
|
||||||
# trigtables.c
|
# trigtables.c
|
||||||
|
@ -48,10 +48,15 @@ CLEANFILES += grub_script.tab.c grub_script.tab.h
|
||||||
grub_script.yy.h: script/yylex.l
|
grub_script.yy.h: script/yylex.l
|
||||||
$(LEX) -o grub_script.yy.c --header-file=grub_script.yy.h $<
|
$(LEX) -o grub_script.yy.c --header-file=grub_script.yy.h $<
|
||||||
grub_script.yy.c: grub_script.yy.h
|
grub_script.yy.c: grub_script.yy.h
|
||||||
|
|
||||||
|
rs_decoder.S: $(srcdir)/lib/reed_solomon.c
|
||||||
|
$(TARGET_CC) $(TARGET_CPPFLAGS) $(TARGET_CFLAGS) -Os -I$(top_builddir) -S -DSTANDALONE -o $@ $< -g0 -mregparm=3
|
||||||
|
|
||||||
|
kern/i386/pc/startup.S: $(builddir)/rs_decoder.S
|
||||||
|
|
||||||
CLEANFILES += grub_script.yy.c grub_script.yy.h
|
CLEANFILES += grub_script.yy.c grub_script.yy.h
|
||||||
|
|
||||||
include $(srcdir)/Makefile.core.am
|
include $(srcdir)/Makefile.core.am
|
||||||
include $(srcdir)/Makefile.gcry.am
|
|
||||||
|
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/cache.h
|
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/command.h
|
||||||
|
@ -73,12 +78,11 @@ 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/term.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/time.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/mm_private.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/net.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h
|
||||||
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/memory.h
|
||||||
|
|
||||||
if COND_i386_pc
|
if COND_i386_pc
|
||||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
|
|
||||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/loader.h
|
|
||||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
|
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/pxe.h
|
||||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/int.h
|
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/int.h
|
||||||
|
@ -93,25 +97,25 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if COND_i386_coreboot
|
if COND_i386_coreboot
|
||||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
|
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
|
||||||
|
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/i386/pc/int.h
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if COND_i386_multiboot
|
if COND_i386_multiboot
|
||||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
|
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
|
||||||
|
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/i386/pc/int.h
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if COND_i386_qemu
|
if COND_i386_qemu
|
||||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
|
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if COND_i386_ieee1275
|
if COND_i386_ieee1275
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
|
||||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
|
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.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/pit.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
@ -122,9 +126,41 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if COND_mips_yeeloong
|
if COND_ia64_efi
|
||||||
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/efi.h
|
||||||
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/time.h
|
||||||
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
|
||||||
|
endif
|
||||||
|
|
||||||
|
if COND_mips
|
||||||
|
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/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
|
||||||
|
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_builddir)/include/grub/cpu/cache.h
|
||||||
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bitmap.h
|
||||||
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.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/bitmap_scale.h
|
||||||
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bufio.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
|
||||||
|
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/kernel.h
|
||||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
|
|
||||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/cache.h
|
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/cache.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bitmap.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/bitmap.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/video.h
|
||||||
|
@ -135,21 +171,37 @@ 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/pci.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/cs5536.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/cs5536.h
|
||||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/pci.h
|
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/pci.h
|
||||||
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/serial.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
|
||||||
|
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
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if COND_powerpc_ieee1275
|
if COND_powerpc_ieee1275
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/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
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if COND_sparc64_ieee1275
|
if COND_sparc64_ieee1275
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sparc64/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
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if COND_emu
|
if COND_emu
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/datetime.h
|
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/misc.h
|
||||||
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/export.h
|
||||||
if COND_GRUB_EMU_SDL
|
if COND_GRUB_EMU_SDL
|
||||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sdl.h
|
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sdl.h
|
||||||
endif
|
endif
|
||||||
|
@ -176,13 +228,19 @@ symlist.c: symlist.h gensymlist.sh
|
||||||
CLEANFILES += symlist.c
|
CLEANFILES += symlist.c
|
||||||
BUILT_SOURCES += symlist.c
|
BUILT_SOURCES += symlist.c
|
||||||
|
|
||||||
|
if COND_HAVE_ASM_USCORE
|
||||||
|
ASM_PREFIX=_
|
||||||
|
else
|
||||||
|
ASM_PREFIX=
|
||||||
|
endif
|
||||||
|
|
||||||
noinst_DATA += kernel_syms.lst
|
noinst_DATA += kernel_syms.lst
|
||||||
|
|
||||||
kernel_syms.lst: $(KERNEL_HEADER_FILES) $(top_builddir)/config.h
|
kernel_syms.lst: $(KERNEL_HEADER_FILES) $(top_builddir)/config.h
|
||||||
$(TARGET_CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) $(CPPFLAGS) $(CFLAGS) -DGRUB_SYMBOL_GENERATOR=1 $^ >kernel_syms.input
|
$(TARGET_CPP) $(DEFS) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS_KERNEL) $(CPPFLAGS) $(CFLAGS) -DGRUB_SYMBOL_GENERATOR=1 $^ >kernel_syms.input
|
||||||
if grep "^#define HAVE_ASM_USCORE" $(top_builddir)/config.h; then u="_"; else u=""; fi; \
|
|
||||||
cat kernel_syms.input | grep -v '^#' | sed -n \
|
cat kernel_syms.input | grep -v '^#' | sed -n \
|
||||||
-e '/EXPORT_FUNC *([a-zA-Z0-9_]*)/{s/.*EXPORT_FUNC *(\([a-zA-Z0-9_]*\)).*/'"$$u"'\1 kernel/;p;}' \
|
-e '/EXPORT_FUNC *([a-zA-Z0-9_]*)/{s/.*EXPORT_FUNC *(\([a-zA-Z0-9_]*\)).*/defined kernel '"$(ASM_PREFIX)"'\1/;p;}' \
|
||||||
-e '/EXPORT_VAR *([a-zA-Z0-9_]*)/{s/.*EXPORT_VAR *(\([a-zA-Z0-9_]*\)).*/'"$$u"'\1 kernel/;p;}' \
|
-e '/EXPORT_VAR *([a-zA-Z0-9_]*)/{s/.*EXPORT_VAR *(\([a-zA-Z0-9_]*\)).*/defined kernel '"$(ASM_PREFIX)"'\1/;p;}' \
|
||||||
| sort -u >$@
|
| sort -u >$@
|
||||||
rm -f kernel_syms.input
|
rm -f kernel_syms.input
|
||||||
CLEANFILES += kernel_syms.lst
|
CLEANFILES += kernel_syms.lst
|
||||||
|
@ -202,61 +260,92 @@ grub_emu_init.c: grub_emu_init.h genemuinit.sh $(MOD_FILES)
|
||||||
CLEANFILES += grub_emu_init.c
|
CLEANFILES += grub_emu_init.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# .lst files
|
# List files
|
||||||
platform_DATA += moddep.lst
|
|
||||||
platform_DATA += fs.lst
|
|
||||||
platform_DATA += command.lst
|
|
||||||
platform_DATA += partmap.lst
|
|
||||||
platform_DATA += handler.lst
|
|
||||||
platform_DATA += terminal.lst
|
|
||||||
platform_DATA += parttool.lst
|
|
||||||
platform_DATA += video.lst
|
|
||||||
platform_DATA += crypto.lst
|
|
||||||
CLEANFILES += moddep.lst
|
|
||||||
CLEANFILES += handler.lst
|
|
||||||
CLEANFILES += terminal.lst
|
|
||||||
CLEANFILES += parttool.lst
|
|
||||||
CLEANFILES += video.lst
|
|
||||||
CLEANFILES += crypto.lst
|
|
||||||
|
|
||||||
fs.lst: $(FS_FILES)
|
fs.lst: $(MARKER_FILES)
|
||||||
cat $^ /dev/null | sort | uniq > $@
|
(for pp in $^; do \
|
||||||
|
b=`basename $$pp .marker`; \
|
||||||
|
if grep 'FS_LIST_MARKER' $$pp >/dev/null 2>&1; then \
|
||||||
|
echo $$b; \
|
||||||
|
fi; \
|
||||||
|
done) | sort -u > $@
|
||||||
|
platform_DATA += fs.lst
|
||||||
CLEANFILES += fs.lst
|
CLEANFILES += fs.lst
|
||||||
|
|
||||||
command.lst: $(COMMAND_FILES)
|
command.lst: $(MARKER_FILES)
|
||||||
cat $^ /dev/null | sort | uniq > $@
|
(for pp in $^; do \
|
||||||
|
b=`basename $$pp .marker`; \
|
||||||
|
sed -n \
|
||||||
|
-e "/EXTCOMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/*\1: $$b/;p;}" \
|
||||||
|
-e "/P1COMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/*\1: $$b/;p;}" \
|
||||||
|
-e "/COMMAND_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/\1: $$b/;p;}" $$pp; \
|
||||||
|
done) | sort -u > $@
|
||||||
|
platform_DATA += command.lst
|
||||||
CLEANFILES += command.lst
|
CLEANFILES += command.lst
|
||||||
|
|
||||||
partmap.lst: $(PARTMAP_FILES)
|
partmap.lst: $(MARKER_FILES)
|
||||||
cat $^ /dev/null | sort | uniq > $@
|
(for pp in $^; do \
|
||||||
|
b=`basename $$pp .marker`; \
|
||||||
|
if grep 'PARTMAP_LIST_MARKER' $$pp >/dev/null 2>&1; then \
|
||||||
|
echo $$b; \
|
||||||
|
fi; \
|
||||||
|
done) | sort -u > $@
|
||||||
|
platform_DATA += partmap.lst
|
||||||
CLEANFILES += partmap.lst
|
CLEANFILES += partmap.lst
|
||||||
|
|
||||||
handler.lst: $(HANDLER_FILES)
|
terminal.lst: $(MARKER_FILES)
|
||||||
cat $^ /dev/null | sort | uniq > $@
|
(for pp in $^; do \
|
||||||
CLEANFILES += handler.lst
|
b=`basename $$pp .marker`; \
|
||||||
|
sed -n \
|
||||||
terminal.lst: $(TERMINAL_FILES)
|
-e "/INPUT_TERMINAL_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/i\1: $$b/;p;}" \
|
||||||
cat $^ /dev/null | sort | uniq > $@
|
-e "/OUTPUT_TERMINAL_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/o\1: $$b/;p;}" $$pp; \
|
||||||
|
done) | sort -u > $@
|
||||||
|
platform_DATA += terminal.lst
|
||||||
CLEANFILES += terminal.lst
|
CLEANFILES += terminal.lst
|
||||||
|
|
||||||
parttool.lst: $(PARTTOOL_FILES)
|
parttool.lst: $(MARKER_FILES)
|
||||||
cat $^ /dev/null | sort | uniq > $@
|
(for pp in $^; do \
|
||||||
|
b=`basename $$pp .marker`; \
|
||||||
|
sed -n \
|
||||||
|
-e "/PARTTOOL_LIST_MARKER *( *\"/{s/.*( *\"\([^\"]*\)\".*/\1: $$b/;p;}" $$pp; \
|
||||||
|
done) | sort -u > $@
|
||||||
|
platform_DATA += parttool.lst
|
||||||
CLEANFILES += parttool.lst
|
CLEANFILES += parttool.lst
|
||||||
|
|
||||||
video.lst: $(VIDEO_FILES)
|
video.lst: $(MARKER_FILES)
|
||||||
cat $^ /dev/null | sort | uniq > $@
|
(for pp in $^; do \
|
||||||
|
b=`basename $$pp .marker`; \
|
||||||
|
if grep 'VIDEO_LIST_MARKER' $$pp >/dev/null 2>&1; then \
|
||||||
|
echo $$b; \
|
||||||
|
fi; \
|
||||||
|
done) | sort -u > $@
|
||||||
|
platform_DATA += video.lst
|
||||||
CLEANFILES += video.lst
|
CLEANFILES += video.lst
|
||||||
|
|
||||||
# but, crypto.lst is simply copied
|
# but, crypto.lst is simply copied
|
||||||
crypto.lst: $(srcdir)/lib/libgcrypt-grub/cipher/crypto.lst
|
crypto.lst: $(srcdir)/lib/libgcrypt-grub/cipher/crypto.lst
|
||||||
cp $^ $@
|
cp $^ $@
|
||||||
|
platform_DATA += crypto.lst
|
||||||
CLEANFILES += crypto.lst
|
CLEANFILES += crypto.lst
|
||||||
|
|
||||||
|
syminfo.lst: gensyminfo.sh kernel_syms.lst $(MODULE_FILES)
|
||||||
|
cat kernel_syms.lst > $@.new
|
||||||
|
for m in $(MODULE_FILES); do \
|
||||||
|
sh $< $$m >> $@.new || exit 1; \
|
||||||
|
done
|
||||||
|
mv $@.new $@
|
||||||
|
|
||||||
# generate global module dependencies list
|
# generate global module dependencies list
|
||||||
moddep.lst: kernel_syms.lst genmoddep.awk $(DEF_FILES) $(UND_FILES)
|
moddep.lst: syminfo.lst genmoddep.awk
|
||||||
cat $(DEF_FILES) kernel_syms.lst /dev/null \
|
cat $< | sort | awk -f $(srcdir)/genmoddep.awk > $@ || (rm -f $@; exit 1)
|
||||||
| $(AWK) -f $(srcdir)/genmoddep.awk $(UND_FILES) > $@ \
|
platform_DATA += moddep.lst
|
||||||
|| (rm -f $@; exit 1)
|
CLEANFILES += config.log syminfo.lst moddep.lst
|
||||||
|
|
||||||
|
$(MOD_FILES): %.mod : genmod.sh moddep.lst %.module$(EXEEXT)
|
||||||
|
TARGET_OBJ2ELF=@TARGET_OBJ2ELF@ sh $^ $@
|
||||||
|
platform_DATA += $(MOD_FILES)
|
||||||
|
platform_DATA += modinfo.sh
|
||||||
|
CLEANFILES += $(MOD_FILES)
|
||||||
|
|
||||||
if COND_ENABLE_EFIEMU
|
if COND_ENABLE_EFIEMU
|
||||||
efiemu32.o: efiemu/runtime/efiemu.c $(TARGET_OBJ2ELF)
|
efiemu32.o: efiemu/runtime/efiemu.c $(TARGET_OBJ2ELF)
|
||||||
|
|
File diff suppressed because it is too large
Load diff
102
grub-core/boot/decompressor/minilib.c
Normal file
102
grub-core/boot/decompressor/minilib.c
Normal file
|
@ -0,0 +1,102 @@
|
||||||
|
/*
|
||||||
|
* GRUB -- GRand Unified Bootloader
|
||||||
|
* Copyright (C) 2010 Free Software Foundation, Inc.
|
||||||
|
*
|
||||||
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GRUB is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <grub/types.h>
|
||||||
|
#include <grub/misc.h>
|
||||||
|
#include <grub/decompressor.h>
|
||||||
|
|
||||||
|
void *
|
||||||
|
memset (void *s, int c, grub_size_t len)
|
||||||
|
{
|
||||||
|
grub_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)
|
||||||
|
{
|
||||||
|
char *d = (char *) dest;
|
||||||
|
const char *s = (const char *) src;
|
||||||
|
|
||||||
|
if (d < s)
|
||||||
|
while (n--)
|
||||||
|
*d++ = *s++;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d += n;
|
||||||
|
s += n;
|
||||||
|
|
||||||
|
while (n--)
|
||||||
|
*--d = *--s;
|
||||||
|
}
|
||||||
|
|
||||||
|
return dest;
|
||||||
|
}
|
||||||
|
|
||||||
|
int
|
||||||
|
grub_memcmp (const void *s1, const void *s2, grub_size_t n)
|
||||||
|
{
|
||||||
|
const char *t1 = s1;
|
||||||
|
const char *t2 = s2;
|
||||||
|
|
||||||
|
while (n--)
|
||||||
|
{
|
||||||
|
if (*t1 != *t2)
|
||||||
|
return (int) *t1 - (int) *t2;
|
||||||
|
|
||||||
|
t1++;
|
||||||
|
t2++;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
int memcmp (const void *s1, const void *s2, grub_size_t n)
|
||||||
|
__attribute__ ((alias ("grub_memcmp")));
|
||||||
|
|
||||||
|
void *memmove (void *dest, const void *src, grub_size_t n)
|
||||||
|
__attribute__ ((alias ("grub_memmove")));
|
||||||
|
|
||||||
|
void *memcpy (void *dest, const void *src, grub_size_t n)
|
||||||
|
__attribute__ ((alias ("grub_memmove")));
|
||||||
|
|
||||||
|
void *grub_decompressor_scratch;
|
||||||
|
|
||||||
|
void
|
||||||
|
find_scratch (void *src, void *dst, unsigned long srcsize,
|
||||||
|
unsigned long dstsize)
|
||||||
|
{
|
||||||
|
#ifdef _mips
|
||||||
|
/* Decoding from ROM. */
|
||||||
|
if (((grub_addr_t) src & 0x10000000))
|
||||||
|
{
|
||||||
|
grub_decompressor_scratch = (void *) ALIGN_UP((grub_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,
|
||||||
|
256);
|
||||||
|
else
|
||||||
|
grub_decompressor_scratch = (void *) ALIGN_UP ((grub_addr_t) dst + dstsize,
|
||||||
|
256);
|
||||||
|
return;
|
||||||
|
}
|
42
grub-core/boot/decompressor/none.c
Normal file
42
grub-core/boot/decompressor/none.c
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
/*
|
||||||
|
* GRUB -- GRand Unified Bootloader
|
||||||
|
* Copyright (C) 2010 Free Software Foundation, Inc.
|
||||||
|
*
|
||||||
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GRUB is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <grub/decompressor.h>
|
||||||
|
|
||||||
|
void
|
||||||
|
grub_decompress_core (void *src, void *dest, unsigned long n,
|
||||||
|
unsigned long dstsize __attribute__ ((unused)))
|
||||||
|
{
|
||||||
|
char *d = (char *) dest;
|
||||||
|
const char *s = (const char *) src;
|
||||||
|
|
||||||
|
if (d == s)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (d < s)
|
||||||
|
while (n--)
|
||||||
|
*d++ = *s++;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
d += n;
|
||||||
|
s += n;
|
||||||
|
|
||||||
|
while (n--)
|
||||||
|
*--d = *--s;
|
||||||
|
}
|
||||||
|
}
|
60
grub-core/boot/decompressor/xz.c
Normal file
60
grub-core/boot/decompressor/xz.c
Normal file
|
@ -0,0 +1,60 @@
|
||||||
|
/*
|
||||||
|
* GRUB -- GRand Unified Bootloader
|
||||||
|
* Copyright (C) 2010 Free Software Foundation, Inc.
|
||||||
|
*
|
||||||
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GRUB is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <grub/types.h>
|
||||||
|
#include <grub/misc.h>
|
||||||
|
#include <grub/decompressor.h>
|
||||||
|
|
||||||
|
#include "xz.h"
|
||||||
|
#include "xz_stream.h"
|
||||||
|
|
||||||
|
void
|
||||||
|
grub_decompress_core (void *src, void *dst, unsigned long srcsize,
|
||||||
|
unsigned long dstsize)
|
||||||
|
{
|
||||||
|
struct xz_dec *dec;
|
||||||
|
struct xz_buf buf;
|
||||||
|
|
||||||
|
find_scratch (src, dst, srcsize, dstsize);
|
||||||
|
|
||||||
|
dec = xz_dec_init (GRUB_DECOMPRESSOR_DICT_SIZE);
|
||||||
|
|
||||||
|
buf.in = src;
|
||||||
|
buf.in_pos = 0;
|
||||||
|
buf.in_size = srcsize;
|
||||||
|
buf.out = dst;
|
||||||
|
buf.out_pos = 0;
|
||||||
|
buf.out_size = dstsize;
|
||||||
|
|
||||||
|
while (buf.in_pos != buf.in_size)
|
||||||
|
{
|
||||||
|
enum xz_ret xzret;
|
||||||
|
xzret = xz_dec_run (dec, &buf);
|
||||||
|
switch (xzret)
|
||||||
|
{
|
||||||
|
case XZ_MEMLIMIT_ERROR:
|
||||||
|
case XZ_FORMAT_ERROR:
|
||||||
|
case XZ_OPTIONS_ERROR:
|
||||||
|
case XZ_DATA_ERROR:
|
||||||
|
case XZ_BUF_ERROR:
|
||||||
|
return;
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <grub/symbol.h>
|
#include <grub/symbol.h>
|
||||||
#include <grub/boot.h>
|
|
||||||
#include <grub/machine/boot.h>
|
#include <grub/machine/boot.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -112,12 +111,16 @@ LOCAL(after_BPB):
|
||||||
*/
|
*/
|
||||||
. = _start + GRUB_BOOT_MACHINE_DRIVE_CHECK
|
. = _start + GRUB_BOOT_MACHINE_DRIVE_CHECK
|
||||||
boot_drive_check:
|
boot_drive_check:
|
||||||
jmp 1f /* grub-setup may overwrite this jump */
|
jmp 3f /* grub-setup may overwrite this jump */
|
||||||
testb $0x80, %dl
|
testb $0x80, %dl
|
||||||
jnz 1f
|
jz 2f
|
||||||
|
3:
|
||||||
|
/* Ignore %dl different from 0-0x0f and 0x80-0x8f. */
|
||||||
|
testb $0x70, %dl
|
||||||
|
jz 1f
|
||||||
|
2:
|
||||||
movb $0x80, %dl
|
movb $0x80, %dl
|
||||||
1:
|
1:
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ljmp to the next instruction because some bogus BIOSes
|
* ljmp to the next instruction because some bogus BIOSes
|
||||||
* jump to 07C0:0000 instead of 0000:7C00.
|
* jump to 07C0:0000 instead of 0000:7C00.
|
||||||
|
@ -455,6 +458,8 @@ fd_probe_error_string: .asciz "Floppy"
|
||||||
1:
|
1:
|
||||||
/* perform read */
|
/* perform read */
|
||||||
movw $GRUB_BOOT_MACHINE_BUFFER_SEG, %bx
|
movw $GRUB_BOOT_MACHINE_BUFFER_SEG, %bx
|
||||||
|
movw %bx, %es
|
||||||
|
xorw %bx, %bx
|
||||||
movw $0x201, %ax
|
movw $0x201, %ax
|
||||||
movb $0, %ch
|
movb $0, %ch
|
||||||
movb $0, %dh
|
movb $0, %dh
|
||||||
|
|
|
@ -18,7 +18,6 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <grub/symbol.h>
|
#include <grub/symbol.h>
|
||||||
#include <grub/boot.h>
|
|
||||||
#include <grub/machine/boot.h>
|
#include <grub/machine/boot.h>
|
||||||
#include <grub/machine/kernel.h>
|
#include <grub/machine/kernel.h>
|
||||||
#include <multiboot.h>
|
#include <multiboot.h>
|
||||||
|
|
|
@ -19,7 +19,6 @@
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <grub/symbol.h>
|
#include <grub/symbol.h>
|
||||||
#include <grub/boot.h>
|
|
||||||
#include <grub/machine/boot.h>
|
#include <grub/machine/boot.h>
|
||||||
#include <grub/machine/kernel.h>
|
#include <grub/machine/kernel.h>
|
||||||
#include <multiboot.h>
|
#include <multiboot.h>
|
||||||
|
@ -178,14 +177,19 @@ real_code_2:
|
||||||
pushw %es
|
pushw %es
|
||||||
popw %ds
|
popw %ds
|
||||||
|
|
||||||
|
#if GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART + 4 < 0x200
|
||||||
movl $0x200, %ecx
|
movl $0x200, %ecx
|
||||||
addl %ecx, %esi
|
addl %ecx, %esi
|
||||||
|
#else
|
||||||
|
movl $(GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART + 4), %ecx
|
||||||
|
addl $0x200, %esi
|
||||||
|
#endif
|
||||||
movl $DATA_ADDR, %edi
|
movl $DATA_ADDR, %edi
|
||||||
|
|
||||||
call LOCAL(move_memory)
|
call LOCAL(move_memory)
|
||||||
|
|
||||||
/* Check for multiboot signature. */
|
/* Check for multiboot signature. */
|
||||||
cmpl $MULTIBOOT_HEADER_MAGIC, %ss:(DATA_ADDR + GRUB_KERNEL_I386_PC_MULTIBOOT_SIGNATURE)
|
cmpl $MULTIBOOT_HEADER_MAGIC, %ss:(DATA_ADDR + GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART)
|
||||||
jz 1f
|
jz 1f
|
||||||
|
|
||||||
movl (ramdisk_image - start), %esi
|
movl (ramdisk_image - start), %esi
|
||||||
|
@ -195,17 +199,12 @@ real_code_2:
|
||||||
|
|
||||||
1:
|
1:
|
||||||
|
|
||||||
movl %ss:(DATA_ADDR + GRUB_KERNEL_MACHINE_COMPRESSED_SIZE), %ecx
|
movl %ss:(DATA_ADDR + GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE), %ecx
|
||||||
addl $(GRUB_KERNEL_MACHINE_RAW_SIZE - 0x200), %ecx
|
addl $((0x9000 - 0x8200) - (GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART + 4)), %ecx
|
||||||
|
|
||||||
2:
|
2:
|
||||||
call LOCAL(move_memory)
|
call LOCAL(move_memory)
|
||||||
|
|
||||||
movsbl %dh, %eax
|
|
||||||
movl %eax, %ss:(DATA_ADDR + GRUB_KERNEL_MACHINE_INSTALL_DOS_PART)
|
|
||||||
movsbl (reg_edx + 2 - start), %eax
|
|
||||||
movl %eax, %ss:(DATA_ADDR + GRUB_KERNEL_MACHINE_INSTALL_BSD_PART)
|
|
||||||
|
|
||||||
movb $0xFF, %dh
|
movb $0xFF, %dh
|
||||||
|
|
||||||
ljmp $(DATA_ADDR >> 4), $0
|
ljmp $(DATA_ADDR >> 4), $0
|
||||||
|
|
|
@ -77,69 +77,6 @@
|
||||||
#define RepLenCoder (LenCoder + kNumLenProbs)
|
#define RepLenCoder (LenCoder + kNumLenProbs)
|
||||||
#define Literal (RepLenCoder + kNumLenProbs)
|
#define Literal (RepLenCoder + kNumLenProbs)
|
||||||
|
|
||||||
|
|
||||||
#if 0
|
|
||||||
|
|
||||||
DbgOut:
|
|
||||||
pushf
|
|
||||||
pushl %ebp
|
|
||||||
pushl %edi
|
|
||||||
pushl %esi
|
|
||||||
pushl %edx
|
|
||||||
pushl %ecx
|
|
||||||
pushl %ebx
|
|
||||||
pushl %eax
|
|
||||||
|
|
||||||
call _DebugPrint
|
|
||||||
|
|
||||||
popl %eax
|
|
||||||
popl %ebx
|
|
||||||
popl %ecx
|
|
||||||
popl %edx
|
|
||||||
popl %esi
|
|
||||||
popl %edi
|
|
||||||
popl %ebp
|
|
||||||
popf
|
|
||||||
|
|
||||||
ret
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
|
||||||
* int LzmaDecodeProperties(CLzmaProperties *propsRes,
|
|
||||||
* const unsigned char *propsData,
|
|
||||||
* int size);
|
|
||||||
*/
|
|
||||||
|
|
||||||
_LzmaDecodePropertiesA:
|
|
||||||
movb (%edx), %dl
|
|
||||||
|
|
||||||
xorl %ecx, %ecx
|
|
||||||
1:
|
|
||||||
cmpb $45, %dl
|
|
||||||
jb 2f
|
|
||||||
incl %ecx
|
|
||||||
subb $45, %dl
|
|
||||||
jmp 1b
|
|
||||||
2:
|
|
||||||
movl %ecx, 8(%eax) /* pb */
|
|
||||||
xorl %ecx, %ecx
|
|
||||||
1:
|
|
||||||
cmpb $9, %dl
|
|
||||||
jb 2f
|
|
||||||
incl %ecx
|
|
||||||
subb $9, %dl
|
|
||||||
2:
|
|
||||||
movl %ecx, 4(%eax) /* lp */
|
|
||||||
movb %dl, %cl
|
|
||||||
movl %ecx, (%eax) /* lc */
|
|
||||||
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef ASM_FILE
|
|
||||||
xorl %eax, %eax
|
|
||||||
#endif
|
|
||||||
ret
|
|
||||||
|
|
||||||
#define out_size 8(%ebp)
|
#define out_size 8(%ebp)
|
||||||
|
|
||||||
#define now_pos -4(%ebp)
|
#define now_pos -4(%ebp)
|
346
grub-core/boot/i386/pc/startup_raw.S
Normal file
346
grub-core/boot/i386/pc/startup_raw.S
Normal file
|
@ -0,0 +1,346 @@
|
||||||
|
/*
|
||||||
|
* GRUB -- 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
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GRUB is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <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>
|
||||||
|
|
||||||
|
#define ABS(x) ((x) - LOCAL (base) + GRUB_BOOT_MACHINE_KERNEL_ADDR + 0x200)
|
||||||
|
|
||||||
|
.file "startup_raw.S"
|
||||||
|
|
||||||
|
.text
|
||||||
|
|
||||||
|
/* Tell GAS to generate 16-bit instructions so that this code works
|
||||||
|
in real mode. */
|
||||||
|
.code16
|
||||||
|
|
||||||
|
.globl start, _start
|
||||||
|
start:
|
||||||
|
_start:
|
||||||
|
LOCAL (base):
|
||||||
|
/*
|
||||||
|
* Guarantee that "main" is loaded at 0x0:0x8200.
|
||||||
|
*/
|
||||||
|
#ifdef __APPLE__
|
||||||
|
ljmp $0, $(ABS(LOCAL (codestart)) - 0x10000)
|
||||||
|
#else
|
||||||
|
ljmp $0, $ABS(LOCAL (codestart))
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is a special data area.
|
||||||
|
*/
|
||||||
|
|
||||||
|
. = _start + GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE
|
||||||
|
LOCAL(compressed_size):
|
||||||
|
.long 0
|
||||||
|
. = _start + GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE
|
||||||
|
LOCAL(uncompressed_size):
|
||||||
|
.long 0
|
||||||
|
|
||||||
|
. = _start + GRUB_KERNEL_I386_PC_REED_SOLOMON_REDUNDANCY
|
||||||
|
reed_solomon_redundancy:
|
||||||
|
.long 0
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This is the area for all of the special variables.
|
||||||
|
*/
|
||||||
|
|
||||||
|
LOCAL(boot_dev):
|
||||||
|
.byte 0xFF, 0xFF, 0xFF
|
||||||
|
LOCAL(boot_drive):
|
||||||
|
.byte 0x00
|
||||||
|
|
||||||
|
/* the real mode code continues... */
|
||||||
|
LOCAL (codestart):
|
||||||
|
cli /* we're not safe here! */
|
||||||
|
|
||||||
|
/* set up %ds, %ss, and %es */
|
||||||
|
xorw %ax, %ax
|
||||||
|
movw %ax, %ds
|
||||||
|
movw %ax, %ss
|
||||||
|
movw %ax, %es
|
||||||
|
|
||||||
|
/* set up the real mode/BIOS stack */
|
||||||
|
movl $GRUB_MEMORY_MACHINE_REAL_STACK, %ebp
|
||||||
|
movl %ebp, %esp
|
||||||
|
|
||||||
|
sti /* we're safe again */
|
||||||
|
|
||||||
|
/* save the boot drive */
|
||||||
|
ADDR32 movb %dl, LOCAL(boot_drive)
|
||||||
|
|
||||||
|
/* reset disk system (%ah = 0) */
|
||||||
|
int $0x13
|
||||||
|
|
||||||
|
/* transition to protected mode */
|
||||||
|
DATA32 call real_to_prot
|
||||||
|
|
||||||
|
/* The ".code32" directive takes GAS out of 16-bit mode. */
|
||||||
|
.code32
|
||||||
|
|
||||||
|
incl %eax
|
||||||
|
call grub_gate_a20
|
||||||
|
|
||||||
|
movl LOCAL(compressed_size), %edx
|
||||||
|
addl $(LOCAL(decompressor_end) - GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART - _start), %edx
|
||||||
|
movl reed_solomon_redundancy, %ecx
|
||||||
|
leal _start + GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART, %eax
|
||||||
|
call EXT_C (grub_reed_solomon_recover)
|
||||||
|
jmp post_reed_solomon
|
||||||
|
|
||||||
|
#include <rs_decoder.S>
|
||||||
|
|
||||||
|
.text
|
||||||
|
|
||||||
|
. = _start + GRUB_KERNEL_I386_PC_NO_REED_SOLOMON_PART
|
||||||
|
/*
|
||||||
|
* Support for booting GRUB from a Multiboot boot loader (e.g. GRUB itself).
|
||||||
|
* This uses the a.out kludge to load raw binary to the area starting at 1MB,
|
||||||
|
* and relocates itself after loaded.
|
||||||
|
*/
|
||||||
|
.p2align 2 /* force 4-byte alignment */
|
||||||
|
multiboot_header:
|
||||||
|
/* magic */
|
||||||
|
.long 0x1BADB002
|
||||||
|
/* flags */
|
||||||
|
.long (1 << 16)
|
||||||
|
/* checksum */
|
||||||
|
.long -0x1BADB002 - (1 << 16)
|
||||||
|
/* header addr */
|
||||||
|
.long multiboot_header - _start + 0x100000 + 0x200
|
||||||
|
/* load addr */
|
||||||
|
.long 0x100000
|
||||||
|
/* load end addr */
|
||||||
|
.long 0
|
||||||
|
/* bss end addr */
|
||||||
|
.long 0
|
||||||
|
/* entry addr */
|
||||||
|
.long multiboot_entry - _start + 0x100000 + 0x200
|
||||||
|
|
||||||
|
multiboot_entry:
|
||||||
|
.code32
|
||||||
|
/* obtain the boot device */
|
||||||
|
movl 12(%ebx), %edx
|
||||||
|
|
||||||
|
movl $GRUB_MEMORY_MACHINE_PROT_STACK, %ebp
|
||||||
|
movl %ebp, %esp
|
||||||
|
|
||||||
|
/* relocate the code */
|
||||||
|
movl $(LOCAL(decompressor_end) + 0x200), %ecx
|
||||||
|
addl LOCAL(compressed_size) - _start + 0x100000 + 0x200, %ecx
|
||||||
|
movl $0x100000, %esi
|
||||||
|
movl $GRUB_BOOT_MACHINE_KERNEL_ADDR, %edi
|
||||||
|
cld
|
||||||
|
rep
|
||||||
|
movsb
|
||||||
|
/* jump to the real address */
|
||||||
|
movl $multiboot_trampoline, %eax
|
||||||
|
jmp *%eax
|
||||||
|
|
||||||
|
multiboot_trampoline:
|
||||||
|
/* fill the boot information */
|
||||||
|
movl %edx, LOCAL(boot_dev)
|
||||||
|
shrl $24, %edx
|
||||||
|
/* enter the usual booting */
|
||||||
|
call prot_to_real
|
||||||
|
.code16
|
||||||
|
jmp LOCAL (codestart)
|
||||||
|
.code32
|
||||||
|
|
||||||
|
post_reed_solomon:
|
||||||
|
|
||||||
|
#ifdef ENABLE_LZMA
|
||||||
|
movl $GRUB_MEMORY_MACHINE_DECOMPRESSION_ADDR, %edi
|
||||||
|
movl $LOCAL(decompressor_end), %esi
|
||||||
|
pushl %edi
|
||||||
|
movl LOCAL (uncompressed_size), %ecx
|
||||||
|
leal (%edi, %ecx), %ebx
|
||||||
|
call _LzmaDecodeA
|
||||||
|
/* _LzmaDecodeA clears DF, so no need to run cld */
|
||||||
|
popl %esi
|
||||||
|
#endif
|
||||||
|
|
||||||
|
movl LOCAL(boot_dev), %edx
|
||||||
|
movl $prot_to_real, %edi
|
||||||
|
movl $real_to_prot, %ecx
|
||||||
|
jmp *%esi
|
||||||
|
|
||||||
|
#include "../../../kern/i386/realmode.S"
|
||||||
|
|
||||||
|
/*
|
||||||
|
* grub_gate_a20(int on)
|
||||||
|
*
|
||||||
|
* Gate address-line 20 for high memory.
|
||||||
|
*
|
||||||
|
* This routine is probably overconservative in what it does, but so what?
|
||||||
|
*
|
||||||
|
* It also eats any keystrokes in the keyboard buffer. :-(
|
||||||
|
*/
|
||||||
|
|
||||||
|
grub_gate_a20:
|
||||||
|
movl %eax, %edx
|
||||||
|
|
||||||
|
gate_a20_test_current_state:
|
||||||
|
/* first of all, test if already in a good state */
|
||||||
|
call gate_a20_check_state
|
||||||
|
cmpb %al, %dl
|
||||||
|
jnz gate_a20_try_bios
|
||||||
|
ret
|
||||||
|
|
||||||
|
gate_a20_try_bios:
|
||||||
|
/* second, try a BIOS call */
|
||||||
|
pushl %ebp
|
||||||
|
call prot_to_real
|
||||||
|
|
||||||
|
.code16
|
||||||
|
movw $0x2400, %ax
|
||||||
|
testb %dl, %dl
|
||||||
|
jz 1f
|
||||||
|
incw %ax
|
||||||
|
1: int $0x15
|
||||||
|
|
||||||
|
DATA32 call real_to_prot
|
||||||
|
.code32
|
||||||
|
|
||||||
|
popl %ebp
|
||||||
|
call gate_a20_check_state
|
||||||
|
cmpb %al, %dl
|
||||||
|
jnz gate_a20_try_system_control_port_a
|
||||||
|
ret
|
||||||
|
|
||||||
|
gate_a20_try_system_control_port_a:
|
||||||
|
/*
|
||||||
|
* In macbook, the keyboard test would hang the machine, so we move
|
||||||
|
* this forward.
|
||||||
|
*/
|
||||||
|
/* fourth, try the system control port A */
|
||||||
|
inb $0x92
|
||||||
|
andb $(~0x03), %al
|
||||||
|
testb %dl, %dl
|
||||||
|
jz 6f
|
||||||
|
orb $0x02, %al
|
||||||
|
6: outb $0x92
|
||||||
|
|
||||||
|
/* When turning off Gate A20, do not check the state strictly,
|
||||||
|
because a failure is not fatal usually, and Gate A20 is always
|
||||||
|
on some modern machines. */
|
||||||
|
testb %dl, %dl
|
||||||
|
jz 7f
|
||||||
|
call gate_a20_check_state
|
||||||
|
cmpb %al, %dl
|
||||||
|
jnz gate_a20_try_keyboard_controller
|
||||||
|
7: ret
|
||||||
|
|
||||||
|
gate_a20_flush_keyboard_buffer:
|
||||||
|
inb $0x64
|
||||||
|
andb $0x02, %al
|
||||||
|
jnz gate_a20_flush_keyboard_buffer
|
||||||
|
2:
|
||||||
|
inb $0x64
|
||||||
|
andb $0x01, %al
|
||||||
|
jz 3f
|
||||||
|
inb $0x60
|
||||||
|
jmp 2b
|
||||||
|
3:
|
||||||
|
ret
|
||||||
|
|
||||||
|
gate_a20_try_keyboard_controller:
|
||||||
|
/* third, try the keyboard controller */
|
||||||
|
call gate_a20_flush_keyboard_buffer
|
||||||
|
|
||||||
|
movb $0xd1, %al
|
||||||
|
outb $0x64
|
||||||
|
4:
|
||||||
|
inb $0x64
|
||||||
|
andb $0x02, %al
|
||||||
|
jnz 4b
|
||||||
|
|
||||||
|
movb $0xdd, %al
|
||||||
|
testb %dl, %dl
|
||||||
|
jz 5f
|
||||||
|
orb $0x02, %al
|
||||||
|
5: outb $0x60
|
||||||
|
call gate_a20_flush_keyboard_buffer
|
||||||
|
|
||||||
|
/* output a dummy command (USB keyboard hack) */
|
||||||
|
movb $0xff, %al
|
||||||
|
outb $0x64
|
||||||
|
call gate_a20_flush_keyboard_buffer
|
||||||
|
|
||||||
|
call gate_a20_check_state
|
||||||
|
cmpb %al, %dl
|
||||||
|
/* everything failed, so restart from the beginning */
|
||||||
|
jnz gate_a20_try_bios
|
||||||
|
ret
|
||||||
|
|
||||||
|
gate_a20_check_state:
|
||||||
|
/* iterate the checking for a while */
|
||||||
|
movl $100, %ecx
|
||||||
|
1:
|
||||||
|
call 3f
|
||||||
|
cmpb %al, %dl
|
||||||
|
jz 2f
|
||||||
|
loop 1b
|
||||||
|
2:
|
||||||
|
ret
|
||||||
|
3:
|
||||||
|
pushl %ebx
|
||||||
|
pushl %ecx
|
||||||
|
xorl %eax, %eax
|
||||||
|
/* compare the byte at 0x8000 with that at 0x108000 */
|
||||||
|
movl $GRUB_BOOT_MACHINE_KERNEL_ADDR, %ebx
|
||||||
|
pushl %ebx
|
||||||
|
/* save the original byte in CL */
|
||||||
|
movb (%ebx), %cl
|
||||||
|
/* store the value at 0x108000 in AL */
|
||||||
|
addl $0x100000, %ebx
|
||||||
|
movb (%ebx), %al
|
||||||
|
/* try to set one less value at 0x8000 */
|
||||||
|
popl %ebx
|
||||||
|
movb %al, %ch
|
||||||
|
decb %ch
|
||||||
|
movb %ch, (%ebx)
|
||||||
|
/* serialize */
|
||||||
|
outb %al, $0x80
|
||||||
|
outb %al, $0x80
|
||||||
|
/* obtain the value at 0x108000 in CH */
|
||||||
|
pushl %ebx
|
||||||
|
addl $0x100000, %ebx
|
||||||
|
movb (%ebx), %ch
|
||||||
|
/* this result is 1 if A20 is on or 0 if it is off */
|
||||||
|
subb %ch, %al
|
||||||
|
xorb $1, %al
|
||||||
|
/* restore the original */
|
||||||
|
popl %ebx
|
||||||
|
movb %cl, (%ebx)
|
||||||
|
popl %ecx
|
||||||
|
popl %ebx
|
||||||
|
ret
|
||||||
|
|
||||||
|
#ifdef ENABLE_LZMA
|
||||||
|
#include "lzma_decode.S"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
.p2align 2
|
||||||
|
|
||||||
|
LOCAL(decompressor_end):
|
|
@ -18,6 +18,7 @@
|
||||||
|
|
||||||
#include <config.h>
|
#include <config.h>
|
||||||
#include <grub/symbol.h>
|
#include <grub/symbol.h>
|
||||||
|
#include <grub/i386/pc/memory.h>
|
||||||
#include <grub/machine/memory.h>
|
#include <grub/machine/memory.h>
|
||||||
#include <grub/machine/boot.h>
|
#include <grub/machine/boot.h>
|
||||||
#include <grub/machine/kernel.h>
|
#include <grub/machine/kernel.h>
|
||||||
|
|
2
grub-core/boot/mips/loongson/fuloong2f.S
Normal file
2
grub-core/boot/mips/loongson/fuloong2f.S
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
#define FULOONG2F 1
|
||||||
|
#include "fwstart.S"
|
|
@ -16,51 +16,73 @@
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <grub/mips/yeeloong/serial.h>
|
#include <grub/mips/loongson/serial.h>
|
||||||
#include <grub/mips/yeeloong/pci.h>
|
#include <grub/mips/loongson/pci.h>
|
||||||
#include <grub/mips/loongson.h>
|
#include <grub/mips/loongson.h>
|
||||||
#include <grub/pci.h>
|
#include <grub/pci.h>
|
||||||
#include <grub/machine/serial.h>
|
#include <grub/machine/serial.h>
|
||||||
|
#include <grub/machine/kernel.h>
|
||||||
#include <grub/ns8250.h>
|
#include <grub/ns8250.h>
|
||||||
#include <grub/cs5536.h>
|
#include <grub/cs5536.h>
|
||||||
#include <grub/smbus.h>
|
#include <grub/smbus.h>
|
||||||
|
|
||||||
|
#ifdef FULOONG2F
|
||||||
|
#define GRUB_MACHINE_SERIAL_PORT GRUB_MACHINE_SERIAL_PORT2
|
||||||
|
#define GRUB_MACHINE_SERIAL_DIVISOR_115200 GRUB_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
|
||||||
|
#endif
|
||||||
|
|
||||||
.set noreorder
|
.set noreorder
|
||||||
.set noat
|
.set noat
|
||||||
.set nomacro
|
.set nomacro
|
||||||
|
.set mips3
|
||||||
|
|
||||||
.global start,_start,__start
|
.global start,_start,__start
|
||||||
start:
|
start:
|
||||||
_start:
|
_start:
|
||||||
__start:
|
__start:
|
||||||
|
/* Put serial init as soon as possible. But on Fuloong2f serial is past
|
||||||
|
Geode, so on Fuloong2f we need Geode first.
|
||||||
|
*/
|
||||||
|
#ifndef FULOONG2F
|
||||||
bal serial_hw_init
|
bal serial_hw_init
|
||||||
nop
|
nop
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Find CS5536 controller. */
|
/* Find CS5536 controller. */
|
||||||
/* $t4 chooses device in priority encoding. */
|
/* $t4 chooses device in priority encoding. */
|
||||||
/* Resulting value is kept in GRUB_MACHINE_PCI_CONF_CTRL_REG.
|
/* Resulting value is kept in GRUB_MACHINE_PCI_CONF_CTRL_REG.
|
||||||
This way we don't need to sacrifice a register for it. */
|
This way we don't need to sacrifice a register for it. */
|
||||||
|
retry_cs5536:
|
||||||
/* We have only one bus (0). Function is 0. */
|
/* We have only one bus (0). Function is 0. */
|
||||||
lui $t0, %hi(GRUB_MACHINE_PCI_CONF_CTRL_REG_ADDR)
|
lui $t0, %hi(GRUB_MACHINE_PCI_CONF_CTRL_REG_ADDR)
|
||||||
lui $t1, %hi(GRUB_MACHINE_PCI_CONFSPACE)
|
lui $t1, %hi(GRUB_MACHINE_PCI_CONFSPACE)
|
||||||
lui $t3, %hi(GRUB_CS5536_PCIID)
|
lui $t3, %hi(GRUB_CS5536_PCIID)
|
||||||
addiu $t3, $t3, %lo(GRUB_CS5536_PCIID)
|
addiu $t3, $t3, %lo(GRUB_CS5536_PCIID)
|
||||||
ori $t4, $zero, 1
|
ori $t4, $zero, 1
|
||||||
lui $a0, %hi(no_cs5536)
|
|
||||||
1:
|
1:
|
||||||
andi $t4, $t4, ((1 << GRUB_PCI_NUM_DEVICES) - 1)
|
andi $t4, $t4, ((1 << GRUB_PCI_NUM_DEVICES) - 1)
|
||||||
beql $t4, $zero, fatal
|
/* In case of failure try again. CS5536 may be slow to come up. */
|
||||||
addiu $a0, $a0, %lo(no_cs5536)
|
beql $t4, $zero, retry_cs5536
|
||||||
|
nop
|
||||||
sw $t4, %lo(GRUB_MACHINE_PCI_CONF_CTRL_REG_ADDR) ($t0)
|
sw $t4, %lo(GRUB_MACHINE_PCI_CONF_CTRL_REG_ADDR) ($t0)
|
||||||
lw $t2, (%lo(GRUB_MACHINE_PCI_CONFSPACE) + GRUB_PCI_REG_PCI_ID) ($t1)
|
lw $t2, (%lo(GRUB_MACHINE_PCI_CONFSPACE) + GRUB_PCI_REG_PCI_ID) ($t1)
|
||||||
bnel $t2, $t3, 1b
|
bnel $t2, $t3, 1b
|
||||||
sll $t4, $t4, 1
|
sll $t4, $t4, 1
|
||||||
|
|
||||||
|
#ifndef FULOONG2F
|
||||||
bal message
|
bal message
|
||||||
addiu $a0, $a0, %lo(cs5536_found)
|
addiu $a0, $a0, %lo(cs5536_found)
|
||||||
bal printhex
|
bal printhex
|
||||||
move $a0, $t4
|
move $a0, $t4
|
||||||
|
#endif
|
||||||
|
|
||||||
|
lui $t0, %hi(GRUB_MACHINE_PCI_CONFSPACE)
|
||||||
|
li $t1, GRUB_CS5536_MSR_MAILBOX_CONFIG_ENABLED
|
||||||
|
sw $t1, (%lo(GRUB_MACHINE_PCI_CONFSPACE) + GRUB_CS5536_MSR_MAILBOX_CONFIG) ($t0)
|
||||||
|
|
||||||
/* Initialise SMBus controller. */
|
|
||||||
/* Set GPIO LBAR. */
|
/* Set GPIO LBAR. */
|
||||||
lui $a0, %hi(GRUB_CS5536_MSR_GPIO_BAR)
|
lui $a0, %hi(GRUB_CS5536_MSR_GPIO_BAR)
|
||||||
addiu $a0, $a0, %lo(GRUB_CS5536_MSR_GPIO_BAR)
|
addiu $a0, $a0, %lo(GRUB_CS5536_MSR_GPIO_BAR)
|
||||||
|
@ -70,6 +92,15 @@ __start:
|
||||||
ori $a2, $zero, ((GRUB_CS5536_LBAR_MASK_MASK \
|
ori $a2, $zero, ((GRUB_CS5536_LBAR_MASK_MASK \
|
||||||
| GRUB_CS5536_LBAR_ENABLE) >> 32)
|
| GRUB_CS5536_LBAR_ENABLE) >> 32)
|
||||||
|
|
||||||
|
bal gpio_init
|
||||||
|
nop
|
||||||
|
|
||||||
|
#ifdef FULOONG2F
|
||||||
|
bal serial_hw_init
|
||||||
|
nop
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Initialise SMBus controller. */
|
||||||
/* Set SMBUS LBAR. */
|
/* Set SMBUS LBAR. */
|
||||||
lui $a0, %hi(GRUB_CS5536_MSR_SMB_BAR)
|
lui $a0, %hi(GRUB_CS5536_MSR_SMB_BAR)
|
||||||
addiu $a0, $a0, %lo(GRUB_CS5536_MSR_SMB_BAR)
|
addiu $a0, $a0, %lo(GRUB_CS5536_MSR_SMB_BAR)
|
||||||
|
@ -83,14 +114,6 @@ __start:
|
||||||
bal message
|
bal message
|
||||||
addiu $a0, $a0, %lo(smbus_enabled)
|
addiu $a0, $a0, %lo(smbus_enabled)
|
||||||
|
|
||||||
/* Enable SMBus controller pins. */
|
|
||||||
lui $t0, %hi(GRUB_MACHINE_PCI_IO_BASE + GRUB_CS5536_LBAR_GPIO)
|
|
||||||
ori $t1, $zero, GRUB_GPIO_SMBUS_PINS
|
|
||||||
sw $t1, %lo(GRUB_MACHINE_PCI_IO_BASE + GRUB_CS5536_LBAR_GPIO + GRUB_GPIO_REG_OUT_EN) ($t0)
|
|
||||||
sw $t1, %lo(GRUB_MACHINE_PCI_IO_BASE + GRUB_CS5536_LBAR_GPIO + GRUB_GPIO_REG_OUT_AUX1) ($t0)
|
|
||||||
sw $t1, %lo(GRUB_MACHINE_PCI_IO_BASE + GRUB_CS5536_LBAR_GPIO + GRUB_GPIO_REG_IN_EN) ($t0)
|
|
||||||
sw $t1, %lo(GRUB_MACHINE_PCI_IO_BASE + GRUB_CS5536_LBAR_GPIO + GRUB_GPIO_REG_IN_AUX1) ($t0)
|
|
||||||
|
|
||||||
lui $t0, %hi(GRUB_MACHINE_PCI_IO_BASE + GRUB_CS5536_LBAR_SMBUS)
|
lui $t0, %hi(GRUB_MACHINE_PCI_IO_BASE + GRUB_CS5536_LBAR_SMBUS)
|
||||||
|
|
||||||
/* Disable SMB. */
|
/* Disable SMB. */
|
||||||
|
@ -107,7 +130,7 @@ __start:
|
||||||
sb $t1, %lo(GRUB_MACHINE_PCI_IO_BASE + GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL3) ($t0)
|
sb $t1, %lo(GRUB_MACHINE_PCI_IO_BASE + GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL3) ($t0)
|
||||||
sb $t1, %lo(GRUB_MACHINE_PCI_IO_BASE + GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL2) ($t0)
|
sb $t1, %lo(GRUB_MACHINE_PCI_IO_BASE + GRUB_CS5536_LBAR_SMBUS + GRUB_CS5536_SMB_REG_CTRL2) ($t0)
|
||||||
|
|
||||||
/* Yeeloong has only one memory slot. */
|
/* Yeeloong and Fuloong2f have only one memory slot. */
|
||||||
/* Output first byte on serial for debugging. */
|
/* Output first byte on serial for debugging. */
|
||||||
ori $a1, $zero, GRUB_SMB_RAM_START_ADDR
|
ori $a1, $zero, GRUB_SMB_RAM_START_ADDR
|
||||||
bal read_spd
|
bal read_spd
|
||||||
|
@ -120,7 +143,7 @@ __start:
|
||||||
ori $t0, $zero, GRUB_SMBUS_SPD_MEMORY_TYPE_DDR2
|
ori $t0, $zero, GRUB_SMBUS_SPD_MEMORY_TYPE_DDR2
|
||||||
lui $a0, %hi(unimplemented_memory_type)
|
lui $a0, %hi(unimplemented_memory_type)
|
||||||
bne $t0, $v0, fatal
|
bne $t0, $v0, fatal
|
||||||
addiu $a0, $a0, %hi(unimplemented_memory_type)
|
addiu $a0, $a0, %lo(unimplemented_memory_type)
|
||||||
|
|
||||||
/* And here is our goal: DDR2 controller initialisation. */
|
/* And here is our goal: DDR2 controller initialisation. */
|
||||||
lui $t0, %hi(GRUB_CPU_LOONGSON_CORECFG)
|
lui $t0, %hi(GRUB_CPU_LOONGSON_CORECFG)
|
||||||
|
@ -206,10 +229,54 @@ other_exception:
|
||||||
b fatal
|
b fatal
|
||||||
addiu $a0, $a0, %lo(unhandled_exception)
|
addiu $a0, $a0, %lo(unhandled_exception)
|
||||||
|
|
||||||
|
gpio_init:
|
||||||
|
lui $t0, %hi(GRUB_MACHINE_PCI_IO_BASE + GRUB_CS5536_LBAR_GPIO)
|
||||||
|
addiu $t0, $t0, %lo(GRUB_MACHINE_PCI_IO_BASE + GRUB_CS5536_LBAR_GPIO)
|
||||||
|
lui $t1, %hi (gpio_dump)
|
||||||
|
addiu $t1, $t1, %lo (gpio_dump)
|
||||||
|
|
||||||
|
1:
|
||||||
|
lw $t2, 0($t1)
|
||||||
|
sw $t2, 0($t0)
|
||||||
|
addiu $t0, $t0, 4
|
||||||
|
addiu $t1, $t1, 4
|
||||||
|
lui $t2, %hi (gpio_dump_end)
|
||||||
|
addiu $t2, $t2, %lo (gpio_dump_end)
|
||||||
|
bne $t1, $t2, 1b
|
||||||
|
nop
|
||||||
|
jr $ra
|
||||||
|
nop
|
||||||
|
|
||||||
/* Same as similarly named C function but in asm since
|
/* Same as similarly named C function but in asm since
|
||||||
we need it early. */
|
we need it early. */
|
||||||
/* In: none. Out: none. Clobbered: $t0, $t1, $a0. */
|
/* In: none. Out: none. Clobbered: $t0, $t1, $t2, $a0, $a1, $a2. */
|
||||||
serial_hw_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)
|
||||||
|
bal wrmsr
|
||||||
|
move $a2, $zero
|
||||||
|
|
||||||
|
lui $a0, %hi(GRUB_CS5536_MSR_DIVIL_UART1_CONF)
|
||||||
|
addiu $a0, $a0, %lo(GRUB_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)
|
||||||
|
li $a1, 2
|
||||||
|
bal wrmsr
|
||||||
|
move $a2, $zero
|
||||||
|
#endif
|
||||||
|
|
||||||
lui $t0, %hi (GRUB_MACHINE_SERIAL_PORT)
|
lui $t0, %hi (GRUB_MACHINE_SERIAL_PORT)
|
||||||
|
|
||||||
/* Turn off the interrupt. */
|
/* Turn off the interrupt. */
|
||||||
|
@ -239,6 +306,7 @@ serial_hw_init:
|
||||||
/* Let message return to original caller. */
|
/* Let message return to original caller. */
|
||||||
lui $a0, %hi(notification_string)
|
lui $a0, %hi(notification_string)
|
||||||
addiu $a0, $a0, %lo(notification_string)
|
addiu $a0, $a0, %lo(notification_string)
|
||||||
|
move $ra, $t2
|
||||||
|
|
||||||
/* Print message on serial console. */
|
/* Print message on serial console. */
|
||||||
/* In: $a0 = asciiz message. Out: none. Clobbered: $t0, $t1, $a0. */
|
/* In: $a0 = asciiz message. Out: none. Clobbered: $t0, $t1, $a0. */
|
||||||
|
@ -379,7 +447,6 @@ read_spd_fail:
|
||||||
ori $v0, $v0, 0x100
|
ori $v0, $v0, 0x100
|
||||||
|
|
||||||
notification_string: .asciz "GRUB "
|
notification_string: .asciz "GRUB "
|
||||||
no_cs5536: .asciz "No CS5536 found.\n\r"
|
|
||||||
cs5536_found: .asciz "CS5536 at "
|
cs5536_found: .asciz "CS5536 at "
|
||||||
sm_failed: .asciz "SM transaction failed.\n\r"
|
sm_failed: .asciz "SM transaction failed.\n\r"
|
||||||
unhandled_tlb_refill: .asciz "Unhandled TLB refill.\n\r"
|
unhandled_tlb_refill: .asciz "Unhandled TLB refill.\n\r"
|
||||||
|
@ -404,14 +471,22 @@ regdump:
|
||||||
.quad 0x0100020200010101 /* 4 */
|
.quad 0x0100020200010101 /* 4 */
|
||||||
.quad 0x0a04030603050203 /* 6 */
|
.quad 0x0a04030603050203 /* 6 */
|
||||||
.quad 0x0f0e040000010a0b /* 7 */
|
.quad 0x0f0e040000010a0b /* 7 */
|
||||||
|
#ifdef FULOONG2F
|
||||||
|
.quad 0x0000000100000001 /* 8 */
|
||||||
|
#else
|
||||||
.quad 0x0000010200000102 /* 8 */
|
.quad 0x0000010200000102 /* 8 */
|
||||||
|
#endif
|
||||||
.quad 0x0000060c00000000 /* 9 */
|
.quad 0x0000060c00000000 /* 9 */
|
||||||
.quad 0x2323233f3f1f0200 /* a */
|
.quad 0x2323233f3f1f0200 /* a */
|
||||||
.quad 0x5f7f232323232323 /* b */
|
.quad 0x5f7f232323232323 /* b */
|
||||||
.quad 0x002a3c0615000000 /* c */
|
.quad 0x002a3c0615000000 /* c */
|
||||||
.quad 0x002a002a002a002a /* d */
|
.quad 0x002a002a002a002a /* d */
|
||||||
.quad 0x002a002a002a002a /* e */
|
.quad 0x002a002a002a002a /* e */
|
||||||
|
#ifdef FULOONG2F
|
||||||
|
.quad 0x00b40020005b0004 /* f */
|
||||||
|
#else
|
||||||
.quad 0x00b40020006d0004 /* f */
|
.quad 0x00b40020006d0004 /* f */
|
||||||
|
#endif
|
||||||
.quad 0x070007ff00000087 /* 10 */
|
.quad 0x070007ff00000087 /* 10 */
|
||||||
.quad 0x000000000016101f /* 11 */
|
.quad 0x000000000016101f /* 11 */
|
||||||
.quad 0x001c000000000000 /* 12 */
|
.quad 0x001c000000000000 /* 12 */
|
||||||
|
@ -426,6 +501,45 @@ regdump:
|
||||||
.quad 0 /* 1b */
|
.quad 0 /* 1b */
|
||||||
.quad 0 /* 1c */
|
.quad 0 /* 1c */
|
||||||
|
|
||||||
|
/* Dump of GPIO connections. FIXME: Remove useless and macroify. */
|
||||||
|
gpio_dump:
|
||||||
|
#ifdef FULOONG2F
|
||||||
|
.long 0xffff0000, 0x2eefd110, 0xffff0000, 0xffff0000
|
||||||
|
.long 0x2eefd110, 0xffff0000, 0x1000efff, 0xefff1000
|
||||||
|
.long 0x3df3c20c, 0xffff0000, 0xffff0000, 0xffff0000
|
||||||
|
.long 0x7df3820c, 0x3df3c20c, 0xffff0000, 0x00000000
|
||||||
|
.long 0xffff0000, 0xffff0000, 0x3de3c21c, 0x3d83c27c
|
||||||
|
.long 0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||||
|
.long 0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||||
|
.long 0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||||
|
.long 0xffff0000, 0xffff0000, 0xffff0000, 0xffff0000
|
||||||
|
.long 0xffff0000, 0xffff0000, 0x0000ffff, 0xffff0000
|
||||||
|
.long 0xefff1000, 0xffff0000, 0xffff0000, 0xffff0000
|
||||||
|
.long 0xefff1000, 0xefff1000, 0xffff0000, 0x00000000
|
||||||
|
.long 0xffff0000, 0xffff0000, 0xefff1000, 0xefff1000
|
||||||
|
.long 0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||||
|
.long 0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||||
|
.long 0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||||
|
#else
|
||||||
|
.long 0xffff0000, 0x2ffdd002, 0xffff0000, 0xffff0000
|
||||||
|
.long 0x2fffd000, 0xffff0000, 0x1000efff, 0xefff1000
|
||||||
|
.long 0x3ffbc004, 0xffff0000, 0xffff0000, 0xffff0000
|
||||||
|
.long 0x3ffbc004, 0x3ffbc004, 0xffff0000, 0x00000000
|
||||||
|
.long 0xffff0000, 0xffff0000, 0x3ffbc004, 0x3f9bc064
|
||||||
|
.long 0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||||
|
.long 0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||||
|
.long 0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||||
|
.long 0xffff0000, 0xffff0000, 0xffff0000, 0xffff0000
|
||||||
|
.long 0xffff0000, 0xffff0000, 0x0000ffff, 0xffff0000
|
||||||
|
.long 0xefff1000, 0xffff0000, 0xffff0000, 0xffff0000
|
||||||
|
.long 0xefff1000, 0xefff1000, 0xffff0000, 0x00000000
|
||||||
|
.long 0xffff0000, 0xffff0000, 0xefff1000, 0xffff0000
|
||||||
|
.long 0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||||
|
.long 0x00000000, 0x00000000, 0x00000000, 0x00000000
|
||||||
|
.long 0x00000000, 0x50000000, 0x00000000, 0x00000000
|
||||||
|
#endif
|
||||||
|
gpio_dump_end:
|
||||||
|
|
||||||
.p2align
|
.p2align
|
||||||
|
|
||||||
write_dumpreg:
|
write_dumpreg:
|
||||||
|
@ -626,6 +740,10 @@ continue:
|
||||||
lui $t0, %hi(cached_continue - 0x20000000)
|
lui $t0, %hi(cached_continue - 0x20000000)
|
||||||
addiu $t0, $t0, %lo(cached_continue - 0x20000000)
|
addiu $t0, $t0, %lo(cached_continue - 0x20000000)
|
||||||
jr $t0
|
jr $t0
|
||||||
addiu $a2, $zero, -1
|
#ifdef FULOONG2F
|
||||||
|
addiu $a2, $zero, -(1 + GRUB_ARCH_MACHINE_FULOONG2F)
|
||||||
|
#else
|
||||||
|
addiu $a2, $zero, -(1 + GRUB_ARCH_MACHINE_YEELOONG)
|
||||||
|
#endif
|
||||||
|
|
||||||
cached_continue:
|
cached_continue:
|
269
grub-core/boot/mips/startup_raw.S
Normal file
269
grub-core/boot/mips/startup_raw.S
Normal file
|
@ -0,0 +1,269 @@
|
||||||
|
/* startup.S - Startup code for the MIPS. */
|
||||||
|
/*
|
||||||
|
* GRUB -- GRand Unified Bootloader
|
||||||
|
* Copyright (C) 2009 Free Software Foundation, Inc.
|
||||||
|
*
|
||||||
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GRUB is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <grub/symbol.h>
|
||||||
|
#include <grub/offsets.h>
|
||||||
|
#include <grub/machine/memory.h>
|
||||||
|
#include <grub/machine/kernel.h>
|
||||||
|
#include <grub/offsets.h>
|
||||||
|
|
||||||
|
#define BASE_ADDR 8
|
||||||
|
|
||||||
|
.extern __bss_start
|
||||||
|
.extern _end
|
||||||
|
|
||||||
|
.globl __start, _start, start
|
||||||
|
.set noreorder
|
||||||
|
.set nomacro
|
||||||
|
__start:
|
||||||
|
_start:
|
||||||
|
start:
|
||||||
|
|
||||||
|
bal codestart
|
||||||
|
nop
|
||||||
|
base:
|
||||||
|
. = _start + GRUB_DECOMPRESSOR_MACHINE_COMPRESSED_SIZE
|
||||||
|
compressed_size:
|
||||||
|
.long 0
|
||||||
|
. = _start + GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_SIZE
|
||||||
|
uncompressed_size:
|
||||||
|
.long 0
|
||||||
|
. = _start + GRUB_DECOMPRESSOR_MACHINE_UNCOMPRESSED_ADDR
|
||||||
|
uncompressed_addr:
|
||||||
|
.long 0
|
||||||
|
codestart:
|
||||||
|
/* Save our base. */
|
||||||
|
move $s0, $ra
|
||||||
|
|
||||||
|
/* Parse arguments. Has to be done before relocation.
|
||||||
|
So need to do it in asm. */
|
||||||
|
#ifdef GRUB_MACHINE_MIPS_QEMU_MIPS
|
||||||
|
lui $t0, %hi (((16 << 20) - 264 + 4) | 0x80000000)
|
||||||
|
lw $t1, %lo (((16 << 20) - 264 + 4) | 0x80000000) ($t0)
|
||||||
|
|
||||||
|
lui $t2, 0x1234
|
||||||
|
ori $t2, 0x5678
|
||||||
|
|
||||||
|
bne $t1, $t2, 1f
|
||||||
|
nop
|
||||||
|
|
||||||
|
lui $t0, %hi (((16 << 20) - 264) | 0x80000000)
|
||||||
|
b 2f
|
||||||
|
lw $s4, %lo (((16 << 20) - 264) | 0x80000000) ($t0)
|
||||||
|
|
||||||
|
1:
|
||||||
|
li $s4, 0
|
||||||
|
2:
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||||
|
move $s2, $zero
|
||||||
|
move $s3, $zero
|
||||||
|
move $s4, $zero
|
||||||
|
move $s5, $zero
|
||||||
|
move $s7, $zero
|
||||||
|
|
||||||
|
/* $a2 has the environment. */
|
||||||
|
addiu $t0, $zero, -0x10
|
||||||
|
and $t1, $a2, $t0
|
||||||
|
beq $t0, $t1, argfw
|
||||||
|
nop
|
||||||
|
move $t0, $a2
|
||||||
|
argcont:
|
||||||
|
lw $t1, 0($t0)
|
||||||
|
beq $t1, $zero, argdone
|
||||||
|
nop
|
||||||
|
#define DO_PARSE(str, reg) \
|
||||||
|
addiu $t2, $s0, (str-base);\
|
||||||
|
bal parsestr;\
|
||||||
|
nop ;\
|
||||||
|
beq $v0, $zero, 1f;\
|
||||||
|
nop ;\
|
||||||
|
b 2f;\
|
||||||
|
move reg, $v0; \
|
||||||
|
1:
|
||||||
|
#define DO_CHECKT1(str, val) \
|
||||||
|
move $t6, $t1 ;\
|
||||||
|
addiu $t7, $s0, (str - base);\
|
||||||
|
bal do_check ;\
|
||||||
|
li $t2, val
|
||||||
|
|
||||||
|
DO_PARSE (busclockstr, $s2)
|
||||||
|
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)
|
||||||
|
2:
|
||||||
|
b argcont
|
||||||
|
addiu $t0, $t0, 4
|
||||||
|
parsestr:
|
||||||
|
move $v0, $zero
|
||||||
|
move $t3, $t1
|
||||||
|
3:
|
||||||
|
lb $t4, 0($t2)
|
||||||
|
lb $t5, 0($t3)
|
||||||
|
addiu $t2, $t2, 1
|
||||||
|
addiu $t3, $t3, 1
|
||||||
|
beq $t5, $zero, 1f
|
||||||
|
nop
|
||||||
|
beq $t5, $t4, 3b
|
||||||
|
nop
|
||||||
|
bne $t4, $zero, 1f
|
||||||
|
nop
|
||||||
|
|
||||||
|
addiu $t3, $t3, 0xffff
|
||||||
|
digcont:
|
||||||
|
lb $t5, 0($t3)
|
||||||
|
/* Substract '0' from digit. */
|
||||||
|
addiu $t5, $t5, 0xffd0
|
||||||
|
bltz $t5, 1f
|
||||||
|
nop
|
||||||
|
addiu $t4, $t5, 0xfff7
|
||||||
|
bgtz $t4, 1f
|
||||||
|
nop
|
||||||
|
/* Multiply $v0 by 10 with bitshifts. */
|
||||||
|
sll $v0, $v0, 1
|
||||||
|
sll $t4, $v0, 2
|
||||||
|
addu $v0, $v0, $t4
|
||||||
|
addu $v0, $v0, $t5
|
||||||
|
addiu $t3, $t3, 1
|
||||||
|
b digcont
|
||||||
|
nop
|
||||||
|
1:
|
||||||
|
jr $ra
|
||||||
|
nop
|
||||||
|
busclockstr: .asciiz "busclock="
|
||||||
|
cpuclockstr: .asciiz "cpuclock="
|
||||||
|
memsizestr: .asciiz "memsize="
|
||||||
|
highmemsizestr: .asciiz "highmemsize="
|
||||||
|
machtype_yeeloong_str1: .asciiz "machtype=8.9"
|
||||||
|
machtype_yeeloong_str2: .asciiz "machtype=lemote-yeeloong-"
|
||||||
|
machtype_fuloong2f_str: .asciiz "machtype=lemote-fuloong-2f"
|
||||||
|
machtype_fuloong2e_str: .asciiz "machtype=lemote-fuloong-2e"
|
||||||
|
pmon_yeeloong_str: .asciiz "PMON_VER=LM8"
|
||||||
|
pmon_fuloong2f_str: .asciiz "PMON_VER=LM6"
|
||||||
|
pmon_yeeloong_verstr: .asciiz "Version=LM8"
|
||||||
|
pmon_fuloong2f_verstr: .asciiz "Version=LM6"
|
||||||
|
.p2align 2
|
||||||
|
|
||||||
|
argdone:
|
||||||
|
beq $a0, $zero, cmdlinedone
|
||||||
|
nop
|
||||||
|
#define DO_CHECKA1(str, val) \
|
||||||
|
lw $t6, 0($a1) ;\
|
||||||
|
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)
|
||||||
|
addiu $a0, $a0, -1
|
||||||
|
b argdone
|
||||||
|
addiu $a1, $a1, 4
|
||||||
|
do_check:
|
||||||
|
lb $t4, 0($t7)
|
||||||
|
beq $t4, $zero, 1f
|
||||||
|
lb $t3, 0($t6)
|
||||||
|
bne $t3, $t4, 2f
|
||||||
|
addiu $t6, $t6, 1
|
||||||
|
b do_check
|
||||||
|
addiu $t7, $t7, 1
|
||||||
|
1:
|
||||||
|
move $s7, $t2
|
||||||
|
2:
|
||||||
|
jr $ra
|
||||||
|
nop
|
||||||
|
argfw:
|
||||||
|
not $s7, $a2
|
||||||
|
cmdlinedone:
|
||||||
|
#endif
|
||||||
|
/* Copy the decompressor. */
|
||||||
|
lui $t1, %hi(base)
|
||||||
|
addiu $t1, $t1, %lo(base)
|
||||||
|
lui $t3, %hi(__bss_start)
|
||||||
|
addiu $t3, $t3, %lo(__bss_start)
|
||||||
|
move $t2, $s0
|
||||||
|
|
||||||
|
1:
|
||||||
|
beq $t1, $t3, 2f
|
||||||
|
lb $t4, 0($t2)
|
||||||
|
sb $t4, 0($t1)
|
||||||
|
addiu $t1, $t1, 1
|
||||||
|
b 1b
|
||||||
|
addiu $t2, $t2, 1
|
||||||
|
2:
|
||||||
|
/* Clean out its BSS. */
|
||||||
|
lui $t1, %hi(__bss_start)
|
||||||
|
addiu $t1, $t1, %lo(__bss_start)
|
||||||
|
lui $t2, %hi(_end)
|
||||||
|
addiu $t2, $t2, %lo(_end)
|
||||||
|
1:
|
||||||
|
beq $t1, $t2, 2f
|
||||||
|
nop
|
||||||
|
sb $zero, 0($t1)
|
||||||
|
b 1b
|
||||||
|
addiu $t1, $t1, 1
|
||||||
|
2:
|
||||||
|
lui $a0, %hi(base)
|
||||||
|
addiu $a0, $a0, %lo(base)
|
||||||
|
lui $a1, %hi(_end)
|
||||||
|
addiu $a1, %lo(_end)
|
||||||
|
subu $a1,$a1,$a0
|
||||||
|
|
||||||
|
#include "../../kern/mips/cache_flush.S"
|
||||||
|
|
||||||
|
/* Decompress the payload. */
|
||||||
|
lui $a0, %hi(__bss_start)
|
||||||
|
addiu $a0, $a0, %lo(__bss_start)
|
||||||
|
lui $t0, %hi(base)
|
||||||
|
addiu $t0, $t0, %lo(base)
|
||||||
|
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)
|
||||||
|
move $s1, $a1
|
||||||
|
|
||||||
|
/* $a0 contains source compressed address, $a1 is destination,
|
||||||
|
$a2 is compressed size, $a3 is uncompressed size.
|
||||||
|
*/
|
||||||
|
move $s6, $a3
|
||||||
|
|
||||||
|
lui $t0, %hi(EXT_C(grub_decompress_core))
|
||||||
|
addiu $t0, $t0, %lo(EXT_C(grub_decompress_core))
|
||||||
|
|
||||||
|
lui $sp, %hi(_start - 256)
|
||||||
|
jalr $t0
|
||||||
|
addiu $sp, $sp, %lo(_start - 256)
|
||||||
|
|
||||||
|
move $a0, $s1
|
||||||
|
move $a1, $s6
|
||||||
|
|
||||||
|
#include "../../kern/mips/cache_flush.S"
|
||||||
|
|
||||||
|
lui $t1, %hi(GRUB_MACHINE_LINK_ADDR)
|
||||||
|
addiu $t1, %lo(GRUB_MACHINE_LINK_ADDR)
|
||||||
|
|
||||||
|
jr $t1
|
||||||
|
nop
|
|
@ -17,7 +17,6 @@
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <grub/boot.h>
|
|
||||||
#include <grub/machine/boot.h>
|
#include <grub/machine/boot.h>
|
||||||
|
|
||||||
.text
|
.text
|
||||||
|
@ -29,9 +28,6 @@ pic_base:
|
||||||
call boot_continue
|
call boot_continue
|
||||||
mov %o4, CIF_REG
|
mov %o4, CIF_REG
|
||||||
|
|
||||||
. = _start + GRUB_BOOT_MACHINE_VER_MAJ
|
|
||||||
boot_version: .byte GRUB_BOOT_VERSION_MAJOR, GRUB_BOOT_VERSION_MINOR
|
|
||||||
|
|
||||||
/* The offsets to these locations are defined by the
|
/* The offsets to these locations are defined by the
|
||||||
* GRUB_BOOT_MACHINE_foo macros in include/grub/sparc/ieee1275/boot.h,
|
* 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.
|
* and grub-setup uses this to patch these next three values as needed.
|
||||||
|
@ -44,6 +40,7 @@ boot_version: .byte GRUB_BOOT_VERSION_MAJOR, GRUB_BOOT_VERSION_MINOR
|
||||||
* After loading in that block we will execute it by jumping to the
|
* After loading in that block we will execute it by jumping to the
|
||||||
* load address plus the size of the prepended A.OUT header (32 bytes).
|
* load address plus the size of the prepended A.OUT header (32 bytes).
|
||||||
*/
|
*/
|
||||||
|
. = _start + GRUB_BOOT_MACHINE_BOOT_DEVPATH
|
||||||
boot_path:
|
boot_path:
|
||||||
. = _start + GRUB_BOOT_MACHINE_KERNEL_BYTE
|
. = _start + GRUB_BOOT_MACHINE_KERNEL_BYTE
|
||||||
boot_path_end:
|
boot_path_end:
|
||||||
|
|
|
@ -17,7 +17,6 @@
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <grub/boot.h>
|
|
||||||
#include <grub/machine/boot.h>
|
#include <grub/machine/boot.h>
|
||||||
#include <grub/offsets.h>
|
#include <grub/offsets.h>
|
||||||
|
|
||||||
|
|
|
@ -38,7 +38,7 @@ write_bases (void)
|
||||||
for (i = 0; i < GRUB_MACHINE_PCI_NUM_WIN; i++)
|
for (i = 0; i < GRUB_MACHINE_PCI_NUM_WIN; i++)
|
||||||
reg |= (((base_win[i] >> GRUB_MACHINE_PCI_WIN_SHIFT)
|
reg |= (((base_win[i] >> GRUB_MACHINE_PCI_WIN_SHIFT)
|
||||||
& GRUB_MACHINE_PCI_WIN_MASK)
|
& GRUB_MACHINE_PCI_WIN_MASK)
|
||||||
>> (i * GRUB_MACHINE_PCI_WIN_MASK_SIZE));
|
<< (i * GRUB_MACHINE_PCI_WIN_MASK_SIZE));
|
||||||
GRUB_MACHINE_PCI_IO_CTRL_REG = reg;
|
GRUB_MACHINE_PCI_IO_CTRL_REG = reg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,6 +21,13 @@
|
||||||
#include <grub/pci.h>
|
#include <grub/pci.h>
|
||||||
#include <grub/time.h>
|
#include <grub/time.h>
|
||||||
#include <grub/ata.h>
|
#include <grub/ata.h>
|
||||||
|
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||||
|
#include <grub/machine/kernel.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <grub/dl.h>
|
||||||
|
|
||||||
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
int
|
int
|
||||||
grub_cs5536_find (grub_pci_device_t *devp)
|
grub_cs5536_find (grub_pci_device_t *devp)
|
||||||
|
@ -213,26 +220,6 @@ grub_cs5536_read_spd (grub_port_t smbbase, grub_uint8_t dev,
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dump of GPIO connections. FIXME: Remove useless and macroify. */
|
|
||||||
static grub_uint32_t gpiodump[] = {
|
|
||||||
0xffff0000, 0x2ffdd002, 0xffff0000, 0xffff0000,
|
|
||||||
0x2fffd000, 0xffff0000, 0x1000efff, 0xefff1000,
|
|
||||||
0x3ffbc004, 0xffff0000, 0xffff0000, 0xffff0000,
|
|
||||||
0x3ffbc004, 0x3ffbc004, 0xffff0000, 0x00000000,
|
|
||||||
0xffff0000, 0xffff0000, 0x3ffbc004, 0x3f9bc064,
|
|
||||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
|
||||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
|
||||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
|
||||||
0xffff0000, 0xffff0000, 0xffff0000, 0xffff0000,
|
|
||||||
0xffff0000, 0xffff0000, 0x0000ffff, 0xffff0000,
|
|
||||||
0xefff1000, 0xffff0000, 0xffff0000, 0xffff0000,
|
|
||||||
0xefff1000, 0xefff1000, 0xffff0000, 0x00000000,
|
|
||||||
0xffff0000, 0xffff0000, 0xefff1000, 0xffff0000,
|
|
||||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
|
||||||
0x00000000, 0x00000000, 0x00000000, 0x00000000,
|
|
||||||
0x00000000, 0x50000000, 0x00000000, 0x00000000,
|
|
||||||
};
|
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
set_io_space (grub_pci_device_t dev, int num, grub_uint16_t start,
|
set_io_space (grub_pci_device_t dev, int num, grub_uint16_t start,
|
||||||
grub_uint16_t len)
|
grub_uint16_t len)
|
||||||
|
@ -273,17 +260,6 @@ set_p2d (grub_pci_device_t dev, int num, int dest, grub_uint32_t start)
|
||||||
void
|
void
|
||||||
grub_cs5536_init_geode (grub_pci_device_t dev)
|
grub_cs5536_init_geode (grub_pci_device_t dev)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
|
|
||||||
/* Make sure GPIO is where we expect it to be. */
|
|
||||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_GPIO_BAR,
|
|
||||||
GRUB_CS5536_LBAR_TURN_ON | GRUB_CS5536_LBAR_GPIO);
|
|
||||||
|
|
||||||
/* Setup GPIO. */
|
|
||||||
for (i = 0; i < (int) ARRAY_SIZE (gpiodump); i++)
|
|
||||||
((volatile grub_uint32_t *) (GRUB_MACHINE_PCI_IO_BASE
|
|
||||||
+ GRUB_CS5536_LBAR_GPIO)) [i] = gpiodump[i];
|
|
||||||
|
|
||||||
/* Enable more BARs. */
|
/* Enable more BARs. */
|
||||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_IRQ_MAP_BAR,
|
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_IRQ_MAP_BAR,
|
||||||
GRUB_CS5536_LBAR_TURN_ON | GRUB_CS5536_LBAR_IRQ_MAP);
|
GRUB_CS5536_LBAR_TURN_ON | GRUB_CS5536_LBAR_IRQ_MAP);
|
||||||
|
@ -295,11 +271,27 @@ grub_cs5536_init_geode (grub_pci_device_t dev)
|
||||||
GRUB_CS5536_LBAR_TURN_ON | GRUB_CS5536_LBAR_PM);
|
GRUB_CS5536_LBAR_TURN_ON | GRUB_CS5536_LBAR_PM);
|
||||||
|
|
||||||
/* Setup DIVIL. */
|
/* Setup DIVIL. */
|
||||||
|
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||||
|
switch (grub_arch_machine)
|
||||||
|
{
|
||||||
|
case GRUB_ARCH_MACHINE_YEELOONG:
|
||||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_DIVIL_LEG_IO,
|
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_MODE_X86
|
||||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_F_REMAP
|
| GRUB_CS5536_MSR_DIVIL_LEG_IO_F_REMAP
|
||||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE0
|
| GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE0
|
||||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE1);
|
| GRUB_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);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_DIVIL_IRQ_MAPPER_PRIMARY_MASK,
|
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_DIVIL_IRQ_MAPPER_PRIMARY_MASK,
|
||||||
(~GRUB_CS5536_DIVIL_LPC_INTERRUPTS) & 0xffff);
|
(~GRUB_CS5536_DIVIL_LPC_INTERRUPTS) & 0xffff);
|
||||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_DIVIL_IRQ_MAPPER_LPC_MASK,
|
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_DIVIL_IRQ_MAPPER_LPC_MASK,
|
||||||
|
|
|
@ -20,23 +20,39 @@
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
#include <grub/pci.h>
|
#include <grub/pci.h>
|
||||||
#include <grub/mm.h>
|
#include <grub/mm.h>
|
||||||
|
#include <grub/misc.h>
|
||||||
|
#include <grub/mm_private.h>
|
||||||
|
#include <grub/cache.h>
|
||||||
|
|
||||||
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
/* FIXME: correctly support 64-bit architectures. */
|
/* FIXME: correctly support 64-bit architectures. */
|
||||||
/* #if GRUB_TARGET_SIZEOF_VOID_P == 4 */
|
/* #if GRUB_TARGET_SIZEOF_VOID_P == 4 */
|
||||||
struct grub_pci_dma_chunk *
|
struct grub_pci_dma_chunk *
|
||||||
grub_memalign_dma32 (grub_size_t align, grub_size_t size)
|
grub_memalign_dma32 (grub_size_t align, grub_size_t size)
|
||||||
{
|
{
|
||||||
return grub_memalign (align, size);
|
void *ret;
|
||||||
|
if (align < 64)
|
||||||
|
align = 64;
|
||||||
|
size = ALIGN_UP (size, align);
|
||||||
|
ret = grub_memalign (align, size);
|
||||||
|
if (!ret)
|
||||||
|
return 0;
|
||||||
|
grub_arch_sync_dma_caches (ret, size);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* FIXME: evil. */
|
||||||
void
|
void
|
||||||
grub_dma_free (struct grub_pci_dma_chunk *ch)
|
grub_dma_free (struct grub_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);
|
grub_free (ch);
|
||||||
}
|
}
|
||||||
/* #endif */
|
/* #endif */
|
||||||
|
|
||||||
#ifdef GRUB_MACHINE_MIPS_YEELOONG
|
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||||
volatile void *
|
volatile void *
|
||||||
grub_dma_get_virt (struct grub_pci_dma_chunk *ch)
|
grub_dma_get_virt (struct grub_pci_dma_chunk *ch)
|
||||||
{
|
{
|
||||||
|
@ -90,17 +106,14 @@ grub_pci_iterate (grub_pci_iteratefunc_t hook)
|
||||||
|
|
||||||
/* Check if there is a device present. */
|
/* Check if there is a device present. */
|
||||||
if (id >> 16 == 0xFFFF)
|
if (id >> 16 == 0xFFFF)
|
||||||
|
{
|
||||||
|
if (dev.function == 0)
|
||||||
|
/* Devices are required to implement function 0, so if
|
||||||
|
it's missing then there is no device here. */
|
||||||
|
break;
|
||||||
|
else
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
#ifdef GRUB_MACHINE_MIPS_YEELOONG
|
|
||||||
/* Skip ghosts. */
|
|
||||||
if (id == GRUB_YEELOONG_OHCI_PCIID
|
|
||||||
&& dev.function == GRUB_YEELOONG_OHCI_GHOST_FUNCTION)
|
|
||||||
continue;
|
|
||||||
if (id == GRUB_YEELOONG_EHCI_PCIID
|
|
||||||
&& dev.function == GRUB_YEELOONG_EHCI_GHOST_FUNCTION)
|
|
||||||
continue;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
if (hook (dev, id))
|
if (hook (dev, id))
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
#include <grub/usb.h>
|
#include <grub/usb.h>
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
|
|
||||||
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
|
|
||||||
static struct grub_usb_controller_dev usb_controller =
|
static struct grub_usb_controller_dev usb_controller =
|
||||||
{
|
{
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
#include <grub/cs5536.h>
|
#include <grub/cs5536.h>
|
||||||
#include <grub/loader.h>
|
#include <grub/loader.h>
|
||||||
|
|
||||||
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
struct grub_ohci_hcca
|
struct grub_ohci_hcca
|
||||||
{
|
{
|
||||||
/* Pointers to Interrupt Endpoint Descriptors. Not used by
|
/* Pointers to Interrupt Endpoint Descriptors. Not used by
|
||||||
|
@ -98,7 +100,6 @@ struct grub_ohci
|
||||||
struct grub_pci_dma_chunk *td_chunk;
|
struct grub_pci_dma_chunk *td_chunk;
|
||||||
struct grub_ohci *next;
|
struct grub_ohci *next;
|
||||||
grub_ohci_td_t td_free; /* Pointer to first free TD */
|
grub_ohci_td_t td_free; /* Pointer to first free TD */
|
||||||
int bad_OHCI;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
static struct grub_ohci *ohci;
|
static struct grub_ohci *ohci;
|
||||||
|
@ -149,9 +150,9 @@ typedef enum
|
||||||
#define GRUB_OHCI_REG_CONTROL_CONTROL_ENABLE (1 << 4)
|
#define GRUB_OHCI_REG_CONTROL_CONTROL_ENABLE (1 << 4)
|
||||||
|
|
||||||
#define GRUB_OHCI_RESET_CONNECT_CHANGE (1 << 16)
|
#define GRUB_OHCI_RESET_CONNECT_CHANGE (1 << 16)
|
||||||
#define GRUB_OHCI_CTRL_EDS 16
|
#define GRUB_OHCI_CTRL_EDS 256
|
||||||
#define GRUB_OHCI_BULK_EDS 16
|
#define GRUB_OHCI_BULK_EDS 510
|
||||||
#define GRUB_OHCI_TDS 256
|
#define GRUB_OHCI_TDS 640
|
||||||
|
|
||||||
#define GRUB_OHCI_ED_ADDR_MASK 0x7ff
|
#define GRUB_OHCI_ED_ADDR_MASK 0x7ff
|
||||||
|
|
||||||
|
@ -221,7 +222,6 @@ grub_ohci_pci_iter (grub_pci_device_t dev,
|
||||||
grub_pci_address_t addr;
|
grub_pci_address_t addr;
|
||||||
struct grub_ohci *o;
|
struct grub_ohci *o;
|
||||||
grub_uint32_t revision;
|
grub_uint32_t revision;
|
||||||
int cs5536;
|
|
||||||
int j;
|
int j;
|
||||||
|
|
||||||
/* Determine IO base address. */
|
/* Determine IO base address. */
|
||||||
|
@ -231,7 +231,6 @@ grub_ohci_pci_iter (grub_pci_device_t dev,
|
||||||
{
|
{
|
||||||
grub_uint64_t basereg;
|
grub_uint64_t basereg;
|
||||||
|
|
||||||
cs5536 = 1;
|
|
||||||
basereg = grub_cs5536_read_msr (dev, GRUB_CS5536_MSR_USB_OHCI_BASE);
|
basereg = grub_cs5536_read_msr (dev, GRUB_CS5536_MSR_USB_OHCI_BASE);
|
||||||
if (!(basereg & GRUB_CS5536_MSR_USB_BASE_MEMORY_ENABLE))
|
if (!(basereg & GRUB_CS5536_MSR_USB_BASE_MEMORY_ENABLE))
|
||||||
{
|
{
|
||||||
|
@ -442,8 +441,10 @@ grub_ohci_pci_iter (grub_pci_device_t dev,
|
||||||
(grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBA)
|
(grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBA)
|
||||||
& ~GRUB_OHCI_RHUB_PORT_POWER_MASK)
|
& ~GRUB_OHCI_RHUB_PORT_POWER_MASK)
|
||||||
| GRUB_OHCI_RHUB_PORT_ALL_POWERED);
|
| GRUB_OHCI_RHUB_PORT_ALL_POWERED);
|
||||||
|
#if 0 /* We don't need it at all, handled via hotplugging */
|
||||||
/* Now we have hot-plugging, we need to wait for stable power only */
|
/* Now we have hot-plugging, we need to wait for stable power only */
|
||||||
grub_millisleep (100);
|
grub_millisleep (100);
|
||||||
|
#endif
|
||||||
|
|
||||||
/* Link to ohci now that initialisation is successful. */
|
/* Link to ohci now that initialisation is successful. */
|
||||||
o->next = ohci;
|
o->next = ohci;
|
||||||
|
@ -453,10 +454,12 @@ grub_ohci_pci_iter (grub_pci_device_t dev,
|
||||||
|
|
||||||
fail:
|
fail:
|
||||||
if (o)
|
if (o)
|
||||||
|
{
|
||||||
grub_dma_free (o->td_chunk);
|
grub_dma_free (o->td_chunk);
|
||||||
grub_dma_free (o->ed_bulk_chunk);
|
grub_dma_free (o->ed_bulk_chunk);
|
||||||
grub_dma_free (o->ed_ctrl_chunk);
|
grub_dma_free (o->ed_ctrl_chunk);
|
||||||
grub_dma_free (o->hcca_chunk);
|
grub_dma_free (o->hcca_chunk);
|
||||||
|
}
|
||||||
grub_free (o);
|
grub_free (o);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -623,7 +626,8 @@ grub_ohci_transaction (grub_ohci_td_t td,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set the token (Always generate interrupt - bits 21-23 = 0). */
|
/* Set the token */
|
||||||
|
token |= ( 7 << 21); /* Never generate interrupt */
|
||||||
token |= toggle << 24;
|
token |= toggle << 24;
|
||||||
token |= 1 << 25;
|
token |= 1 << 25;
|
||||||
|
|
||||||
|
@ -652,36 +656,31 @@ grub_ohci_transaction (grub_ohci_td_t td,
|
||||||
td->next_td = 0;
|
td->next_td = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct grub_ohci_transfer_controller_data
|
||||||
|
{
|
||||||
|
grub_uint32_t tderr_phys;
|
||||||
|
grub_uint32_t td_last_phys;
|
||||||
|
grub_ohci_ed_t ed_virt;
|
||||||
|
grub_ohci_td_t td_current_virt;
|
||||||
|
grub_ohci_td_t td_head_virt;
|
||||||
|
};
|
||||||
|
|
||||||
static grub_usb_err_t
|
static grub_usb_err_t
|
||||||
grub_ohci_transfer (grub_usb_controller_t dev,
|
grub_ohci_setup_transfer (grub_usb_controller_t dev,
|
||||||
grub_usb_transfer_t transfer, int timeout,
|
grub_usb_transfer_t transfer)
|
||||||
grub_size_t *actual)
|
|
||||||
{
|
{
|
||||||
struct grub_ohci *o = (struct grub_ohci *) dev->data;
|
struct grub_ohci *o = (struct grub_ohci *) dev->data;
|
||||||
grub_ohci_ed_t ed_virt;
|
|
||||||
int bulk = 0;
|
int bulk = 0;
|
||||||
grub_ohci_td_t td_head_virt;
|
|
||||||
grub_ohci_td_t td_current_virt;
|
|
||||||
grub_ohci_td_t td_next_virt;
|
grub_ohci_td_t td_next_virt;
|
||||||
grub_ohci_td_t tderr_virt = NULL;
|
|
||||||
grub_uint32_t target;
|
grub_uint32_t target;
|
||||||
grub_uint32_t td_head_phys;
|
grub_uint32_t td_head_phys;
|
||||||
grub_uint32_t td_tail_phys;
|
grub_uint32_t td_tail_phys;
|
||||||
grub_uint32_t td_last_phys;
|
|
||||||
grub_uint32_t tderr_phys = 0;
|
|
||||||
grub_uint32_t status;
|
|
||||||
grub_uint32_t control;
|
|
||||||
grub_uint8_t errcode = 0;
|
|
||||||
grub_usb_err_t err = GRUB_USB_ERR_NONE;
|
|
||||||
int i;
|
int i;
|
||||||
grub_uint64_t maxtime;
|
struct grub_ohci_transfer_controller_data *cdata;
|
||||||
grub_uint64_t bad_OHCI_delay = 0;
|
|
||||||
int err_halt = 0;
|
|
||||||
int err_timeout = 0;
|
|
||||||
int err_unrec = 0;
|
|
||||||
grub_uint32_t intstatus;
|
|
||||||
|
|
||||||
*actual = 0;
|
cdata = grub_zalloc (sizeof (*cdata));
|
||||||
|
if (!cdata)
|
||||||
|
return GRUB_USB_ERR_INTERNAL;
|
||||||
|
|
||||||
/* Pre-set target for ED - we need it to find proper ED */
|
/* Pre-set target for ED - we need it to find proper ED */
|
||||||
/* Set the device address. */
|
/* Set the device address. */
|
||||||
|
@ -704,20 +703,22 @@ grub_ohci_transfer (grub_usb_controller_t dev,
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
grub_free (cdata);
|
||||||
return GRUB_USB_ERR_INTERNAL;
|
return GRUB_USB_ERR_INTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Find proper ED or add new ED */
|
/* Find proper ED or add new ED */
|
||||||
ed_virt = grub_ohci_find_ed (o, bulk, target);
|
cdata->ed_virt = grub_ohci_find_ed (o, bulk, target);
|
||||||
if (!ed_virt)
|
if (!cdata->ed_virt)
|
||||||
{
|
{
|
||||||
grub_dprintf ("ohci","Fatal: No free ED !\n");
|
grub_dprintf ("ohci","Fatal: No free ED !\n");
|
||||||
|
grub_free (cdata);
|
||||||
return GRUB_USB_ERR_INTERNAL;
|
return GRUB_USB_ERR_INTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Take pointer to first TD from ED */
|
/* Take pointer to first TD from ED */
|
||||||
td_head_phys = grub_le_to_cpu32 (ed_virt->td_head) & ~0xf;
|
td_head_phys = grub_le_to_cpu32 (cdata->ed_virt->td_head) & ~0xf;
|
||||||
td_tail_phys = grub_le_to_cpu32 (ed_virt->td_tail) & ~0xf;
|
td_tail_phys = grub_le_to_cpu32 (cdata->ed_virt->td_tail) & ~0xf;
|
||||||
|
|
||||||
/* Sanity check - td_head should be equal to td_tail */
|
/* Sanity check - td_head should be equal to td_tail */
|
||||||
if (td_head_phys != td_tail_phys) /* Should never happen ! */
|
if (td_head_phys != td_tail_phys) /* Should never happen ! */
|
||||||
|
@ -726,6 +727,7 @@ grub_ohci_transfer (grub_usb_controller_t dev,
|
||||||
grub_dprintf ("ohci", "HEAD = 0x%02x, TAIL = 0x%02x\n",
|
grub_dprintf ("ohci", "HEAD = 0x%02x, TAIL = 0x%02x\n",
|
||||||
td_head_phys, td_tail_phys);
|
td_head_phys, td_tail_phys);
|
||||||
/* XXX: Fix: What to do ? */
|
/* XXX: Fix: What to do ? */
|
||||||
|
grub_free (cdata);
|
||||||
return GRUB_USB_ERR_INTERNAL;
|
return GRUB_USB_ERR_INTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -733,65 +735,62 @@ grub_ohci_transfer (grub_usb_controller_t dev,
|
||||||
* we must allocate the first TD. */
|
* we must allocate the first TD. */
|
||||||
if (!td_head_phys)
|
if (!td_head_phys)
|
||||||
{
|
{
|
||||||
td_head_virt = grub_ohci_alloc_td (o);
|
cdata->td_head_virt = grub_ohci_alloc_td (o);
|
||||||
if (!td_head_virt)
|
if (!cdata->td_head_virt)
|
||||||
return GRUB_USB_ERR_INTERNAL; /* We don't need de-allocate ED */
|
return GRUB_USB_ERR_INTERNAL; /* We don't need de-allocate ED */
|
||||||
/* We can set td_head only when ED is not active, i.e.
|
/* We can set td_head only when ED is not active, i.e.
|
||||||
* when it is newly allocated. */
|
* when it is newly allocated. */
|
||||||
ed_virt->td_head = grub_cpu_to_le32 ( grub_ohci_td_virt2phys (o,
|
cdata->ed_virt->td_head
|
||||||
td_head_virt) );
|
= grub_cpu_to_le32 (grub_ohci_td_virt2phys (o, cdata->td_head_virt));
|
||||||
ed_virt->td_tail = ed_virt->td_head;
|
cdata->ed_virt->td_tail = cdata->ed_virt->td_head;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
td_head_virt = grub_ohci_td_phys2virt ( o, td_head_phys );
|
cdata->td_head_virt = grub_ohci_td_phys2virt ( o, td_head_phys );
|
||||||
|
|
||||||
/* Set TDs */
|
/* Set TDs */
|
||||||
td_last_phys = td_head_phys; /* initial value to make compiler happy... */
|
cdata->td_last_phys = td_head_phys; /* initial value to make compiler happy... */
|
||||||
for (i = 0, td_current_virt = td_head_virt;
|
for (i = 0, cdata->td_current_virt = cdata->td_head_virt;
|
||||||
i < transfer->transcnt; i++)
|
i < transfer->transcnt; i++)
|
||||||
{
|
{
|
||||||
grub_usb_transaction_t tr = &transfer->transactions[i];
|
grub_usb_transaction_t tr = &transfer->transactions[i];
|
||||||
|
|
||||||
grub_ohci_transaction (td_current_virt, tr->pid, tr->toggle,
|
grub_ohci_transaction (cdata->td_current_virt, tr->pid, tr->toggle,
|
||||||
tr->size, tr->data);
|
tr->size, tr->data);
|
||||||
|
|
||||||
/* Set index of TD in transfer */
|
/* Set index of TD in transfer */
|
||||||
td_current_virt->tr_index = (grub_uint32_t) i;
|
cdata->td_current_virt->tr_index = (grub_uint32_t) i;
|
||||||
|
|
||||||
/* No IRQ request in TD if bad_OHCI set */
|
|
||||||
if (o->bad_OHCI)
|
|
||||||
td_current_virt->token |= grub_cpu_to_le32 ( 7 << 21);
|
|
||||||
|
|
||||||
/* Remember last used (processed) TD phys. addr. */
|
/* Remember last used (processed) TD phys. addr. */
|
||||||
td_last_phys = grub_ohci_td_virt2phys (o, td_current_virt);
|
cdata->td_last_phys = grub_ohci_td_virt2phys (o, cdata->td_current_virt);
|
||||||
|
|
||||||
/* Allocate next TD */
|
/* Allocate next TD */
|
||||||
td_next_virt = grub_ohci_alloc_td (o);
|
td_next_virt = grub_ohci_alloc_td (o);
|
||||||
if (!td_next_virt) /* No free TD, cancel transfer and free TDs except head TD */
|
if (!td_next_virt) /* No free TD, cancel transfer and free TDs except head TD */
|
||||||
{
|
{
|
||||||
if (i) /* if i==0 we have nothing to free... */
|
if (i) /* if i==0 we have nothing to free... */
|
||||||
grub_ohci_free_tds (o,
|
grub_ohci_free_tds (o, grub_ohci_td_phys2virt(o,
|
||||||
grub_ohci_td_phys2virt(o,
|
grub_le_to_cpu32 (cdata->td_head_virt->next_td)));
|
||||||
grub_le_to_cpu32 (td_head_virt->next_td) ) );
|
|
||||||
/* Reset head TD */
|
/* Reset head TD */
|
||||||
grub_memset ( (void*)td_head_virt, 0,
|
grub_memset ( (void*)cdata->td_head_virt, 0,
|
||||||
sizeof(struct grub_ohci_td) );
|
sizeof(struct grub_ohci_td) );
|
||||||
grub_dprintf ("ohci", "Fatal: No free TD !");
|
grub_dprintf ("ohci", "Fatal: No free TD !");
|
||||||
|
grub_free (cdata);
|
||||||
return GRUB_USB_ERR_INTERNAL;
|
return GRUB_USB_ERR_INTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Chain TDs */
|
/* Chain TDs */
|
||||||
td_current_virt->link_td = td_next_virt;
|
|
||||||
td_current_virt->next_td = grub_cpu_to_le32 (
|
cdata->td_current_virt->link_td = td_next_virt;
|
||||||
|
cdata->td_current_virt->next_td = grub_cpu_to_le32 (
|
||||||
grub_ohci_td_virt2phys (o,
|
grub_ohci_td_virt2phys (o,
|
||||||
td_next_virt) );
|
td_next_virt) );
|
||||||
td_next_virt->prev_td_phys = grub_ohci_td_virt2phys (o,
|
td_next_virt->prev_td_phys = grub_ohci_td_virt2phys (o,
|
||||||
td_current_virt);
|
cdata->td_current_virt);
|
||||||
td_current_virt = td_next_virt;
|
cdata->td_current_virt = td_next_virt;
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_dprintf ("ohci", "Tail TD (not processed) = %p\n",
|
grub_dprintf ("ohci", "Tail TD (not processed) = %p\n",
|
||||||
td_current_virt);
|
cdata->td_current_virt);
|
||||||
|
|
||||||
/* Setup the Endpoint Descriptor for transfer. */
|
/* Setup the Endpoint Descriptor for transfer. */
|
||||||
/* First set necessary fields in TARGET but keep (or set) skip bit */
|
/* First set necessary fields in TARGET but keep (or set) skip bit */
|
||||||
|
@ -799,12 +798,12 @@ grub_ohci_transfer (grub_usb_controller_t dev,
|
||||||
* size never change after first allocation of ED.
|
* size never change after first allocation of ED.
|
||||||
* But unfortunately max. packet size may change during initial
|
* But unfortunately max. packet size may change during initial
|
||||||
* setup sequence and we must handle it. */
|
* setup sequence and we must handle it. */
|
||||||
ed_virt->target = grub_cpu_to_le32 (target | (1 << 14));
|
cdata->ed_virt->target = grub_cpu_to_le32 (target | (1 << 14));
|
||||||
/* Set td_tail */
|
/* Set td_tail */
|
||||||
ed_virt->td_tail
|
cdata->ed_virt->td_tail
|
||||||
= grub_cpu_to_le32 (grub_ohci_td_virt2phys (o, td_current_virt));
|
= grub_cpu_to_le32 (grub_ohci_td_virt2phys (o, cdata->td_current_virt));
|
||||||
/* Now reset skip bit */
|
/* Now reset skip bit */
|
||||||
ed_virt->target = grub_cpu_to_le32 (target);
|
cdata->ed_virt->target = grub_cpu_to_le32 (target);
|
||||||
/* ed_virt->td_head = grub_cpu_to_le32 (td_head); Must not be changed, it is maintained by OHCI */
|
/* ed_virt->td_head = grub_cpu_to_le32 (td_head); Must not be changed, it is maintained by OHCI */
|
||||||
/* ed_virt->next_ed = grub_cpu_to_le32 (0); Handled by grub_ohci_find_ed, do not change ! */
|
/* ed_virt->next_ed = grub_cpu_to_le32 (0); Handled by grub_ohci_find_ed, do not change ! */
|
||||||
|
|
||||||
|
@ -834,93 +833,21 @@ grub_ohci_transfer (grub_usb_controller_t dev,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Safety measure to avoid a hang. */
|
transfer->controller_data = cdata;
|
||||||
maxtime = grub_get_time_ms () + timeout;
|
|
||||||
|
|
||||||
/* Wait until the transfer is completed or STALLs. */
|
return GRUB_USB_ERR_NONE;
|
||||||
do
|
|
||||||
{
|
|
||||||
/* Check transfer status */
|
|
||||||
intstatus = grub_ohci_readreg32 (o, GRUB_OHCI_REG_INTSTATUS);
|
|
||||||
if (!o->bad_OHCI && (intstatus & 0x2) != 0)
|
|
||||||
{
|
|
||||||
/* Remember last successful TD */
|
|
||||||
tderr_phys = grub_le_to_cpu32 (o->hcca->donehead) & ~0xf;
|
|
||||||
/* Reset DoneHead */
|
|
||||||
o->hcca->donehead = 0;
|
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_INTSTATUS, (1 << 1));
|
|
||||||
/* Read back of register should ensure it is really written */
|
|
||||||
grub_ohci_readreg32 (o, GRUB_OHCI_REG_INTSTATUS);
|
|
||||||
/* if TD is last, finish */
|
|
||||||
if (tderr_phys == td_last_phys)
|
|
||||||
{
|
|
||||||
if (grub_le_to_cpu32 (ed_virt->td_head) & 1)
|
|
||||||
err_halt = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((intstatus & 0x10) != 0)
|
static void
|
||||||
{ /* Unrecoverable error - only reset can help...! */
|
pre_finish_transfer (grub_usb_controller_t dev,
|
||||||
err_unrec = 1;
|
grub_usb_transfer_t transfer)
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Detected a HALT. */
|
|
||||||
if (err_halt || (grub_le_to_cpu32 (ed_virt->td_head) & 1))
|
|
||||||
{
|
{
|
||||||
err_halt = 1;
|
struct grub_ohci *o = dev->data;
|
||||||
/* ED is halted, but donehead event can happened in the meantime */
|
struct grub_ohci_transfer_controller_data *cdata = transfer->controller_data;
|
||||||
intstatus = grub_ohci_readreg32 (o, GRUB_OHCI_REG_INTSTATUS);
|
grub_uint32_t target;
|
||||||
if (!o->bad_OHCI && (intstatus & 0x2) != 0)
|
grub_uint32_t status;
|
||||||
/* Don't break loop now, first do donehead action(s) */
|
grub_uint32_t control;
|
||||||
continue;
|
grub_uint32_t intstatus;
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* bad OHCI handling */
|
|
||||||
if ( (grub_le_to_cpu32 (ed_virt->td_head) & ~0xf) ==
|
|
||||||
(grub_le_to_cpu32 (ed_virt->td_tail) & ~0xf) ) /* Empty ED */
|
|
||||||
{
|
|
||||||
if (o->bad_OHCI) /* Bad OHCI detected previously */
|
|
||||||
{
|
|
||||||
/* Try get last successful TD. */
|
|
||||||
tderr_phys = grub_le_to_cpu32 (o->hcca->donehead) & ~0xf;
|
|
||||||
if (tderr_phys)/* Reset DoneHead if we were successful */
|
|
||||||
{
|
|
||||||
o->hcca->donehead = 0;
|
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_INTSTATUS, (1 << 1));
|
|
||||||
/* Read back of register should ensure it is really written */
|
|
||||||
grub_ohci_readreg32 (o, GRUB_OHCI_REG_INTSTATUS);
|
|
||||||
}
|
|
||||||
/* Check the HALT bit */
|
|
||||||
if (grub_le_to_cpu32 (ed_virt->td_head) & 1)
|
|
||||||
err_halt = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
else /* Detection of bad OHCI */
|
|
||||||
/* We should wait short time (~2ms) before we say that
|
|
||||||
* it is bad OHCI to prevent some hazard -
|
|
||||||
* donehead can react in the meantime. This waiting is done
|
|
||||||
* only once per OHCI driver "live cycle". */
|
|
||||||
if (!bad_OHCI_delay) /* Set delay time */
|
|
||||||
bad_OHCI_delay = grub_get_time_ms () + 2;
|
|
||||||
else if (grub_get_time_ms () >= bad_OHCI_delay)
|
|
||||||
o->bad_OHCI = 1;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Timeout ? */
|
|
||||||
if (grub_get_time_ms () > maxtime)
|
|
||||||
{
|
|
||||||
err_timeout = 1;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_cpu_idle ();
|
|
||||||
}
|
|
||||||
while (1);
|
|
||||||
|
|
||||||
/* There are many ways how the loop above can finish:
|
/* There are many ways how the loop above can finish:
|
||||||
* - normally without any error via INTSTATUS WDH bit
|
* - normally without any error via INTSTATUS WDH bit
|
||||||
|
@ -952,8 +879,8 @@ grub_ohci_transfer (grub_usb_controller_t dev,
|
||||||
/* Remember target for debug and set skip flag in ED */
|
/* Remember target for debug and set skip flag in ED */
|
||||||
/* It should be normaly not necessary but we need it at least
|
/* It should be normaly not necessary but we need it at least
|
||||||
* in case of timeout */
|
* in case of timeout */
|
||||||
target = grub_le_to_cpu32 ( ed_virt->target );
|
target = grub_le_to_cpu32 ( cdata->ed_virt->target );
|
||||||
ed_virt->target = grub_cpu_to_le32 (target | (1 << 14));
|
cdata->ed_virt->target = grub_cpu_to_le32 (target | (1 << 14));
|
||||||
/* Read registers for debug - they should be read now because
|
/* Read registers for debug - they should be read now because
|
||||||
* debug prints case unwanted delays, so something can happen
|
* debug prints case unwanted delays, so something can happen
|
||||||
* in the meantime... */
|
* in the meantime... */
|
||||||
|
@ -963,63 +890,70 @@ grub_ohci_transfer (grub_usb_controller_t dev,
|
||||||
/* Now print debug values - to have full info what happened */
|
/* Now print debug values - to have full info what happened */
|
||||||
grub_dprintf ("ohci", "loop finished: control=0x%02x status=0x%02x\n",
|
grub_dprintf ("ohci", "loop finished: control=0x%02x status=0x%02x\n",
|
||||||
control, status);
|
control, status);
|
||||||
grub_dprintf ("ohci", "intstatus=0x%02x \n\t\t tderr_phys=0x%02x, td_last_phys=0x%02x\n",
|
grub_dprintf ("ohci", "intstatus=0x%02x, td_last_phys=0x%02x\n",
|
||||||
intstatus, tderr_phys, td_last_phys);
|
intstatus, cdata->td_last_phys);
|
||||||
grub_dprintf ("ohci", "err_unrec=%d, err_timeout=%d \n\t\t err_halt=%d, bad_OHCI=%d\n",
|
|
||||||
err_unrec, err_timeout, err_halt, o->bad_OHCI);
|
|
||||||
grub_dprintf ("ohci", "TARGET=0x%02x, HEAD=0x%02x, TAIL=0x%02x\n",
|
grub_dprintf ("ohci", "TARGET=0x%02x, HEAD=0x%02x, TAIL=0x%02x\n",
|
||||||
target,
|
target,
|
||||||
grub_le_to_cpu32 (ed_virt->td_head),
|
grub_le_to_cpu32 (cdata->ed_virt->td_head),
|
||||||
grub_le_to_cpu32 (ed_virt->td_tail) );
|
grub_le_to_cpu32 (cdata->ed_virt->td_tail) );
|
||||||
|
|
||||||
if (!err_halt && !err_unrec && !err_timeout) /* normal finish */
|
|
||||||
{
|
|
||||||
/* Simple workaround if donehead is not working */
|
|
||||||
if (o->bad_OHCI &&
|
|
||||||
( !tderr_phys || (tderr_phys != td_last_phys) ) )
|
|
||||||
{
|
|
||||||
grub_dprintf ("ohci", "normal finish, but tderr_phys corrected\n");
|
|
||||||
tderr_phys = td_last_phys;
|
|
||||||
/* I hope we can do it as transfer (most probably) finished OK */
|
|
||||||
}
|
|
||||||
/* Prepare pointer to last processed TD */
|
|
||||||
tderr_virt = grub_ohci_td_phys2virt (o, tderr_phys);
|
|
||||||
/* Set index of last processed TD */
|
|
||||||
if (tderr_virt)
|
|
||||||
transfer->last_trans = tderr_virt->tr_index;
|
|
||||||
else
|
|
||||||
transfer->last_trans = -1;
|
|
||||||
*actual = transfer->size + 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (err_halt) /* error, ED is halted by OHCI, i.e. can be modified */
|
static void
|
||||||
|
finish_transfer (grub_usb_controller_t dev,
|
||||||
|
grub_usb_transfer_t transfer)
|
||||||
{
|
{
|
||||||
|
struct grub_ohci *o = dev->data;
|
||||||
|
struct grub_ohci_transfer_controller_data *cdata = transfer->controller_data;
|
||||||
|
|
||||||
|
/* Set empty ED - set HEAD = TAIL = last (not processed) TD */
|
||||||
|
cdata->ed_virt->td_head = grub_cpu_to_le32 (grub_le_to_cpu32 (cdata->ed_virt->td_tail) & ~0xf);
|
||||||
|
|
||||||
|
/* At this point always should be:
|
||||||
|
* ED has skip bit set and halted or empty or after next SOF,
|
||||||
|
* i.e. it is safe to free all TDs except last not processed
|
||||||
|
* ED HEAD == TAIL == phys. addr. of td_current_virt */
|
||||||
|
|
||||||
|
/* Un-chainig of last TD */
|
||||||
|
if (cdata->td_current_virt->prev_td_phys)
|
||||||
|
{
|
||||||
|
grub_ohci_td_t td_prev_virt
|
||||||
|
= grub_ohci_td_phys2virt (o, cdata->td_current_virt->prev_td_phys);
|
||||||
|
|
||||||
|
if (cdata->td_current_virt == (grub_ohci_td_t) td_prev_virt->link_td)
|
||||||
|
td_prev_virt->link_td = 0;
|
||||||
|
|
||||||
|
cdata->td_current_virt->prev_td_phys = 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
grub_dprintf ("ohci", "OHCI finished, freeing\n");
|
||||||
|
grub_ohci_free_tds (o, cdata->td_head_virt);
|
||||||
|
grub_free (cdata);
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_usb_err_t
|
||||||
|
parse_halt (grub_usb_controller_t dev,
|
||||||
|
grub_usb_transfer_t transfer,
|
||||||
|
grub_size_t *actual)
|
||||||
|
{
|
||||||
|
struct grub_ohci *o = dev->data;
|
||||||
|
struct grub_ohci_transfer_controller_data *cdata = transfer->controller_data;
|
||||||
|
grub_uint8_t errcode = 0;
|
||||||
|
grub_usb_err_t err = GRUB_USB_ERR_NAK;
|
||||||
|
grub_ohci_td_t tderr_virt = NULL;
|
||||||
|
|
||||||
|
*actual = 0;
|
||||||
|
|
||||||
|
pre_finish_transfer (dev, transfer);
|
||||||
|
|
||||||
/* First we must get proper tderr_phys value */
|
/* First we must get proper tderr_phys value */
|
||||||
if (o->bad_OHCI) /* In case of bad_OHCI tderr_phys can be wrong */
|
/* Retired TD with error should be previous TD to ED->td_head */
|
||||||
{
|
cdata->tderr_phys = grub_ohci_td_phys2virt (o,
|
||||||
if ( tderr_phys ) /* check if tderr_phys points to TD with error */
|
grub_le_to_cpu32 (cdata->ed_virt->td_head) & ~0xf )
|
||||||
errcode = grub_le_to_cpu32 ( grub_ohci_td_phys2virt (o,
|
|
||||||
tderr_phys)->token )
|
|
||||||
>> 28;
|
|
||||||
if ( !tderr_phys || !errcode ) /* tderr_phys not valid or points to wrong TD */
|
|
||||||
{ /* Retired TD with error should be previous TD to ED->td_head */
|
|
||||||
tderr_phys = grub_ohci_td_phys2virt (o,
|
|
||||||
grub_le_to_cpu32 ( ed_virt->td_head) & ~0xf )
|
|
||||||
->prev_td_phys;
|
->prev_td_phys;
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Even if we have "good" OHCI, in some cases
|
|
||||||
* tderr_phys can be zero, check it */
|
|
||||||
else if ( !tderr_phys )
|
|
||||||
{ /* Retired TD with error should be previous TD to ED->td_head */
|
|
||||||
tderr_phys = grub_ohci_td_phys2virt (o,
|
|
||||||
grub_le_to_cpu32 ( ed_virt->td_head) & ~0xf )
|
|
||||||
->prev_td_phys;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Prepare pointer to last processed TD and get error code */
|
/* Prepare pointer to last processed TD and get error code */
|
||||||
tderr_virt = grub_ohci_td_phys2virt (o, tderr_phys);
|
tderr_virt = grub_ohci_td_phys2virt (o, cdata->tderr_phys);
|
||||||
/* Set index of last processed TD */
|
/* Set index of last processed TD */
|
||||||
if (tderr_virt)
|
if (tderr_virt)
|
||||||
{
|
{
|
||||||
|
@ -1031,7 +965,7 @@ grub_ohci_transfer (grub_usb_controller_t dev,
|
||||||
|
|
||||||
/* Evaluation of error code */
|
/* Evaluation of error code */
|
||||||
grub_dprintf ("ohci", "OHCI tderr_phys=0x%02x, errcode=0x%02x\n",
|
grub_dprintf ("ohci", "OHCI tderr_phys=0x%02x, errcode=0x%02x\n",
|
||||||
tderr_phys, errcode);
|
cdata->tderr_phys, errcode);
|
||||||
switch (errcode)
|
switch (errcode)
|
||||||
{
|
{
|
||||||
case 0:
|
case 0:
|
||||||
|
@ -1090,6 +1024,7 @@ grub_ohci_transfer (grub_usb_controller_t dev,
|
||||||
- (grub_le_to_cpu32 (tderr_virt->buffer_end)
|
- (grub_le_to_cpu32 (tderr_virt->buffer_end)
|
||||||
- grub_le_to_cpu32 (tderr_virt->buffer))
|
- grub_le_to_cpu32 (tderr_virt->buffer))
|
||||||
+ transfer->transactions[transfer->last_trans].preceding;
|
+ transfer->transactions[transfer->last_trans].preceding;
|
||||||
|
err = GRUB_USB_ERR_NONE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 10:
|
case 10:
|
||||||
|
@ -1117,13 +1052,53 @@ grub_ohci_transfer (grub_usb_controller_t dev,
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
finish_transfer (dev, transfer);
|
||||||
|
|
||||||
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (err_unrec)
|
static grub_usb_err_t
|
||||||
|
parse_success (grub_usb_controller_t dev,
|
||||||
|
grub_usb_transfer_t transfer,
|
||||||
|
grub_size_t *actual)
|
||||||
{
|
{
|
||||||
|
struct grub_ohci *o = dev->data;
|
||||||
|
struct grub_ohci_transfer_controller_data *cdata = transfer->controller_data;
|
||||||
|
grub_ohci_td_t tderr_virt = NULL;
|
||||||
|
|
||||||
|
pre_finish_transfer (dev, transfer);
|
||||||
|
|
||||||
|
/* I hope we can do it as transfer (most probably) finished OK */
|
||||||
|
cdata->tderr_phys = cdata->td_last_phys;
|
||||||
|
|
||||||
|
/* Prepare pointer to last processed TD */
|
||||||
|
tderr_virt = grub_ohci_td_phys2virt (o, cdata->tderr_phys);
|
||||||
|
|
||||||
|
/* Set index of last processed TD */
|
||||||
|
if (tderr_virt)
|
||||||
|
transfer->last_trans = tderr_virt->tr_index;
|
||||||
|
else
|
||||||
|
transfer->last_trans = -1;
|
||||||
|
*actual = transfer->size + 1;
|
||||||
|
|
||||||
|
finish_transfer (dev, transfer);
|
||||||
|
|
||||||
|
return GRUB_USB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_usb_err_t
|
||||||
|
parse_unrec (grub_usb_controller_t dev,
|
||||||
|
grub_usb_transfer_t transfer,
|
||||||
|
grub_size_t *actual)
|
||||||
|
{
|
||||||
|
struct grub_ohci *o = dev->data;
|
||||||
|
|
||||||
|
*actual = 0;
|
||||||
|
|
||||||
|
pre_finish_transfer (dev, transfer);
|
||||||
|
|
||||||
/* Don't try to get error code and last processed TD for proper
|
/* Don't try to get error code and last processed TD for proper
|
||||||
* toggle bit value - anything can be invalid */
|
* toggle bit value - anything can be invalid */
|
||||||
err = GRUB_USB_ERR_UNRECOVERABLE;
|
|
||||||
grub_dprintf("ohci", "Unrecoverable error!");
|
grub_dprintf("ohci", "Unrecoverable error!");
|
||||||
|
|
||||||
/* Do OHCI reset in case of unrecoverable error - maybe we will need
|
/* Do OHCI reset in case of unrecoverable error - maybe we will need
|
||||||
|
@ -1151,12 +1126,58 @@ grub_ohci_transfer (grub_usb_controller_t dev,
|
||||||
(2 << 6)
|
(2 << 6)
|
||||||
| GRUB_OHCI_REG_CONTROL_CONTROL_ENABLE
|
| GRUB_OHCI_REG_CONTROL_CONTROL_ENABLE
|
||||||
| GRUB_OHCI_REG_CONTROL_BULK_ENABLE );
|
| GRUB_OHCI_REG_CONTROL_BULK_ENABLE );
|
||||||
|
finish_transfer (dev, transfer);
|
||||||
|
|
||||||
|
return GRUB_USB_ERR_UNRECOVERABLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (err_timeout)
|
static grub_usb_err_t
|
||||||
|
grub_ohci_check_transfer (grub_usb_controller_t dev,
|
||||||
|
grub_usb_transfer_t transfer,
|
||||||
|
grub_size_t *actual)
|
||||||
{
|
{
|
||||||
/* In case of timeout do not detect error from TD */
|
struct grub_ohci *o = dev->data;
|
||||||
err = GRUB_ERR_TIMEOUT;
|
struct grub_ohci_transfer_controller_data *cdata = transfer->controller_data;
|
||||||
|
grub_uint32_t intstatus;
|
||||||
|
|
||||||
|
/* Check transfer status */
|
||||||
|
intstatus = grub_ohci_readreg32 (o, GRUB_OHCI_REG_INTSTATUS);
|
||||||
|
|
||||||
|
if ((intstatus & 0x10) != 0)
|
||||||
|
/* Unrecoverable error - only reset can help...! */
|
||||||
|
return parse_unrec (dev, transfer, actual);
|
||||||
|
|
||||||
|
/* Detected a HALT. */
|
||||||
|
if ((grub_le_to_cpu32 (cdata->ed_virt->td_head) & 1))
|
||||||
|
return parse_halt (dev, transfer, actual);
|
||||||
|
|
||||||
|
/* Finished ED detection */
|
||||||
|
if ( (grub_le_to_cpu32 (cdata->ed_virt->td_head) & ~0xf) ==
|
||||||
|
(grub_le_to_cpu32 (cdata->ed_virt->td_tail) & ~0xf) ) /* Empty ED */
|
||||||
|
{
|
||||||
|
/* Check the HALT bit */
|
||||||
|
/* It looks like nonsense - it was tested previously...
|
||||||
|
* but it can change because OHCI is working
|
||||||
|
* simultaneously via DMA... */
|
||||||
|
if (grub_le_to_cpu32 (cdata->ed_virt->td_head) & 1)
|
||||||
|
return parse_halt (dev, transfer, actual);
|
||||||
|
else
|
||||||
|
return parse_success (dev, transfer, actual);
|
||||||
|
}
|
||||||
|
|
||||||
|
return GRUB_USB_ERR_WAIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_usb_err_t
|
||||||
|
grub_ohci_cancel_transfer (grub_usb_controller_t dev,
|
||||||
|
grub_usb_transfer_t transfer)
|
||||||
|
{
|
||||||
|
struct grub_ohci *o = dev->data;
|
||||||
|
struct grub_ohci_transfer_controller_data *cdata = transfer->controller_data;
|
||||||
|
grub_ohci_td_t tderr_virt = NULL;
|
||||||
|
|
||||||
|
pre_finish_transfer (dev, transfer);
|
||||||
|
|
||||||
grub_dprintf("ohci", "Timeout !\n");
|
grub_dprintf("ohci", "Timeout !\n");
|
||||||
|
|
||||||
/* We should wait for next SOF to be sure that ED is unaccessed
|
/* We should wait for next SOF to be sure that ED is unaccessed
|
||||||
|
@ -1166,50 +1187,24 @@ grub_ohci_transfer (grub_usb_controller_t dev,
|
||||||
/* Wait for new SOF */
|
/* Wait for new SOF */
|
||||||
while ((grub_ohci_readreg32 (o, GRUB_OHCI_REG_INTSTATUS) & 0x4) == 0);
|
while ((grub_ohci_readreg32 (o, GRUB_OHCI_REG_INTSTATUS) & 0x4) == 0);
|
||||||
|
|
||||||
/* Now we must find last processed TD if bad_OHCI == TRUE */
|
/* Possible retired TD with error should be previous TD to ED->td_head */
|
||||||
if (o->bad_OHCI)
|
cdata->tderr_phys
|
||||||
{ /* Retired TD with error should be previous TD to ED->td_head */
|
= grub_ohci_td_phys2virt (o, grub_le_to_cpu32 (cdata->ed_virt->td_head)
|
||||||
tderr_phys = grub_ohci_td_phys2virt (o,
|
& ~0xf)->prev_td_phys;
|
||||||
grub_le_to_cpu32 ( ed_virt->td_head) & ~0xf)
|
|
||||||
->prev_td_phys;
|
tderr_virt = grub_ohci_td_phys2virt (o,cdata-> tderr_phys);
|
||||||
}
|
|
||||||
tderr_virt = grub_ohci_td_phys2virt (o, tderr_phys);
|
grub_dprintf ("ohci", "Cancel: tderr_phys=0x%x, tderr_virt=%p\n",
|
||||||
|
cdata->tderr_phys, tderr_virt);
|
||||||
|
|
||||||
if (tderr_virt)
|
if (tderr_virt)
|
||||||
transfer->last_trans = tderr_virt->tr_index;
|
transfer->last_trans = tderr_virt->tr_index;
|
||||||
else
|
else
|
||||||
transfer->last_trans = -1;
|
transfer->last_trans = -1;
|
||||||
}
|
|
||||||
|
|
||||||
/* Set empty ED - set HEAD = TAIL = last (not processed) TD */
|
finish_transfer (dev, transfer);
|
||||||
ed_virt->td_head = grub_cpu_to_le32 (grub_le_to_cpu32 (ed_virt->td_tail) & ~0xf);
|
|
||||||
|
|
||||||
/* At this point always should be:
|
return GRUB_USB_ERR_NONE;
|
||||||
* ED has skip bit set and halted or empty or after next SOF,
|
|
||||||
* i.e. it is safe to free all TDs except last not processed
|
|
||||||
* ED HEAD == TAIL == phys. addr. of td_current_virt */
|
|
||||||
|
|
||||||
/* Reset DoneHead - sanity cleanup */
|
|
||||||
o->hcca->donehead = 0;
|
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_INTSTATUS, (1 << 1));
|
|
||||||
/* Read back of register should ensure it is really written */
|
|
||||||
grub_ohci_readreg32 (o, GRUB_OHCI_REG_INTSTATUS);
|
|
||||||
|
|
||||||
/* Un-chainig of last TD */
|
|
||||||
if (td_current_virt->prev_td_phys)
|
|
||||||
{
|
|
||||||
grub_ohci_td_t td_prev_virt
|
|
||||||
= grub_ohci_td_phys2virt (o, td_current_virt->prev_td_phys);
|
|
||||||
|
|
||||||
td_next_virt = (grub_ohci_td_t) td_prev_virt->link_td;
|
|
||||||
if (td_current_virt == td_next_virt)
|
|
||||||
td_prev_virt->link_td = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_dprintf ("ohci", "OHCI finished, freeing, err=0x%02x, errcode=0x%02x\n",
|
|
||||||
err, errcode);
|
|
||||||
grub_ohci_free_tds (o, td_head_virt);
|
|
||||||
|
|
||||||
return err;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
|
@ -1218,6 +1213,7 @@ grub_ohci_portstatus (grub_usb_controller_t dev,
|
||||||
{
|
{
|
||||||
struct grub_ohci *o = (struct grub_ohci *) dev->data;
|
struct grub_ohci *o = (struct grub_ohci *) dev->data;
|
||||||
grub_uint64_t endtime;
|
grub_uint64_t endtime;
|
||||||
|
int i;
|
||||||
|
|
||||||
grub_dprintf ("ohci", "begin of portstatus=0x%02x\n",
|
grub_dprintf ("ohci", "begin of portstatus=0x%02x\n",
|
||||||
grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port));
|
grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port));
|
||||||
|
@ -1238,31 +1234,47 @@ grub_ohci_portstatus (grub_usb_controller_t dev,
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reset the port */
|
/* OHCI does one reset signal 10ms long but USB spec.
|
||||||
|
* requests 50ms for root hub (no need to be continuous).
|
||||||
|
* So, we do reset 5 times... */
|
||||||
|
for (i = 0; i < 5; i++)
|
||||||
|
{
|
||||||
|
/* Reset the port - timing of reset is done by OHCI */
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_RHUBPORT + port,
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_RHUBPORT + port,
|
||||||
GRUB_OHCI_SET_PORT_RESET);
|
GRUB_OHCI_SET_PORT_RESET);
|
||||||
grub_millisleep (50); /* For root hub should be nominaly 50ms */
|
|
||||||
|
|
||||||
/* End the reset signaling. */
|
/* Wait for reset completion */
|
||||||
|
endtime = grub_get_time_ms () + 1000;
|
||||||
|
while (! (grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port)
|
||||||
|
& GRUB_OHCI_SET_PORT_RESET_STATUS_CHANGE))
|
||||||
|
if (grub_get_time_ms () > endtime)
|
||||||
|
return grub_error (GRUB_ERR_IO, "OHCI Timed out - reset");
|
||||||
|
|
||||||
|
/* End the reset signaling - reset the reset status change */
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_RHUBPORT + port,
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_RHUBPORT + port,
|
||||||
GRUB_OHCI_SET_PORT_RESET_STATUS_CHANGE);
|
GRUB_OHCI_SET_PORT_RESET_STATUS_CHANGE);
|
||||||
grub_millisleep (10);
|
grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port);
|
||||||
|
}
|
||||||
|
|
||||||
/* Enable the port and wait for it. */
|
/* Enable port */
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_RHUBPORT + port,
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_RHUBPORT + port,
|
||||||
GRUB_OHCI_SET_PORT_ENABLE);
|
GRUB_OHCI_SET_PORT_ENABLE);
|
||||||
|
grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port);
|
||||||
|
|
||||||
|
/* Wait for signal enabled */
|
||||||
endtime = grub_get_time_ms () + 1000;
|
endtime = grub_get_time_ms () + 1000;
|
||||||
while (! (grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port)
|
while (! (grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port)
|
||||||
& (1 << 1)))
|
& (1 << 1)))
|
||||||
if (grub_get_time_ms () > endtime)
|
if (grub_get_time_ms () > endtime)
|
||||||
return grub_error (GRUB_ERR_IO, "OHCI Timed out - enable");
|
return grub_error (GRUB_ERR_IO, "OHCI Timed out - enable");
|
||||||
|
|
||||||
grub_millisleep (10);
|
|
||||||
|
|
||||||
/* Reset bit Connect Status Change */
|
/* Reset bit Connect Status Change */
|
||||||
grub_ohci_writereg32 (o, GRUB_OHCI_REG_RHUBPORT + port,
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_RHUBPORT + port,
|
||||||
GRUB_OHCI_RESET_CONNECT_CHANGE);
|
GRUB_OHCI_RESET_CONNECT_CHANGE);
|
||||||
|
|
||||||
|
/* "Reset recovery time" (USB spec.) */
|
||||||
|
grub_millisleep (10);
|
||||||
|
|
||||||
grub_dprintf ("ohci", "end of portstatus=0x%02x\n",
|
grub_dprintf ("ohci", "end of portstatus=0x%02x\n",
|
||||||
grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port));
|
grub_ohci_readreg32 (o, GRUB_OHCI_REG_RHUBPORT + port));
|
||||||
|
|
||||||
|
@ -1280,7 +1292,15 @@ grub_ohci_detect_dev (grub_usb_controller_t dev, int port, int *changed)
|
||||||
grub_dprintf ("ohci", "detect_dev status=0x%02x\n", status);
|
grub_dprintf ("ohci", "detect_dev status=0x%02x\n", status);
|
||||||
|
|
||||||
/* Connect Status Change bit - it detects change of connection */
|
/* Connect Status Change bit - it detects change of connection */
|
||||||
*changed = ((status & GRUB_OHCI_RESET_CONNECT_CHANGE) != 0);
|
if (status & GRUB_OHCI_RESET_CONNECT_CHANGE)
|
||||||
|
{
|
||||||
|
*changed = 1;
|
||||||
|
/* Reset bit Connect Status Change */
|
||||||
|
grub_ohci_writereg32 (o, GRUB_OHCI_REG_RHUBPORT + port,
|
||||||
|
GRUB_OHCI_RESET_CONNECT_CHANGE);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
*changed = 0;
|
||||||
|
|
||||||
if (! (status & 1))
|
if (! (status & 1))
|
||||||
return GRUB_USB_SPEED_NONE;
|
return GRUB_USB_SPEED_NONE;
|
||||||
|
@ -1398,24 +1418,30 @@ static struct grub_usb_controller_dev usb_controller =
|
||||||
{
|
{
|
||||||
.name = "ohci",
|
.name = "ohci",
|
||||||
.iterate = grub_ohci_iterate,
|
.iterate = grub_ohci_iterate,
|
||||||
.transfer = grub_ohci_transfer,
|
.setup_transfer = grub_ohci_setup_transfer,
|
||||||
|
.check_transfer = grub_ohci_check_transfer,
|
||||||
|
.cancel_transfer = grub_ohci_cancel_transfer,
|
||||||
.hubports = grub_ohci_hubports,
|
.hubports = grub_ohci_hubports,
|
||||||
.portstatus = grub_ohci_portstatus,
|
.portstatus = grub_ohci_portstatus,
|
||||||
.detect_dev = grub_ohci_detect_dev
|
.detect_dev = grub_ohci_detect_dev
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static void *fini_hnd;
|
||||||
|
|
||||||
GRUB_MOD_INIT(ohci)
|
GRUB_MOD_INIT(ohci)
|
||||||
{
|
{
|
||||||
COMPILE_TIME_ASSERT (sizeof (struct grub_ohci_td) == 32);
|
COMPILE_TIME_ASSERT (sizeof (struct grub_ohci_td) == 32);
|
||||||
COMPILE_TIME_ASSERT (sizeof (struct grub_ohci_ed) == 16);
|
COMPILE_TIME_ASSERT (sizeof (struct grub_ohci_ed) == 16);
|
||||||
grub_ohci_inithw ();
|
grub_ohci_inithw ();
|
||||||
grub_usb_controller_dev_register (&usb_controller);
|
grub_usb_controller_dev_register (&usb_controller);
|
||||||
grub_loader_register_preboot_hook (grub_ohci_fini_hw, grub_ohci_restore_hw,
|
fini_hnd = grub_loader_register_preboot_hook (grub_ohci_fini_hw,
|
||||||
|
grub_ohci_restore_hw,
|
||||||
GRUB_LOADER_PREBOOT_HOOK_PRIO_DISK);
|
GRUB_LOADER_PREBOOT_HOOK_PRIO_DISK);
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(ohci)
|
GRUB_MOD_FINI(ohci)
|
||||||
{
|
{
|
||||||
grub_ohci_fini_hw (0);
|
grub_ohci_fini_hw (0);
|
||||||
|
grub_loader_unregister_preboot_hook (fini_hnd);
|
||||||
grub_usb_controller_dev_unregister (&usb_controller);
|
grub_usb_controller_dev_unregister (&usb_controller);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,9 @@
|
||||||
|
|
||||||
#include <grub/serial.h>
|
#include <grub/serial.h>
|
||||||
#include <grub/usbserial.h>
|
#include <grub/usbserial.h>
|
||||||
|
#include <grub/dl.h>
|
||||||
|
|
||||||
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
void
|
void
|
||||||
grub_usbserial_fini (struct grub_serial_port *port)
|
grub_usbserial_fini (struct grub_serial_port *port)
|
||||||
|
@ -44,6 +47,7 @@ grub_usbserial_attach (grub_usb_device_t usbdev, int configno, int interfno,
|
||||||
struct grub_serial_port *port;
|
struct grub_serial_port *port;
|
||||||
int j;
|
int j;
|
||||||
struct grub_usb_desc_if *interf;
|
struct grub_usb_desc_if *interf;
|
||||||
|
grub_usb_err_t err = GRUB_USB_ERR_NONE;
|
||||||
|
|
||||||
interf = usbdev->config[configno].interf[interfno].descif;
|
interf = usbdev->config[configno].interf[interfno].descif;
|
||||||
|
|
||||||
|
@ -80,7 +84,12 @@ grub_usbserial_attach (grub_usb_device_t usbdev, int configno, int interfno,
|
||||||
port->out_endp = endp;
|
port->out_endp = endp;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!port->out_endp || !port->in_endp)
|
|
||||||
|
/* Configure device */
|
||||||
|
if (port->out_endp && port->in_endp)
|
||||||
|
err = grub_usb_set_configuration (usbdev, configno + 1);
|
||||||
|
|
||||||
|
if (!port->out_endp || !port->in_endp || err)
|
||||||
{
|
{
|
||||||
grub_free (port->name);
|
grub_free (port->name);
|
||||||
grub_free (port);
|
grub_free (port);
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
#include <grub/usb.h>
|
#include <grub/usb.h>
|
||||||
#include <grub/usbserial.h>
|
#include <grub/usbserial.h>
|
||||||
|
|
||||||
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
GRUB_FTDI_MODEM_CTRL = 0x01,
|
GRUB_FTDI_MODEM_CTRL = 0x01,
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
#include <grub/usb.h>
|
#include <grub/usb.h>
|
||||||
#include <grub/usbserial.h>
|
#include <grub/usbserial.h>
|
||||||
|
|
||||||
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
/* Convert speed to divisor. */
|
/* Convert speed to divisor. */
|
||||||
static grub_uint32_t
|
static grub_uint32_t
|
||||||
is_speed_supported (unsigned int speed)
|
is_speed_supported (unsigned int speed)
|
||||||
|
|
|
@ -26,19 +26,59 @@
|
||||||
#include <grub/i386/io.h>
|
#include <grub/i386/io.h>
|
||||||
#include <grub/time.h>
|
#include <grub/time.h>
|
||||||
|
|
||||||
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
#define GRUB_UHCI_IOMASK (0x7FF << 5)
|
#define GRUB_UHCI_IOMASK (0x7FF << 5)
|
||||||
|
|
||||||
|
#define N_QH 256
|
||||||
|
#define N_TD 640
|
||||||
|
|
||||||
typedef enum
|
typedef enum
|
||||||
{
|
{
|
||||||
GRUB_UHCI_REG_USBCMD = 0x00,
|
GRUB_UHCI_REG_USBCMD = 0x00,
|
||||||
|
GRUB_UHCI_REG_USBINTR = 0x04,
|
||||||
GRUB_UHCI_REG_FLBASEADD = 0x08,
|
GRUB_UHCI_REG_FLBASEADD = 0x08,
|
||||||
GRUB_UHCI_REG_PORTSC1 = 0x10,
|
GRUB_UHCI_REG_PORTSC1 = 0x10,
|
||||||
GRUB_UHCI_REG_PORTSC2 = 0x12
|
GRUB_UHCI_REG_PORTSC2 = 0x12,
|
||||||
|
GRUB_UHCI_REG_USBLEGSUP = 0xc0
|
||||||
} grub_uhci_reg_t;
|
} grub_uhci_reg_t;
|
||||||
|
|
||||||
|
/* R/WC legacy support bits */
|
||||||
|
#define GRUB_UHCI_LEGSUP_END_A20GATE (1 << 15)
|
||||||
|
#define GRUB_UHCI_TRAP_BY_64H_WSTAT (1 << 11)
|
||||||
|
#define GRUB_UHCI_TRAP_BY_64H_RSTAT (1 << 10)
|
||||||
|
#define GRUB_UHCI_TRAP_BY_60H_WSTAT (1 << 9)
|
||||||
|
#define GRUB_UHCI_TRAP_BY_60H_RSTAT (1 << 8)
|
||||||
|
|
||||||
|
/* Reset all legacy support - clear all R/WC bits and all R/W bits */
|
||||||
|
#define GRUB_UHCI_RESET_LEGSUP_SMI ( GRUB_UHCI_LEGSUP_END_A20GATE \
|
||||||
|
| GRUB_UHCI_TRAP_BY_64H_WSTAT \
|
||||||
|
| GRUB_UHCI_TRAP_BY_64H_RSTAT \
|
||||||
|
| GRUB_UHCI_TRAP_BY_60H_WSTAT \
|
||||||
|
| GRUB_UHCI_TRAP_BY_60H_RSTAT )
|
||||||
|
|
||||||
|
/* Some UHCI commands */
|
||||||
|
#define GRUB_UHCI_CMD_RUN_STOP (1 << 0)
|
||||||
|
#define GRUB_UHCI_CMD_HCRESET (1 << 1)
|
||||||
|
#define GRUB_UHCI_CMD_MAXP (1 << 7)
|
||||||
|
|
||||||
|
/* Important bits in structures */
|
||||||
#define GRUB_UHCI_LINK_TERMINATE 1
|
#define GRUB_UHCI_LINK_TERMINATE 1
|
||||||
#define GRUB_UHCI_LINK_QUEUE_HEAD 2
|
#define GRUB_UHCI_LINK_QUEUE_HEAD 2
|
||||||
|
|
||||||
|
enum
|
||||||
|
{
|
||||||
|
GRUB_UHCI_REG_PORTSC_CONNECT_CHANGED = 0x0002,
|
||||||
|
GRUB_UHCI_REG_PORTSC_PORT_ENABLED = 0x0004,
|
||||||
|
GRUB_UHCI_REG_PORTSC_RESUME = 0x0040,
|
||||||
|
GRUB_UHCI_REG_PORTSC_RESET = 0x0200,
|
||||||
|
GRUB_UHCI_REG_PORTSC_SUSPEND = 0x1000,
|
||||||
|
GRUB_UHCI_REG_PORTSC_RW = GRUB_UHCI_REG_PORTSC_PORT_ENABLED
|
||||||
|
| GRUB_UHCI_REG_PORTSC_RESUME | GRUB_UHCI_REG_PORTSC_RESET
|
||||||
|
| GRUB_UHCI_REG_PORTSC_SUSPEND,
|
||||||
|
/* These bits should not be written as 1 unless we really need it */
|
||||||
|
GRUB_UHCI_PORTSC_RWC = ((1 << 1) | (1 << 3) | (1 << 11) | (3 << 13))
|
||||||
|
};
|
||||||
|
|
||||||
/* UHCI Queue Head. */
|
/* UHCI Queue Head. */
|
||||||
struct grub_uhci_qh
|
struct grub_uhci_qh
|
||||||
|
@ -87,15 +127,17 @@ struct grub_uhci
|
||||||
int iobase;
|
int iobase;
|
||||||
grub_uint32_t *framelist;
|
grub_uint32_t *framelist;
|
||||||
|
|
||||||
/* 256 Queue Heads. */
|
/* N_QH Queue Heads. */
|
||||||
grub_uhci_qh_t qh;
|
grub_uhci_qh_t qh;
|
||||||
|
|
||||||
/* 256 Transfer Descriptors. */
|
/* N_TD Transfer Descriptors. */
|
||||||
grub_uhci_td_t td;
|
grub_uhci_td_t td;
|
||||||
|
|
||||||
/* Free Transfer Descriptors. */
|
/* Free Transfer Descriptors. */
|
||||||
grub_uhci_td_t tdfree;
|
grub_uhci_td_t tdfree;
|
||||||
|
|
||||||
|
int qh_busy[N_QH];
|
||||||
|
|
||||||
struct grub_uhci *next;
|
struct grub_uhci *next;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -161,6 +203,11 @@ grub_uhci_pci_iter (grub_pci_device_t dev,
|
||||||
if (class != 0x0c || subclass != 0x03 || interf != 0x00)
|
if (class != 0x0c || subclass != 0x03 || interf != 0x00)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
/* Set bus master - needed for coreboot or broken BIOSes */
|
||||||
|
addr = grub_pci_make_address (dev, GRUB_PCI_REG_COMMAND);
|
||||||
|
grub_pci_write_word(addr,
|
||||||
|
GRUB_PCI_COMMAND_BUS_MASTER | grub_pci_read_word(addr));
|
||||||
|
|
||||||
/* Determine IO base address. */
|
/* Determine IO base address. */
|
||||||
addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG4);
|
addr = grub_pci_make_address (dev, GRUB_PCI_REG_ADDRESS_REG4);
|
||||||
base = grub_pci_read (addr);
|
base = grub_pci_read (addr);
|
||||||
|
@ -175,6 +222,19 @@ grub_uhci_pci_iter (grub_pci_device_t dev,
|
||||||
|
|
||||||
u->iobase = base & GRUB_UHCI_IOMASK;
|
u->iobase = base & GRUB_UHCI_IOMASK;
|
||||||
|
|
||||||
|
/* Reset PIRQ and SMI */
|
||||||
|
addr = grub_pci_make_address (dev, GRUB_UHCI_REG_USBLEGSUP);
|
||||||
|
grub_pci_write_word(addr, GRUB_UHCI_RESET_LEGSUP_SMI);
|
||||||
|
/* Reset the HC */
|
||||||
|
grub_uhci_writereg16(u, GRUB_UHCI_REG_USBCMD, GRUB_UHCI_CMD_HCRESET);
|
||||||
|
grub_millisleep(5);
|
||||||
|
/* Disable interrupts and commands (just to be safe) */
|
||||||
|
grub_uhci_writereg16(u, GRUB_UHCI_REG_USBINTR, 0);
|
||||||
|
/* Finish HC reset, HC remains disabled */
|
||||||
|
grub_uhci_writereg16(u, GRUB_UHCI_REG_USBCMD, 0);
|
||||||
|
/* Read back to be sure PCI write is done */
|
||||||
|
grub_uhci_readreg16(u, GRUB_UHCI_REG_USBCMD);
|
||||||
|
|
||||||
/* Reserve a page for the frame list. */
|
/* Reserve a page for the frame list. */
|
||||||
u->framelist = grub_memalign (4096, 4096);
|
u->framelist = grub_memalign (4096, 4096);
|
||||||
if (! u->framelist)
|
if (! u->framelist)
|
||||||
|
@ -196,7 +256,7 @@ grub_uhci_pci_iter (grub_pci_device_t dev,
|
||||||
|
|
||||||
/* The QH pointer of UHCI is only 32 bits, make sure this
|
/* The QH pointer of UHCI is only 32 bits, make sure this
|
||||||
code works on on 64 bits architectures. */
|
code works on on 64 bits architectures. */
|
||||||
u->qh = (grub_uhci_qh_t) grub_memalign (4096, 4096);
|
u->qh = (grub_uhci_qh_t) grub_memalign (4096, sizeof(struct grub_uhci_qh)*N_QH);
|
||||||
if (! u->qh)
|
if (! u->qh)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
@ -210,7 +270,7 @@ grub_uhci_pci_iter (grub_pci_device_t dev,
|
||||||
|
|
||||||
/* The TD pointer of UHCI is only 32 bits, make sure this
|
/* The TD pointer of UHCI is only 32 bits, make sure this
|
||||||
code works on on 64 bits architectures. */
|
code works on on 64 bits architectures. */
|
||||||
u->td = (grub_uhci_td_t) grub_memalign (4096, 4096*2);
|
u->td = (grub_uhci_td_t) grub_memalign (4096, sizeof(struct grub_uhci_td)*N_TD);
|
||||||
if (! u->td)
|
if (! u->td)
|
||||||
goto fail;
|
goto fail;
|
||||||
|
|
||||||
|
@ -227,14 +287,11 @@ grub_uhci_pci_iter (grub_pci_device_t dev,
|
||||||
|
|
||||||
/* Link all Transfer Descriptors in a list of available Transfer
|
/* Link all Transfer Descriptors in a list of available Transfer
|
||||||
Descriptors. */
|
Descriptors. */
|
||||||
for (i = 0; i < 256; i++)
|
for (i = 0; i < N_TD; i++)
|
||||||
u->td[i].linkptr = (grub_uint32_t) (grub_addr_t) &u->td[i + 1];
|
u->td[i].linkptr = (grub_uint32_t) (grub_addr_t) &u->td[i + 1];
|
||||||
u->td[255 - 1].linkptr = 0;
|
u->td[N_TD - 2].linkptr = 0;
|
||||||
u->tdfree = u->td;
|
u->tdfree = u->td;
|
||||||
|
|
||||||
/* Make sure UHCI is disabled! */
|
|
||||||
grub_uhci_writereg16 (u, GRUB_UHCI_REG_USBCMD, 0);
|
|
||||||
|
|
||||||
/* Setup the frame list pointers. Since no isochronous transfers
|
/* Setup the frame list pointers. Since no isochronous transfers
|
||||||
are and will be supported, they all point to the (same!) queue
|
are and will be supported, they all point to the (same!) queue
|
||||||
head. */
|
head. */
|
||||||
|
@ -248,7 +305,7 @@ grub_uhci_pci_iter (grub_pci_device_t dev,
|
||||||
(grub_uint32_t) (grub_addr_t) u->framelist);
|
(grub_uint32_t) (grub_addr_t) u->framelist);
|
||||||
|
|
||||||
/* Make the Queue Heads point to each other. */
|
/* Make the Queue Heads point to each other. */
|
||||||
for (i = 0; i < 256; i++)
|
for (i = 0; i < N_QH; i++)
|
||||||
{
|
{
|
||||||
/* Point to the next QH. */
|
/* Point to the next QH. */
|
||||||
u->qh[i].linkptr = (grub_uint32_t) (grub_addr_t) (&u->qh[i + 1]) & (~15);
|
u->qh[i].linkptr = (grub_uint32_t) (grub_addr_t) (&u->qh[i + 1]) & (~15);
|
||||||
|
@ -261,12 +318,12 @@ grub_uhci_pci_iter (grub_pci_device_t dev,
|
||||||
u->qh[i].elinkptr = 1;
|
u->qh[i].elinkptr = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* The last Queue Head should terminate. 256 are too many QHs so
|
/* The last Queue Head should terminate. */
|
||||||
just use 50. */
|
u->qh[N_QH - 1].linkptr = 1;
|
||||||
u->qh[50 - 1].linkptr = 1;
|
|
||||||
|
|
||||||
/* Enable UHCI again. */
|
/* Enable UHCI again. */
|
||||||
grub_uhci_writereg16 (u, GRUB_UHCI_REG_USBCMD, 1 | (1 << 7));
|
grub_uhci_writereg16 (u, GRUB_UHCI_REG_USBCMD,
|
||||||
|
GRUB_UHCI_CMD_RUN_STOP | GRUB_UHCI_CMD_MAXP);
|
||||||
|
|
||||||
/* UHCI is initialized and ready for transfers. */
|
/* UHCI is initialized and ready for transfers. */
|
||||||
grub_dprintf ("uhci", "UHCI initialized\n");
|
grub_dprintf ("uhci", "UHCI initialized\n");
|
||||||
|
@ -332,11 +389,13 @@ grub_free_td (struct grub_uhci *u, grub_uhci_td_t td)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
grub_free_queue (struct grub_uhci *u, grub_uhci_td_t td,
|
grub_free_queue (struct grub_uhci *u, grub_uhci_qh_t qh, grub_uhci_td_t td,
|
||||||
grub_usb_transfer_t transfer, grub_size_t *actual)
|
grub_usb_transfer_t transfer, grub_size_t *actual)
|
||||||
{
|
{
|
||||||
int i; /* Index of TD in transfer */
|
int i; /* Index of TD in transfer */
|
||||||
|
|
||||||
|
u->qh_busy[qh - u->qh] = 0;
|
||||||
|
|
||||||
*actual = 0;
|
*actual = 0;
|
||||||
|
|
||||||
/* Free the TDs in this queue and set last_trans. */
|
/* Free the TDs in this queue and set last_trans. */
|
||||||
|
@ -375,19 +434,21 @@ grub_alloc_qh (struct grub_uhci *u,
|
||||||
#endif
|
#endif
|
||||||
i = 1;
|
i = 1;
|
||||||
|
|
||||||
for (; i < 255; i++)
|
for (; i < N_QH; i++)
|
||||||
{
|
{
|
||||||
if (u->qh[i].elinkptr & 1)
|
if (!u->qh_busy[i])
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
qh = &u->qh[i];
|
qh = &u->qh[i];
|
||||||
if (! (qh->elinkptr & 1))
|
if (i == N_QH)
|
||||||
{
|
{
|
||||||
grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
grub_error (GRUB_ERR_OUT_OF_MEMORY,
|
||||||
"no free queue heads available");
|
"no free queue heads available");
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
u->qh_busy[qh - u->qh] = 1;
|
||||||
|
|
||||||
return qh;
|
return qh;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -395,7 +456,7 @@ static grub_uhci_td_t
|
||||||
grub_uhci_transaction (struct grub_uhci *u, unsigned int endp,
|
grub_uhci_transaction (struct grub_uhci *u, unsigned int endp,
|
||||||
grub_transfer_type_t type, unsigned int addr,
|
grub_transfer_type_t type, unsigned int addr,
|
||||||
unsigned int toggle, grub_size_t size,
|
unsigned int toggle, grub_size_t size,
|
||||||
grub_uint32_t data)
|
grub_uint32_t data, grub_usb_speed_t speed)
|
||||||
{
|
{
|
||||||
grub_uhci_td_t td;
|
grub_uhci_td_t td;
|
||||||
static const unsigned int tf[] = { 0x69, 0xE1, 0x2D };
|
static const unsigned int tf[] = { 0x69, 0xE1, 0x2D };
|
||||||
|
@ -420,7 +481,8 @@ grub_uhci_transaction (struct grub_uhci *u, unsigned int endp,
|
||||||
td->linkptr = 1;
|
td->linkptr = 1;
|
||||||
|
|
||||||
/* Active! Only retry a transfer 3 times. */
|
/* Active! Only retry a transfer 3 times. */
|
||||||
td->ctrl_status = (1 << 23) | (3 << 27);
|
td->ctrl_status = (1 << 23) | (3 << 27) |
|
||||||
|
((speed == GRUB_USB_SPEED_LOW) ? (1 << 26) : 0);
|
||||||
|
|
||||||
/* If zero bytes are transmitted, size is 0x7FF. Otherwise size is
|
/* If zero bytes are transmitted, size is 0x7FF. Otherwise size is
|
||||||
size-1. */
|
size-1. */
|
||||||
|
@ -438,26 +500,35 @@ grub_uhci_transaction (struct grub_uhci *u, unsigned int endp,
|
||||||
return td;
|
return td;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
struct grub_uhci_transfer_controller_data
|
||||||
|
{
|
||||||
|
grub_uhci_qh_t qh;
|
||||||
|
grub_uhci_td_t td_first;
|
||||||
|
};
|
||||||
|
|
||||||
static grub_usb_err_t
|
static grub_usb_err_t
|
||||||
grub_uhci_transfer (grub_usb_controller_t dev,
|
grub_uhci_setup_transfer (grub_usb_controller_t dev,
|
||||||
grub_usb_transfer_t transfer,
|
grub_usb_transfer_t transfer)
|
||||||
int timeout, grub_size_t *actual)
|
|
||||||
{
|
{
|
||||||
struct grub_uhci *u = (struct grub_uhci *) dev->data;
|
struct grub_uhci *u = (struct grub_uhci *) dev->data;
|
||||||
grub_uhci_qh_t qh;
|
|
||||||
grub_uhci_td_t td;
|
grub_uhci_td_t td;
|
||||||
grub_uhci_td_t td_first = NULL;
|
|
||||||
grub_uhci_td_t td_prev = NULL;
|
grub_uhci_td_t td_prev = NULL;
|
||||||
grub_usb_err_t err = GRUB_USB_ERR_NONE;
|
|
||||||
int i;
|
int i;
|
||||||
grub_uint64_t endtime;
|
struct grub_uhci_transfer_controller_data *cdata;
|
||||||
|
|
||||||
*actual = 0;
|
cdata = grub_malloc (sizeof (*cdata));
|
||||||
|
if (!cdata)
|
||||||
|
return GRUB_USB_ERR_INTERNAL;
|
||||||
|
|
||||||
|
cdata->td_first = NULL;
|
||||||
|
|
||||||
/* Allocate a queue head for the transfer queue. */
|
/* Allocate a queue head for the transfer queue. */
|
||||||
qh = grub_alloc_qh (u, GRUB_USB_TRANSACTION_TYPE_CONTROL);
|
cdata->qh = grub_alloc_qh (u, GRUB_USB_TRANSACTION_TYPE_CONTROL);
|
||||||
if (! qh)
|
if (! cdata->qh)
|
||||||
|
{
|
||||||
|
grub_free (cdata);
|
||||||
return GRUB_USB_ERR_INTERNAL;
|
return GRUB_USB_ERR_INTERNAL;
|
||||||
|
}
|
||||||
|
|
||||||
grub_dprintf ("uhci", "transfer, iobase:%08x\n", u->iobase);
|
grub_dprintf ("uhci", "transfer, iobase:%08x\n", u->iobase);
|
||||||
|
|
||||||
|
@ -465,23 +536,29 @@ grub_uhci_transfer (grub_usb_controller_t dev,
|
||||||
{
|
{
|
||||||
grub_usb_transaction_t tr = &transfer->transactions[i];
|
grub_usb_transaction_t tr = &transfer->transactions[i];
|
||||||
|
|
||||||
td = grub_uhci_transaction (u, transfer->endpoint, tr->pid,
|
td = grub_uhci_transaction (u, transfer->endpoint & 15, tr->pid,
|
||||||
transfer->devaddr, tr->toggle,
|
transfer->devaddr, tr->toggle,
|
||||||
tr->size, tr->data);
|
tr->size, tr->data,
|
||||||
|
transfer->dev->speed);
|
||||||
if (! td)
|
if (! td)
|
||||||
{
|
{
|
||||||
|
grub_size_t actual = 0;
|
||||||
/* Terminate and free. */
|
/* Terminate and free. */
|
||||||
|
if (td_prev)
|
||||||
|
{
|
||||||
td_prev->linkptr2 = 0;
|
td_prev->linkptr2 = 0;
|
||||||
td_prev->linkptr = 1;
|
td_prev->linkptr = 1;
|
||||||
|
}
|
||||||
|
|
||||||
if (td_first)
|
if (cdata->td_first)
|
||||||
grub_free_queue (u, td_first, NULL, actual);
|
grub_free_queue (u, cdata->qh, cdata->td_first, NULL, &actual);
|
||||||
|
|
||||||
|
grub_free (cdata);
|
||||||
return GRUB_USB_ERR_INTERNAL;
|
return GRUB_USB_ERR_INTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (! td_first)
|
if (! cdata->td_first)
|
||||||
td_first = td;
|
cdata->td_first = td;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
td_prev->linkptr2 = (grub_uint32_t) (grub_addr_t) td;
|
td_prev->linkptr2 = (grub_uint32_t) (grub_addr_t) td;
|
||||||
|
@ -497,81 +574,112 @@ grub_uhci_transfer (grub_usb_controller_t dev,
|
||||||
|
|
||||||
/* Link it into the queue and terminate. Now the transaction can
|
/* Link it into the queue and terminate. Now the transaction can
|
||||||
take place. */
|
take place. */
|
||||||
qh->elinkptr = (grub_uint32_t) (grub_addr_t) td_first;
|
cdata->qh->elinkptr = (grub_uint32_t) (grub_addr_t) cdata->td_first;
|
||||||
|
|
||||||
grub_dprintf ("uhci", "initiate transaction\n");
|
grub_dprintf ("uhci", "initiate transaction\n");
|
||||||
|
|
||||||
/* Wait until either the transaction completed or an error
|
transfer->controller_data = cdata;
|
||||||
occurred. */
|
|
||||||
endtime = grub_get_time_ms () + timeout;
|
|
||||||
for (;;)
|
|
||||||
{
|
|
||||||
grub_uhci_td_t errtd;
|
|
||||||
|
|
||||||
errtd = (grub_uhci_td_t) (grub_addr_t) (qh->elinkptr & ~0x0f);
|
return GRUB_USB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_usb_err_t
|
||||||
|
grub_uhci_check_transfer (grub_usb_controller_t dev,
|
||||||
|
grub_usb_transfer_t transfer,
|
||||||
|
grub_size_t *actual)
|
||||||
|
{
|
||||||
|
struct grub_uhci *u = (struct grub_uhci *) dev->data;
|
||||||
|
grub_uhci_td_t errtd;
|
||||||
|
struct grub_uhci_transfer_controller_data *cdata = transfer->controller_data;
|
||||||
|
|
||||||
|
*actual = 0;
|
||||||
|
|
||||||
|
errtd = (grub_uhci_td_t) (grub_addr_t) (cdata->qh->elinkptr & ~0x0f);
|
||||||
|
|
||||||
grub_dprintf ("uhci", ">t status=0x%02x data=0x%02x td=%p\n",
|
grub_dprintf ("uhci", ">t status=0x%02x data=0x%02x td=%p\n",
|
||||||
errtd->ctrl_status, errtd->buffer & (~15), errtd);
|
errtd->ctrl_status, errtd->buffer & (~15), errtd);
|
||||||
|
|
||||||
/* Check if the transaction completed. */
|
/* Check if the transaction completed. */
|
||||||
if (qh->elinkptr & 1)
|
if (cdata->qh->elinkptr & 1)
|
||||||
break;
|
{
|
||||||
|
grub_dprintf ("uhci", "transaction complete\n");
|
||||||
|
|
||||||
|
/* Place the QH back in the free list and deallocate the associated
|
||||||
|
TDs. */
|
||||||
|
cdata->qh->elinkptr = 1;
|
||||||
|
grub_free_queue (u, cdata->qh, cdata->td_first, transfer, actual);
|
||||||
|
grub_free (cdata);
|
||||||
|
return GRUB_USB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
grub_dprintf ("uhci", "t status=0x%02x\n", errtd->ctrl_status);
|
grub_dprintf ("uhci", "t status=0x%02x\n", errtd->ctrl_status);
|
||||||
|
|
||||||
|
if (!(errtd->ctrl_status & (1 << 23)))
|
||||||
|
{
|
||||||
|
grub_usb_err_t err = GRUB_USB_ERR_NONE;
|
||||||
|
|
||||||
/* Check if the endpoint is stalled. */
|
/* Check if the endpoint is stalled. */
|
||||||
if (errtd->ctrl_status & (1 << 22))
|
if (errtd->ctrl_status & (1 << 22))
|
||||||
err = GRUB_USB_ERR_STALL;
|
err = GRUB_USB_ERR_STALL;
|
||||||
|
|
||||||
/* Check if an error related to the data buffer occurred. */
|
/* Check if an error related to the data buffer occurred. */
|
||||||
if (errtd->ctrl_status & (1 << 21))
|
else if (errtd->ctrl_status & (1 << 21))
|
||||||
err = GRUB_USB_ERR_DATA;
|
err = GRUB_USB_ERR_DATA;
|
||||||
|
|
||||||
/* Check if a babble error occurred. */
|
/* Check if a babble error occurred. */
|
||||||
if (errtd->ctrl_status & (1 << 20))
|
else if (errtd->ctrl_status & (1 << 20))
|
||||||
err = GRUB_USB_ERR_BABBLE;
|
err = GRUB_USB_ERR_BABBLE;
|
||||||
|
|
||||||
/* Check if a NAK occurred. */
|
/* Check if a NAK occurred. */
|
||||||
if (errtd->ctrl_status & (1 << 19))
|
else if (errtd->ctrl_status & (1 << 19))
|
||||||
err = GRUB_USB_ERR_NAK;
|
err = GRUB_USB_ERR_NAK;
|
||||||
|
|
||||||
/* Check if a timeout occurred. */
|
/* Check if a timeout occurred. */
|
||||||
if (errtd->ctrl_status & (1 << 18))
|
else if (errtd->ctrl_status & (1 << 18))
|
||||||
err = GRUB_USB_ERR_TIMEOUT;
|
err = GRUB_USB_ERR_TIMEOUT;
|
||||||
|
|
||||||
/* Check if a bitstuff error occurred. */
|
/* Check if a bitstuff error occurred. */
|
||||||
if (errtd->ctrl_status & (1 << 17))
|
else if (errtd->ctrl_status & (1 << 17))
|
||||||
err = GRUB_USB_ERR_BITSTUFF;
|
err = GRUB_USB_ERR_BITSTUFF;
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
goto fail;
|
{
|
||||||
|
grub_dprintf ("uhci", "transaction failed\n");
|
||||||
|
|
||||||
|
/* Place the QH back in the free list and deallocate the associated
|
||||||
|
TDs. */
|
||||||
|
cdata->qh->elinkptr = 1;
|
||||||
|
grub_free_queue (u, cdata->qh, cdata->td_first, transfer, actual);
|
||||||
|
grub_free (cdata);
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Fall through, no errors occurred, so the QH might be
|
/* Fall through, no errors occurred, so the QH might be
|
||||||
updated. */
|
updated. */
|
||||||
grub_dprintf ("uhci", "transaction fallthrough\n");
|
grub_dprintf ("uhci", "transaction fallthrough\n");
|
||||||
|
|
||||||
if (grub_get_time_ms () > endtime)
|
return GRUB_USB_ERR_WAIT;
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_usb_err_t
|
||||||
|
grub_uhci_cancel_transfer (grub_usb_controller_t dev,
|
||||||
|
grub_usb_transfer_t transfer)
|
||||||
{
|
{
|
||||||
err = GRUB_USB_ERR_STALL;
|
struct grub_uhci *u = (struct grub_uhci *) dev->data;
|
||||||
grub_dprintf ("uhci", "transaction timed out\n");
|
grub_size_t actual;
|
||||||
goto fail;
|
struct grub_uhci_transfer_controller_data *cdata = transfer->controller_data;
|
||||||
}
|
|
||||||
grub_cpu_idle ();
|
|
||||||
}
|
|
||||||
|
|
||||||
grub_dprintf ("uhci", "transaction complete\n");
|
grub_dprintf ("uhci", "transaction cancel\n");
|
||||||
|
|
||||||
fail:
|
|
||||||
|
|
||||||
if (err != GRUB_USB_ERR_NONE)
|
|
||||||
grub_dprintf ("uhci", "transaction failed\n");
|
|
||||||
|
|
||||||
/* Place the QH back in the free list and deallocate the associated
|
/* Place the QH back in the free list and deallocate the associated
|
||||||
TDs. */
|
TDs. */
|
||||||
qh->elinkptr = 1;
|
cdata->qh->elinkptr = 1;
|
||||||
grub_free_queue (u, td_first, transfer, actual);
|
grub_free_queue (u, cdata->qh, cdata->td_first, transfer, &actual);
|
||||||
|
grub_free (cdata);
|
||||||
|
|
||||||
return err;
|
return GRUB_USB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -622,7 +730,7 @@ grub_uhci_portstatus (grub_usb_controller_t dev,
|
||||||
endtime = grub_get_time_ms () + 1000;
|
endtime = grub_get_time_ms () + 1000;
|
||||||
while ((grub_uhci_readreg16 (u, reg) & (1 << 2)))
|
while ((grub_uhci_readreg16 (u, reg) & (1 << 2)))
|
||||||
if (grub_get_time_ms () > endtime)
|
if (grub_get_time_ms () > endtime)
|
||||||
return grub_error (GRUB_ERR_IO, "UHCI Timed out");
|
return grub_error (GRUB_ERR_IO, "UHCI Timed out - disable");
|
||||||
|
|
||||||
status = grub_uhci_readreg16 (u, reg);
|
status = grub_uhci_readreg16 (u, reg);
|
||||||
grub_dprintf ("uhci", ">3detect=0x%02x\n", status);
|
grub_dprintf ("uhci", ">3detect=0x%02x\n", status);
|
||||||
|
@ -630,28 +738,37 @@ grub_uhci_portstatus (grub_usb_controller_t dev,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Reset the port. */
|
/* Reset the port. */
|
||||||
grub_uhci_writereg16 (u, reg, 1 << 9);
|
status = grub_uhci_readreg16 (u, reg) & ~GRUB_UHCI_PORTSC_RWC;
|
||||||
|
grub_uhci_writereg16 (u, reg, status | (1 << 9));
|
||||||
|
grub_uhci_readreg16 (u, reg); /* Ensure it is writen... */
|
||||||
|
|
||||||
/* Wait for the reset to complete. XXX: How long exactly? */
|
/* Wait for the reset to complete. XXX: How long exactly? */
|
||||||
grub_millisleep (50); /* For root hub should be nominaly 50ms */
|
grub_millisleep (50); /* For root hub should be nominaly 50ms */
|
||||||
status = grub_uhci_readreg16 (u, reg);
|
status = grub_uhci_readreg16 (u, reg) & ~GRUB_UHCI_PORTSC_RWC;
|
||||||
grub_uhci_writereg16 (u, reg, status & ~(1 << 9));
|
grub_uhci_writereg16 (u, reg, status & ~(1 << 9));
|
||||||
grub_dprintf ("uhci", "reset completed\n");
|
grub_uhci_readreg16 (u, reg); /* Ensure it is writen... */
|
||||||
grub_millisleep (10);
|
|
||||||
|
/* Note: some debug prints were removed because they affected reset/enable timing. */
|
||||||
|
|
||||||
|
grub_millisleep (1); /* Probably not needed at all or only few microsecs. */
|
||||||
|
|
||||||
|
/* Reset bits Connect & Enable Status Change */
|
||||||
|
status = grub_uhci_readreg16 (u, reg) & ~GRUB_UHCI_PORTSC_RWC;
|
||||||
|
grub_uhci_writereg16 (u, reg, status | (1 << 3) | GRUB_UHCI_REG_PORTSC_CONNECT_CHANGED);
|
||||||
|
grub_uhci_readreg16 (u, reg); /* Ensure it is writen... */
|
||||||
|
|
||||||
/* Enable the port. */
|
/* Enable the port. */
|
||||||
grub_uhci_writereg16 (u, reg, 1 << 2);
|
status = grub_uhci_readreg16 (u, reg) & ~GRUB_UHCI_PORTSC_RWC;
|
||||||
grub_millisleep (10);
|
grub_uhci_writereg16 (u, reg, status | (1 << 2));
|
||||||
|
grub_uhci_readreg16 (u, reg); /* Ensure it is writen... */
|
||||||
grub_dprintf ("uhci", "waiting for the port to be enabled\n");
|
|
||||||
|
|
||||||
endtime = grub_get_time_ms () + 1000;
|
endtime = grub_get_time_ms () + 1000;
|
||||||
while (! ((status = grub_uhci_readreg16 (u, reg)) & (1 << 2)))
|
while (! ((status = grub_uhci_readreg16 (u, reg)) & (1 << 2)))
|
||||||
if (grub_get_time_ms () > endtime)
|
if (grub_get_time_ms () > endtime)
|
||||||
return grub_error (GRUB_ERR_IO, "UHCI Timed out");
|
return grub_error (GRUB_ERR_IO, "UHCI Timed out - enable");
|
||||||
|
|
||||||
/* Reset bit Connect Status Change */
|
/* Reset recovery time */
|
||||||
grub_uhci_writereg16 (u, reg, status | (1 << 1));
|
grub_millisleep (10);
|
||||||
|
|
||||||
/* Read final port status */
|
/* Read final port status */
|
||||||
status = grub_uhci_readreg16 (u, reg);
|
status = grub_uhci_readreg16 (u, reg);
|
||||||
|
@ -675,15 +792,22 @@ grub_uhci_detect_dev (grub_usb_controller_t dev, int port, int *changed)
|
||||||
else if (port == 1)
|
else if (port == 1)
|
||||||
reg = GRUB_UHCI_REG_PORTSC2;
|
reg = GRUB_UHCI_REG_PORTSC2;
|
||||||
else
|
else
|
||||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
return GRUB_USB_SPEED_NONE;
|
||||||
"UHCI Root Hub port does not exist");
|
|
||||||
|
|
||||||
status = grub_uhci_readreg16 (u, reg);
|
status = grub_uhci_readreg16 (u, reg);
|
||||||
|
|
||||||
grub_dprintf ("uhci", "detect=0x%02x port=%d\n", status, port);
|
grub_dprintf ("uhci", "detect=0x%02x port=%d\n", status, port);
|
||||||
|
|
||||||
/* Connect Status Change bit - it detects change of connection */
|
/* Connect Status Change bit - it detects change of connection */
|
||||||
*changed = ((status & (1 << 1)) != 0);
|
if (status & (1 << 1))
|
||||||
|
{
|
||||||
|
*changed = 1;
|
||||||
|
/* Reset bit Connect Status Change */
|
||||||
|
grub_uhci_writereg16 (u, reg, (status & GRUB_UHCI_REG_PORTSC_RW)
|
||||||
|
| GRUB_UHCI_REG_PORTSC_CONNECT_CHANGED);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
*changed = 0;
|
||||||
|
|
||||||
if (! (status & 1))
|
if (! (status & 1))
|
||||||
return GRUB_USB_SPEED_NONE;
|
return GRUB_USB_SPEED_NONE;
|
||||||
|
@ -705,7 +829,9 @@ static struct grub_usb_controller_dev usb_controller =
|
||||||
{
|
{
|
||||||
.name = "uhci",
|
.name = "uhci",
|
||||||
.iterate = grub_uhci_iterate,
|
.iterate = grub_uhci_iterate,
|
||||||
.transfer = grub_uhci_transfer,
|
.setup_transfer = grub_uhci_setup_transfer,
|
||||||
|
.check_transfer = grub_uhci_check_transfer,
|
||||||
|
.cancel_transfer = grub_uhci_cancel_transfer,
|
||||||
.hubports = grub_uhci_hubports,
|
.hubports = grub_uhci_hubports,
|
||||||
.portstatus = grub_uhci_portstatus,
|
.portstatus = grub_uhci_portstatus,
|
||||||
.detect_dev = grub_uhci_detect_dev
|
.detect_dev = grub_uhci_detect_dev
|
||||||
|
|
|
@ -24,8 +24,10 @@
|
||||||
#include <grub/list.h>
|
#include <grub/list.h>
|
||||||
#include <grub/term.h>
|
#include <grub/term.h>
|
||||||
|
|
||||||
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
static grub_usb_controller_dev_t grub_usb_list;
|
static grub_usb_controller_dev_t grub_usb_list;
|
||||||
struct grub_usb_attach_desc *attach_hooks;
|
static struct grub_usb_attach_desc *attach_hooks;
|
||||||
|
|
||||||
void
|
void
|
||||||
grub_usb_controller_dev_register (grub_usb_controller_dev_t usb)
|
grub_usb_controller_dev_register (grub_usb_controller_dev_t usb)
|
||||||
|
@ -183,6 +185,12 @@ grub_usb_device_initialize (grub_usb_device_t dev)
|
||||||
for (i = 0; i < 8; i++)
|
for (i = 0; i < 8; i++)
|
||||||
dev->config[i].descconf = NULL;
|
dev->config[i].descconf = NULL;
|
||||||
|
|
||||||
|
if (descdev->configcnt == 0)
|
||||||
|
{
|
||||||
|
err = GRUB_USB_ERR_BADDEVICE;
|
||||||
|
goto fail;
|
||||||
|
}
|
||||||
|
|
||||||
for (i = 0; i < descdev->configcnt; i++)
|
for (i = 0; i < descdev->configcnt; i++)
|
||||||
{
|
{
|
||||||
int pos;
|
int pos;
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
/* USB Supports 127 devices, with device 0 as special case. */
|
/* USB Supports 127 devices, with device 0 as special case. */
|
||||||
static struct grub_usb_device *grub_usb_devs[GRUB_USBHUB_MAX_DEVICES];
|
static struct grub_usb_device *grub_usb_devs[GRUB_USBHUB_MAX_DEVICES];
|
||||||
|
|
||||||
|
static int rescan = 0;
|
||||||
|
|
||||||
struct grub_usb_hub
|
struct grub_usb_hub
|
||||||
{
|
{
|
||||||
struct grub_usb_hub *next;
|
struct grub_usb_hub *next;
|
||||||
|
@ -37,7 +39,7 @@ struct grub_usb_hub
|
||||||
grub_usb_device_t dev;
|
grub_usb_device_t dev;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct grub_usb_hub *hubs;
|
static struct grub_usb_hub *hubs;
|
||||||
|
|
||||||
/* Add a device that currently has device number 0 and resides on
|
/* Add a device that currently has device number 0 and resides on
|
||||||
CONTROLLER, the Hub reported that the device speed is SPEED. */
|
CONTROLLER, the Hub reported that the device speed is SPEED. */
|
||||||
|
@ -108,11 +110,8 @@ static grub_usb_err_t
|
||||||
grub_usb_add_hub (grub_usb_device_t dev)
|
grub_usb_add_hub (grub_usb_device_t dev)
|
||||||
{
|
{
|
||||||
struct grub_usb_usb_hubdesc hubdesc;
|
struct grub_usb_usb_hubdesc hubdesc;
|
||||||
grub_err_t err;
|
grub_usb_err_t err;
|
||||||
int i;
|
int i;
|
||||||
grub_uint64_t timeout;
|
|
||||||
grub_usb_device_t next_dev;
|
|
||||||
grub_usb_device_t *attached_devices;
|
|
||||||
|
|
||||||
err = grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_IN
|
err = grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_IN
|
||||||
| GRUB_USB_REQTYPE_CLASS
|
| GRUB_USB_REQTYPE_CLASS
|
||||||
|
@ -131,11 +130,9 @@ grub_usb_add_hub (grub_usb_device_t dev)
|
||||||
grub_dprintf ("usb", "Hub set configuration\n");
|
grub_dprintf ("usb", "Hub set configuration\n");
|
||||||
grub_usb_set_configuration (dev, 1);
|
grub_usb_set_configuration (dev, 1);
|
||||||
|
|
||||||
attached_devices = grub_zalloc (hubdesc.portcnt
|
dev->children = grub_zalloc (hubdesc.portcnt * sizeof (dev->children[0]));
|
||||||
* sizeof (attached_devices[0]));
|
if (!dev->children)
|
||||||
if (!attached_devices)
|
|
||||||
return GRUB_USB_ERR_INTERNAL;
|
return GRUB_USB_ERR_INTERNAL;
|
||||||
dev->children = attached_devices;
|
|
||||||
dev->nports = hubdesc.portcnt;
|
dev->nports = hubdesc.portcnt;
|
||||||
|
|
||||||
/* Power on all Hub ports. */
|
/* Power on all Hub ports. */
|
||||||
|
@ -143,115 +140,36 @@ grub_usb_add_hub (grub_usb_device_t dev)
|
||||||
{
|
{
|
||||||
grub_dprintf ("usb", "Power on - port %d\n", i);
|
grub_dprintf ("usb", "Power on - port %d\n", i);
|
||||||
/* Power on the port and wait for possible device connect */
|
/* Power on the port and wait for possible device connect */
|
||||||
err = grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_OUT
|
grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_OUT
|
||||||
| GRUB_USB_REQTYPE_CLASS
|
| GRUB_USB_REQTYPE_CLASS
|
||||||
| GRUB_USB_REQTYPE_TARGET_OTHER),
|
| GRUB_USB_REQTYPE_TARGET_OTHER),
|
||||||
GRUB_USB_REQ_SET_FEATURE,
|
GRUB_USB_REQ_SET_FEATURE,
|
||||||
GRUB_USB_HUB_FEATURE_PORT_POWER,
|
GRUB_USB_HUB_FEATURE_PORT_POWER,
|
||||||
i, 0, NULL);
|
i, 0, NULL);
|
||||||
/* Just ignore the device if some error happened */
|
|
||||||
if (err)
|
|
||||||
continue;
|
|
||||||
}
|
}
|
||||||
/* Wait for port power-on */
|
|
||||||
if (hubdesc.pwdgood >= 50)
|
|
||||||
grub_millisleep (hubdesc.pwdgood * 2);
|
|
||||||
else
|
|
||||||
grub_millisleep (100);
|
|
||||||
|
|
||||||
/* Iterate over the Hub ports. */
|
/* Rest will be done on next usb poll. */
|
||||||
for (i = 1; i <= hubdesc.portcnt; i++)
|
for (i = 0; i < dev->config[0].interf[0].descif->endpointcnt;
|
||||||
|
i++)
|
||||||
{
|
{
|
||||||
grub_uint32_t status;
|
struct grub_usb_desc_endp *endp = NULL;
|
||||||
|
endp = &dev->config[0].interf[0].descendp[i];
|
||||||
|
|
||||||
/* Get the port status. */
|
if ((endp->endp_addr & 128) && grub_usb_get_ep_type(endp)
|
||||||
err = grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_IN
|
== GRUB_USB_EP_INTERRUPT)
|
||||||
| GRUB_USB_REQTYPE_CLASS
|
|
||||||
| GRUB_USB_REQTYPE_TARGET_OTHER),
|
|
||||||
GRUB_USB_REQ_GET_STATUS,
|
|
||||||
0, i, sizeof (status), (char *) &status);
|
|
||||||
/* Just ignore the device if the Hub does not report the
|
|
||||||
status. */
|
|
||||||
if (err)
|
|
||||||
continue;
|
|
||||||
grub_dprintf ("usb", "Hub port %d status: 0x%02x\n", i, status);
|
|
||||||
|
|
||||||
/* If connected, reset and enable the port. */
|
|
||||||
if (status & GRUB_USB_HUB_STATUS_CONNECTED)
|
|
||||||
{
|
{
|
||||||
grub_usb_speed_t speed;
|
dev->hub_endpoint = endp;
|
||||||
|
dev->hub_transfer
|
||||||
/* Determine the device speed. */
|
= grub_usb_bulk_read_background (dev, endp->endp_addr,
|
||||||
if (status & GRUB_USB_HUB_STATUS_LOWSPEED)
|
grub_min (endp->maxpacket,
|
||||||
speed = GRUB_USB_SPEED_LOW;
|
sizeof (dev->statuschange)),
|
||||||
else
|
(char *) &dev->statuschange);
|
||||||
{
|
break;
|
||||||
if (status & GRUB_USB_HUB_STATUS_HIGHSPEED)
|
|
||||||
speed = GRUB_USB_SPEED_HIGH;
|
|
||||||
else
|
|
||||||
speed = GRUB_USB_SPEED_FULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* A device is actually connected to this port.
|
|
||||||
* Now do reset of port. */
|
|
||||||
grub_dprintf ("usb", "Reset hub port - port %d\n", i);
|
|
||||||
err = 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,
|
|
||||||
i, 0, 0);
|
|
||||||
/* If the Hub does not cooperate for this port, just skip
|
|
||||||
the port. */
|
|
||||||
if (err)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* Wait for reset procedure done */
|
|
||||||
timeout = grub_get_time_ms () + 1000;
|
|
||||||
do
|
|
||||||
{
|
|
||||||
/* 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,
|
|
||||||
0, i, sizeof (status), (char *) &status);
|
|
||||||
}
|
|
||||||
while (!err &&
|
|
||||||
!(status & GRUB_USB_HUB_STATUS_C_PORT_RESET) &&
|
|
||||||
(grub_get_time_ms() < timeout) );
|
|
||||||
if (err || !(status & GRUB_USB_HUB_STATUS_C_PORT_RESET) )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* Wait a recovery time after reset, spec. says 10ms */
|
|
||||||
grub_millisleep (10);
|
|
||||||
|
|
||||||
/* Do reset of connection change bit */
|
|
||||||
err = 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_CONNECTED,
|
|
||||||
i, 0, 0);
|
|
||||||
/* Just ignore the device if the Hub reports some error */
|
|
||||||
if (err)
|
|
||||||
continue;
|
|
||||||
grub_dprintf ("usb", "Hub port - cleared connection change\n");
|
|
||||||
|
|
||||||
/* Add the device and assign a device address to it. */
|
|
||||||
grub_dprintf ("usb", "Call hub_add_dev - port %d\n", i);
|
|
||||||
next_dev = grub_usb_hub_add_dev (&dev->controller, speed);
|
|
||||||
if (! next_dev)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
attached_devices[i - 1] = next_dev;
|
|
||||||
|
|
||||||
/* If the device is a Hub, scan it for more devices. */
|
|
||||||
if (next_dev->descdev.class == 0x09)
|
|
||||||
grub_usb_add_hub (next_dev);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
rescan = 1;
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -261,19 +179,47 @@ attach_root_port (struct grub_usb_hub *hub, int portno,
|
||||||
{
|
{
|
||||||
grub_usb_device_t dev;
|
grub_usb_device_t dev;
|
||||||
grub_err_t err;
|
grub_err_t err;
|
||||||
|
int total, i;
|
||||||
|
grub_usb_speed_t current_speed = GRUB_USB_SPEED_NONE;
|
||||||
|
int changed=0;
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/* Specification does not say about disabling of port when device
|
||||||
|
* connected. If disabling is really necessary for some devices,
|
||||||
|
* delete this #if 0 and related #endif */
|
||||||
/* Disable the port. XXX: Why? */
|
/* Disable the port. XXX: Why? */
|
||||||
err = hub->controller->dev->portstatus (hub->controller, portno, 0);
|
err = hub->controller->dev->portstatus (hub->controller, portno, 0);
|
||||||
if (err)
|
if (err)
|
||||||
return;
|
return;
|
||||||
|
#endif
|
||||||
|
/* 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... */
|
||||||
|
for (total = i = 0; (i < 250) && (total < 2000); i++, total++)
|
||||||
|
{
|
||||||
|
grub_millisleep (1);
|
||||||
|
current_speed = hub->controller->dev->detect_dev
|
||||||
|
(hub->controller, portno, &changed);
|
||||||
|
if (current_speed == GRUB_USB_SPEED_NONE)
|
||||||
|
i = 0;
|
||||||
|
}
|
||||||
|
grub_dprintf ("usb", "total=%d\n", total);
|
||||||
|
if (total >= 2000)
|
||||||
|
return;
|
||||||
|
|
||||||
/* Enable the port. */
|
/* Enable the port. */
|
||||||
err = hub->controller->dev->portstatus (hub->controller, portno, 1);
|
err = hub->controller->dev->portstatus (hub->controller, portno, 1);
|
||||||
if (err)
|
if (err)
|
||||||
return;
|
return;
|
||||||
|
hub->controller->dev->pending_reset = grub_get_time_ms () + 5000;
|
||||||
|
|
||||||
|
grub_millisleep (10);
|
||||||
|
|
||||||
/* Enable the port and create a device. */
|
/* Enable the port and create a device. */
|
||||||
dev = grub_usb_hub_add_dev (hub->controller, speed);
|
dev = grub_usb_hub_add_dev (hub->controller, speed);
|
||||||
|
hub->controller->dev->pending_reset = 0;
|
||||||
if (! dev)
|
if (! dev)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -320,12 +266,15 @@ grub_usb_root_hub (grub_usb_controller_t controller)
|
||||||
for (i = 0; i < hub->nports; i++)
|
for (i = 0; i < hub->nports; i++)
|
||||||
{
|
{
|
||||||
grub_usb_speed_t speed;
|
grub_usb_speed_t speed;
|
||||||
|
if (!controller->dev->pending_reset)
|
||||||
|
{
|
||||||
speed = controller->dev->detect_dev (hub->controller, i,
|
speed = controller->dev->detect_dev (hub->controller, i,
|
||||||
&changed);
|
&changed);
|
||||||
|
|
||||||
if (speed != GRUB_USB_SPEED_NONE)
|
if (speed != GRUB_USB_SPEED_NONE)
|
||||||
attach_root_port (hub, i, speed);
|
attach_root_port (hub, i, speed);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return GRUB_USB_ERR_NONE;
|
return GRUB_USB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
@ -341,6 +290,9 @@ detach_device (grub_usb_device_t dev)
|
||||||
return;
|
return;
|
||||||
if (dev->descdev.class == GRUB_USB_CLASS_HUB)
|
if (dev->descdev.class == GRUB_USB_CLASS_HUB)
|
||||||
{
|
{
|
||||||
|
if (dev->hub_transfer)
|
||||||
|
grub_usb_cancel_transfer (dev->hub_transfer);
|
||||||
|
|
||||||
for (i = 0; i < dev->nports; i++)
|
for (i = 0; i < dev->nports; i++)
|
||||||
detach_device (dev->children[i]);
|
detach_device (dev->children[i]);
|
||||||
grub_free (dev->children);
|
grub_free (dev->children);
|
||||||
|
@ -359,16 +311,39 @@ detach_device (grub_usb_device_t dev)
|
||||||
static void
|
static void
|
||||||
poll_nonroot_hub (grub_usb_device_t dev)
|
poll_nonroot_hub (grub_usb_device_t dev)
|
||||||
{
|
{
|
||||||
grub_err_t err;
|
grub_usb_err_t err;
|
||||||
unsigned i;
|
unsigned i;
|
||||||
grub_uint64_t timeout;
|
grub_uint8_t changed;
|
||||||
grub_usb_device_t next_dev;
|
grub_size_t actual;
|
||||||
grub_usb_device_t *attached_devices = dev->children;
|
int j, total;
|
||||||
|
|
||||||
|
if (!dev->hub_transfer)
|
||||||
|
return;
|
||||||
|
|
||||||
|
err = grub_usb_check_transfer (dev->hub_transfer, &actual);
|
||||||
|
|
||||||
|
if (err == GRUB_USB_ERR_WAIT)
|
||||||
|
return;
|
||||||
|
|
||||||
|
changed = dev->statuschange;
|
||||||
|
|
||||||
|
dev->hub_transfer
|
||||||
|
= grub_usb_bulk_read_background (dev, dev->hub_endpoint->endp_addr,
|
||||||
|
grub_min (dev->hub_endpoint->maxpacket,
|
||||||
|
sizeof (dev->statuschange)),
|
||||||
|
(char *) &dev->statuschange);
|
||||||
|
|
||||||
|
if (err || actual == 0 || changed == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
/* Iterate over the Hub ports. */
|
/* Iterate over the Hub ports. */
|
||||||
for (i = 1; i <= dev->nports; i++)
|
for (i = 1; i <= dev->nports; i++)
|
||||||
{
|
{
|
||||||
grub_uint32_t status;
|
grub_uint32_t status;
|
||||||
|
grub_uint32_t current_status = 0;
|
||||||
|
|
||||||
|
if (!(changed & (1 << i)))
|
||||||
|
continue;
|
||||||
|
|
||||||
/* Get the port status. */
|
/* Get the port status. */
|
||||||
err = grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_IN
|
err = grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_IN
|
||||||
|
@ -376,92 +351,140 @@ poll_nonroot_hub (grub_usb_device_t dev)
|
||||||
| GRUB_USB_REQTYPE_TARGET_OTHER),
|
| GRUB_USB_REQTYPE_TARGET_OTHER),
|
||||||
GRUB_USB_REQ_GET_STATUS,
|
GRUB_USB_REQ_GET_STATUS,
|
||||||
0, i, sizeof (status), (char *) &status);
|
0, i, sizeof (status), (char *) &status);
|
||||||
/* Just ignore the device if the Hub does not report the
|
|
||||||
status. */
|
grub_dprintf ("usb", "dev = %p, i = %d, status = %08x\n",
|
||||||
|
dev, i, status);
|
||||||
|
|
||||||
if (err)
|
if (err)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (status & GRUB_USB_HUB_STATUS_C_CONNECTED)
|
/* 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 & 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 & 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 (!dev->controller.dev->pending_reset &&
|
||||||
|
(status & GRUB_USB_HUB_STATUS_C_PORT_CONNECTED))
|
||||||
{
|
{
|
||||||
detach_device (attached_devices[i-1]);
|
grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_OUT
|
||||||
attached_devices[i - 1] = NULL;
|
| GRUB_USB_REQTYPE_CLASS
|
||||||
}
|
| GRUB_USB_REQTYPE_TARGET_OTHER),
|
||||||
|
GRUB_USB_REQ_CLEAR_FEATURE,
|
||||||
|
GRUB_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 ? */
|
/* Connected and status of connection changed ? */
|
||||||
if ((status & GRUB_USB_HUB_STATUS_CONNECTED)
|
if (status & GRUB_USB_HUB_STATUS_PORT_CONNECTED)
|
||||||
&& (status & GRUB_USB_HUB_STATUS_C_CONNECTED))
|
|
||||||
{
|
{
|
||||||
grub_usb_speed_t speed;
|
/* A device is actually connected to this port. */
|
||||||
|
/* Wait for completion of insertion and stable power (USB spec.)
|
||||||
/* Determine the device speed. */
|
* Should be at least 100ms, some devices requires more...
|
||||||
if (status & GRUB_USB_HUB_STATUS_LOWSPEED)
|
* There is also another thing - some devices have worse contacts
|
||||||
speed = GRUB_USB_SPEED_LOW;
|
* and connected signal is unstable for some time - we should handle
|
||||||
else
|
* it - but prevent deadlock in case when device is too faulty... */
|
||||||
|
for (total = j = 0; (j < 250) && (total < 2000); j++, total++)
|
||||||
{
|
{
|
||||||
if (status & GRUB_USB_HUB_STATUS_HIGHSPEED)
|
grub_millisleep (1);
|
||||||
speed = GRUB_USB_SPEED_HIGH;
|
/* Get the port status. */
|
||||||
else
|
err = grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_IN
|
||||||
speed = GRUB_USB_SPEED_FULL;
|
| GRUB_USB_REQTYPE_CLASS
|
||||||
|
| GRUB_USB_REQTYPE_TARGET_OTHER),
|
||||||
|
GRUB_USB_REQ_GET_STATUS,
|
||||||
|
0, i,
|
||||||
|
sizeof (current_status),
|
||||||
|
(char *) ¤t_status);
|
||||||
|
if (err)
|
||||||
|
{
|
||||||
|
total = 2000;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
if (!(current_status & GRUB_USB_HUB_STATUS_PORT_CONNECTED))
|
||||||
|
j = 0;
|
||||||
|
}
|
||||||
|
grub_dprintf ("usb", "(non-root) total=%d\n", total);
|
||||||
|
if (total >= 2000)
|
||||||
|
continue;
|
||||||
|
|
||||||
/* A device is actually connected to this port.
|
/* Now do reset of port. */
|
||||||
* Now do reset of port. */
|
grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_OUT
|
||||||
err = grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_OUT
|
|
||||||
| GRUB_USB_REQTYPE_CLASS
|
| GRUB_USB_REQTYPE_CLASS
|
||||||
| GRUB_USB_REQTYPE_TARGET_OTHER),
|
| GRUB_USB_REQTYPE_TARGET_OTHER),
|
||||||
GRUB_USB_REQ_SET_FEATURE,
|
GRUB_USB_REQ_SET_FEATURE,
|
||||||
GRUB_USB_HUB_FEATURE_PORT_RESET,
|
GRUB_USB_HUB_FEATURE_PORT_RESET,
|
||||||
i, 0, 0);
|
i, 0, 0);
|
||||||
/* If the Hub does not cooperate for this port, just skip
|
rescan = 1;
|
||||||
the port. */
|
/* We cannot reset more than one device at the same time !
|
||||||
if (err)
|
* Resetting more devices together results in very bad
|
||||||
continue;
|
* situation: more than one device has default address 0
|
||||||
|
* at the same time !!!
|
||||||
|
* 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;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* Wait for reset procedure done */
|
if (status & GRUB_USB_HUB_STATUS_C_PORT_RESET)
|
||||||
timeout = grub_get_time_ms () + 1000;
|
|
||||||
do
|
|
||||||
{
|
{
|
||||||
/* Get the port status. */
|
grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_OUT
|
||||||
err = grub_usb_control_msg (dev, (GRUB_USB_REQTYPE_IN
|
|
||||||
| GRUB_USB_REQTYPE_CLASS
|
| GRUB_USB_REQTYPE_CLASS
|
||||||
| GRUB_USB_REQTYPE_TARGET_OTHER),
|
| GRUB_USB_REQTYPE_TARGET_OTHER),
|
||||||
GRUB_USB_REQ_GET_STATUS,
|
GRUB_USB_REQ_CLEAR_FEATURE,
|
||||||
0, i, sizeof (status), (char *) &status);
|
GRUB_USB_HUB_FEATURE_C_PORT_RESET, i, 0, 0);
|
||||||
|
|
||||||
|
if (status & GRUB_USB_HUB_STATUS_PORT_CONNECTED)
|
||||||
|
{
|
||||||
|
grub_usb_speed_t speed;
|
||||||
|
grub_usb_device_t next_dev;
|
||||||
|
|
||||||
|
/* Determine the device speed. */
|
||||||
|
if (status & GRUB_USB_HUB_STATUS_PORT_LOWSPEED)
|
||||||
|
speed = GRUB_USB_SPEED_LOW;
|
||||||
|
else
|
||||||
|
{
|
||||||
|
if (status & GRUB_USB_HUB_STATUS_PORT_HIGHSPEED)
|
||||||
|
speed = GRUB_USB_SPEED_HIGH;
|
||||||
|
else
|
||||||
|
speed = GRUB_USB_SPEED_FULL;
|
||||||
}
|
}
|
||||||
while (!err &&
|
|
||||||
!(status & GRUB_USB_HUB_STATUS_C_PORT_RESET) &&
|
|
||||||
(grub_get_time_ms() < timeout) );
|
|
||||||
if (err || !(status & GRUB_USB_HUB_STATUS_C_PORT_RESET) )
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* Wait a recovery time after reset, spec. says 10ms */
|
/* Wait a recovery time after reset, spec. says 10ms */
|
||||||
grub_millisleep (10);
|
grub_millisleep (10);
|
||||||
|
|
||||||
/* Do reset of connection change bit */
|
|
||||||
err = 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_CONNECTED,
|
|
||||||
i, 0, 0);
|
|
||||||
/* Just ignore the device if the Hub reports some error */
|
|
||||||
if (err)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
/* Add the device and assign a device address to it. */
|
/* Add the device and assign a device address to it. */
|
||||||
next_dev = grub_usb_hub_add_dev (&dev->controller, speed);
|
next_dev = grub_usb_hub_add_dev (&dev->controller, speed);
|
||||||
|
dev->controller.dev->pending_reset = 0;
|
||||||
if (! next_dev)
|
if (! next_dev)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
attached_devices[i - 1] = next_dev;
|
dev->children[i - 1] = next_dev;
|
||||||
|
|
||||||
/* If the device is a Hub, scan it for more devices. */
|
/* If the device is a Hub, scan it for more devices. */
|
||||||
if (next_dev->descdev.class == 0x09)
|
if (next_dev->descdev.class == 0x09)
|
||||||
grub_usb_add_hub (next_dev);
|
grub_usb_add_hub (next_dev);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
@ -476,12 +499,21 @@ grub_usb_poll_devices (void)
|
||||||
/* No, it should be never changed, it should be constant. */
|
/* No, it should be never changed, it should be constant. */
|
||||||
for (i = 0; i < hub->nports; i++)
|
for (i = 0; i < hub->nports; i++)
|
||||||
{
|
{
|
||||||
grub_usb_speed_t speed;
|
grub_usb_speed_t speed = GRUB_USB_SPEED_NONE;
|
||||||
int changed = 0;
|
int changed = 0;
|
||||||
|
|
||||||
speed = hub->controller->dev->detect_dev (hub->controller, i,
|
if (!hub->controller->dev->pending_reset)
|
||||||
&changed);
|
{
|
||||||
|
/* Check for possible timeout */
|
||||||
|
if (grub_get_time_ms () > hub->controller->dev->pending_reset)
|
||||||
|
{
|
||||||
|
/* Something went wrong, reset device was not
|
||||||
|
* addressed properly, timeout happened */
|
||||||
|
hub->controller->dev->pending_reset = 0;
|
||||||
|
speed = hub->controller->dev->detect_dev (hub->controller,
|
||||||
|
i, &changed);
|
||||||
|
}
|
||||||
|
}
|
||||||
if (changed)
|
if (changed)
|
||||||
{
|
{
|
||||||
detach_device (hub->devices[i]);
|
detach_device (hub->devices[i]);
|
||||||
|
@ -492,6 +524,10 @@ grub_usb_poll_devices (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
while (1)
|
||||||
|
{
|
||||||
|
rescan = 0;
|
||||||
|
|
||||||
/* We should check changes of non-root hubs too. */
|
/* We should check changes of non-root hubs too. */
|
||||||
for (i = 0; i < GRUB_USBHUB_MAX_DEVICES; i++)
|
for (i = 0; i < GRUB_USBHUB_MAX_DEVICES; i++)
|
||||||
{
|
{
|
||||||
|
@ -500,6 +536,10 @@ grub_usb_poll_devices (void)
|
||||||
if (dev && dev->descdev.class == 0x09)
|
if (dev && dev->descdev.class == 0x09)
|
||||||
poll_nonroot_hub (dev);
|
poll_nonroot_hub (dev);
|
||||||
}
|
}
|
||||||
|
if (!rescan)
|
||||||
|
break;
|
||||||
|
grub_millisleep (50);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,41 @@
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/usb.h>
|
#include <grub/usb.h>
|
||||||
#include <grub/usbtrans.h>
|
#include <grub/usbtrans.h>
|
||||||
|
#include <grub/time.h>
|
||||||
|
|
||||||
|
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)
|
||||||
|
{
|
||||||
|
grub_usb_err_t err;
|
||||||
|
grub_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;
|
||||||
|
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 err;
|
||||||
|
if (grub_get_time_ms () > endtime)
|
||||||
|
{
|
||||||
|
err = dev->controller.dev->cancel_transfer (&dev->controller,
|
||||||
|
transfer);
|
||||||
|
if (err)
|
||||||
|
return err;
|
||||||
|
return GRUB_USB_ERR_TIMEOUT;
|
||||||
|
}
|
||||||
|
grub_cpu_idle ();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
grub_usb_err_t
|
grub_usb_err_t
|
||||||
grub_usb_control_msg (grub_usb_device_t dev,
|
grub_usb_control_msg (grub_usb_device_t dev,
|
||||||
|
@ -62,7 +97,7 @@ grub_usb_control_msg (grub_usb_device_t dev,
|
||||||
if (! transfer)
|
if (! transfer)
|
||||||
{
|
{
|
||||||
grub_dma_free (data_chunk);
|
grub_dma_free (data_chunk);
|
||||||
return grub_errno;
|
return GRUB_USB_ERR_INTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
setupdata_chunk = grub_memalign_dma32 (32, sizeof (*setupdata));
|
setupdata_chunk = grub_memalign_dma32 (32, sizeof (*setupdata));
|
||||||
|
@ -70,7 +105,7 @@ grub_usb_control_msg (grub_usb_device_t dev,
|
||||||
{
|
{
|
||||||
grub_free (transfer);
|
grub_free (transfer);
|
||||||
grub_dma_free (data_chunk);
|
grub_dma_free (data_chunk);
|
||||||
return grub_errno;
|
return GRUB_USB_ERR_INTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
setupdata = grub_dma_get_virt (setupdata_chunk);
|
setupdata = grub_dma_get_virt (setupdata_chunk);
|
||||||
|
@ -104,7 +139,7 @@ grub_usb_control_msg (grub_usb_device_t dev,
|
||||||
grub_free (transfer);
|
grub_free (transfer);
|
||||||
grub_dma_free (setupdata_chunk);
|
grub_dma_free (setupdata_chunk);
|
||||||
grub_dma_free (data_chunk);
|
grub_dma_free (data_chunk);
|
||||||
return grub_errno;
|
return GRUB_USB_ERR_INTERNAL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Build a Setup packet. XXX: Endianness. */
|
/* Build a Setup packet. XXX: Endianness. */
|
||||||
|
@ -147,8 +182,8 @@ grub_usb_control_msg (grub_usb_device_t dev,
|
||||||
|
|
||||||
transfer->transactions[datablocks + 1].toggle = 1;
|
transfer->transactions[datablocks + 1].toggle = 1;
|
||||||
|
|
||||||
err = dev->controller.dev->transfer (&dev->controller, transfer,
|
err = grub_usb_execute_and_wait_transfer (dev, transfer, 1000, &actual);
|
||||||
1000, &actual);
|
|
||||||
grub_dprintf ("usb", "control: err=%d\n", err);
|
grub_dprintf ("usb", "control: err=%d\n", err);
|
||||||
|
|
||||||
grub_free (transfer->transactions);
|
grub_free (transfer->transactions);
|
||||||
|
@ -162,22 +197,20 @@ grub_usb_control_msg (grub_usb_device_t dev,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_usb_err_t
|
static grub_usb_transfer_t
|
||||||
grub_usb_bulk_readwrite (grub_usb_device_t dev,
|
grub_usb_bulk_setup_readwrite (grub_usb_device_t dev,
|
||||||
int endpoint, grub_size_t size0, char *data_in,
|
int endpoint, grub_size_t size0, char *data_in,
|
||||||
grub_transfer_type_t type, int timeout,
|
grub_transfer_type_t type)
|
||||||
grub_size_t *actual)
|
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
grub_usb_transfer_t transfer;
|
grub_usb_transfer_t transfer;
|
||||||
int datablocks;
|
int datablocks;
|
||||||
unsigned int max;
|
unsigned int max;
|
||||||
grub_usb_err_t err;
|
|
||||||
int toggle = dev->toggle[endpoint];
|
|
||||||
volatile char *data;
|
volatile char *data;
|
||||||
grub_uint32_t data_addr;
|
grub_uint32_t data_addr;
|
||||||
struct grub_pci_dma_chunk *data_chunk;
|
struct grub_pci_dma_chunk *data_chunk;
|
||||||
grub_size_t size = size0;
|
grub_size_t size = size0;
|
||||||
|
int toggle = dev->toggle[endpoint];
|
||||||
|
|
||||||
grub_dprintf ("usb", "bulk: size=0x%02lx type=%d\n", (unsigned long) size,
|
grub_dprintf ("usb", "bulk: size=0x%02lx type=%d\n", (unsigned long) size,
|
||||||
type);
|
type);
|
||||||
|
@ -185,7 +218,7 @@ grub_usb_bulk_readwrite (grub_usb_device_t dev,
|
||||||
/* FIXME: avoid allocation any kind of buffer in a first place. */
|
/* FIXME: avoid allocation any kind of buffer in a first place. */
|
||||||
data_chunk = grub_memalign_dma32 (128, size);
|
data_chunk = grub_memalign_dma32 (128, size);
|
||||||
if (!data_chunk)
|
if (!data_chunk)
|
||||||
return GRUB_USB_ERR_INTERNAL;
|
return NULL;
|
||||||
data = grub_dma_get_virt (data_chunk);
|
data = grub_dma_get_virt (data_chunk);
|
||||||
data_addr = grub_dma_get_phys (data_chunk);
|
data_addr = grub_dma_get_phys (data_chunk);
|
||||||
if (type == GRUB_USB_TRANSFER_TYPE_OUT)
|
if (type == GRUB_USB_TRANSFER_TYPE_OUT)
|
||||||
|
@ -195,7 +228,7 @@ grub_usb_bulk_readwrite (grub_usb_device_t dev,
|
||||||
if (dev->initialized)
|
if (dev->initialized)
|
||||||
{
|
{
|
||||||
struct grub_usb_desc_endp *endpdesc;
|
struct grub_usb_desc_endp *endpdesc;
|
||||||
endpdesc = grub_usb_get_endpdescriptor (dev, 0);
|
endpdesc = grub_usb_get_endpdescriptor (dev, endpoint);
|
||||||
|
|
||||||
if (endpdesc)
|
if (endpdesc)
|
||||||
max = endpdesc->maxpacket;
|
max = endpdesc->maxpacket;
|
||||||
|
@ -210,18 +243,21 @@ grub_usb_bulk_readwrite (grub_usb_device_t dev,
|
||||||
if (! transfer)
|
if (! transfer)
|
||||||
{
|
{
|
||||||
grub_dma_free (data_chunk);
|
grub_dma_free (data_chunk);
|
||||||
return grub_errno;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
datablocks = ((size + max - 1) / max);
|
datablocks = ((size + max - 1) / max);
|
||||||
transfer->transcnt = datablocks;
|
transfer->transcnt = datablocks;
|
||||||
transfer->size = size - 1;
|
transfer->size = size - 1;
|
||||||
transfer->endpoint = endpoint & 15;
|
transfer->endpoint = endpoint;
|
||||||
transfer->devaddr = dev->addr;
|
transfer->devaddr = dev->addr;
|
||||||
transfer->type = GRUB_USB_TRANSACTION_TYPE_BULK;
|
transfer->type = GRUB_USB_TRANSACTION_TYPE_BULK;
|
||||||
|
transfer->dir = type;
|
||||||
transfer->max = max;
|
transfer->max = max;
|
||||||
transfer->dev = dev;
|
transfer->dev = dev;
|
||||||
transfer->last_trans = -1; /* Reset index of last processed transaction (TD) */
|
transfer->last_trans = -1; /* Reset index of last processed transaction (TD) */
|
||||||
|
transfer->data_chunk = data_chunk;
|
||||||
|
transfer->data = data_in;
|
||||||
|
|
||||||
/* Allocate an array of transfer data structures. */
|
/* Allocate an array of transfer data structures. */
|
||||||
transfer->transactions = grub_malloc (transfer->transcnt
|
transfer->transactions = grub_malloc (transfer->transcnt
|
||||||
|
@ -230,7 +266,7 @@ grub_usb_bulk_readwrite (grub_usb_device_t dev,
|
||||||
{
|
{
|
||||||
grub_free (transfer);
|
grub_free (transfer);
|
||||||
grub_dma_free (data_chunk);
|
grub_dma_free (data_chunk);
|
||||||
return grub_errno;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Set up all transfers. */
|
/* Set up all transfers. */
|
||||||
|
@ -248,25 +284,51 @@ grub_usb_bulk_readwrite (grub_usb_device_t dev,
|
||||||
tr->preceding = i * max;
|
tr->preceding = i * max;
|
||||||
size -= tr->size;
|
size -= tr->size;
|
||||||
}
|
}
|
||||||
|
return transfer;
|
||||||
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
grub_usb_bulk_finish_readwrite (grub_usb_transfer_t transfer)
|
||||||
|
{
|
||||||
|
grub_usb_device_t dev = transfer->dev;
|
||||||
|
int toggle = dev->toggle[transfer->endpoint];
|
||||||
|
|
||||||
err = dev->controller.dev->transfer (&dev->controller, transfer, timeout,
|
|
||||||
actual);
|
|
||||||
/* We must remember proper toggle value even if some transactions
|
/* We must remember proper toggle value even if some transactions
|
||||||
* were not processed - correct value should be inversion of last
|
* were not processed - correct value should be inversion of last
|
||||||
* processed transaction (TD). */
|
* processed transaction (TD). */
|
||||||
if (transfer->last_trans >= 0)
|
if (transfer->last_trans >= 0)
|
||||||
toggle = transfer->transactions[transfer->last_trans].toggle ? 0 : 1;
|
toggle = transfer->transactions[transfer->last_trans].toggle ? 0 : 1;
|
||||||
else
|
else
|
||||||
toggle = dev->toggle[endpoint]; /* Nothing done, take original */
|
toggle = dev->toggle[transfer->endpoint]; /* Nothing done, take original */
|
||||||
grub_dprintf ("usb", "bulk: err=%d, toggle=%d\n", err, toggle);
|
grub_dprintf ("usb", "bulk: toggle=%d\n", toggle);
|
||||||
dev->toggle[endpoint] = toggle;
|
dev->toggle[transfer->endpoint] = toggle;
|
||||||
|
|
||||||
|
if (transfer->dir == GRUB_USB_TRANSFER_TYPE_IN)
|
||||||
|
grub_memcpy (transfer->data, (void *)
|
||||||
|
grub_dma_get_virt (transfer->data_chunk),
|
||||||
|
transfer->size + 1);
|
||||||
|
|
||||||
grub_free (transfer->transactions);
|
grub_free (transfer->transactions);
|
||||||
grub_free (transfer);
|
grub_free (transfer);
|
||||||
grub_dma_free (data_chunk);
|
grub_dma_free (transfer->data_chunk);
|
||||||
|
}
|
||||||
|
|
||||||
if (type == GRUB_USB_TRANSFER_TYPE_IN)
|
static grub_usb_err_t
|
||||||
grub_memcpy (data_in, (char *) data, size0);
|
grub_usb_bulk_readwrite (grub_usb_device_t dev,
|
||||||
|
int endpoint, grub_size_t size0, char *data_in,
|
||||||
|
grub_transfer_type_t type, int timeout,
|
||||||
|
grub_size_t *actual)
|
||||||
|
{
|
||||||
|
grub_usb_err_t err;
|
||||||
|
grub_usb_transfer_t transfer;
|
||||||
|
|
||||||
|
transfer = grub_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);
|
||||||
|
|
||||||
|
grub_usb_bulk_finish_readwrite (transfer);
|
||||||
|
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
@ -298,6 +360,49 @@ grub_usb_bulk_read (grub_usb_device_t dev,
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
grub_usb_err_t
|
||||||
|
grub_usb_check_transfer (grub_usb_transfer_t transfer, grub_size_t *actual)
|
||||||
|
{
|
||||||
|
grub_usb_err_t err;
|
||||||
|
grub_usb_device_t dev = transfer->dev;
|
||||||
|
|
||||||
|
err = dev->controller.dev->check_transfer (&dev->controller, transfer,
|
||||||
|
actual);
|
||||||
|
if (err == GRUB_USB_ERR_WAIT)
|
||||||
|
return err;
|
||||||
|
|
||||||
|
grub_usb_bulk_finish_readwrite (transfer);
|
||||||
|
|
||||||
|
return err;
|
||||||
|
}
|
||||||
|
|
||||||
|
grub_usb_transfer_t
|
||||||
|
grub_usb_bulk_read_background (grub_usb_device_t dev,
|
||||||
|
int endpoint, grub_size_t size, void *data)
|
||||||
|
{
|
||||||
|
grub_usb_err_t err;
|
||||||
|
grub_usb_transfer_t transfer;
|
||||||
|
|
||||||
|
transfer = grub_usb_bulk_setup_readwrite (dev, endpoint, size,
|
||||||
|
data, GRUB_USB_TRANSFER_TYPE_IN);
|
||||||
|
if (!transfer)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
err = dev->controller.dev->setup_transfer (&dev->controller, transfer);
|
||||||
|
if (err)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
return transfer;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
grub_usb_cancel_transfer (grub_usb_transfer_t transfer)
|
||||||
|
{
|
||||||
|
grub_usb_device_t dev = transfer->dev;
|
||||||
|
dev->controller.dev->cancel_transfer (&dev->controller, transfer);
|
||||||
|
grub_errno = GRUB_ERR_NONE;
|
||||||
|
}
|
||||||
|
|
||||||
grub_usb_err_t
|
grub_usb_err_t
|
||||||
grub_usb_bulk_read_extended (grub_usb_device_t dev,
|
grub_usb_bulk_read_extended (grub_usb_device_t dev,
|
||||||
int endpoint, grub_size_t size, char *data,
|
int endpoint, grub_size_t size, char *data,
|
||||||
|
|
|
@ -25,7 +25,6 @@
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/acpi.h>
|
#include <grub/acpi.h>
|
||||||
#include <grub/mm.h>
|
#include <grub/mm.h>
|
||||||
#include <grub/machine/memory.h>
|
|
||||||
#include <grub/memory.h>
|
#include <grub/memory.h>
|
||||||
#include <grub/i18n.h>
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
|
@ -34,6 +33,8 @@
|
||||||
#include <grub/efi/api.h>
|
#include <grub/efi/api.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
static const struct grub_arg_option options[] = {
|
static const struct grub_arg_option options[] = {
|
||||||
{"exclude", 'x', 0,
|
{"exclude", 'x', 0,
|
||||||
N_("Don't load host tables specified by comma-separated list."),
|
N_("Don't load host tables specified by comma-separated list."),
|
||||||
|
@ -151,10 +152,10 @@ grub_acpi_create_ebda (void)
|
||||||
auto int NESTED_FUNC_ATTR find_hook (grub_uint64_t, grub_uint64_t,
|
auto int NESTED_FUNC_ATTR find_hook (grub_uint64_t, grub_uint64_t,
|
||||||
grub_uint32_t);
|
grub_uint32_t);
|
||||||
int NESTED_FUNC_ATTR find_hook (grub_uint64_t start, grub_uint64_t size,
|
int NESTED_FUNC_ATTR find_hook (grub_uint64_t start, grub_uint64_t size,
|
||||||
grub_uint32_t type)
|
grub_memory_type_t type)
|
||||||
{
|
{
|
||||||
grub_uint64_t end = start + size;
|
grub_uint64_t end = start + size;
|
||||||
if (type != GRUB_MACHINE_MEMORY_AVAILABLE)
|
if (type != GRUB_MEMORY_AVAILABLE)
|
||||||
return 0;
|
return 0;
|
||||||
if (end > 0x100000)
|
if (end > 0x100000)
|
||||||
end = 0x100000;
|
end = 0x100000;
|
||||||
|
@ -180,7 +181,7 @@ grub_acpi_create_ebda (void)
|
||||||
"couldn't find space for the new EBDA");
|
"couldn't find space for the new EBDA");
|
||||||
|
|
||||||
mmapregion = grub_mmap_register (PTR_TO_UINT64 (targetebda), ebda_len,
|
mmapregion = grub_mmap_register (PTR_TO_UINT64 (targetebda), ebda_len,
|
||||||
GRUB_MACHINE_MEMORY_RESERVED);
|
GRUB_MEMORY_RESERVED);
|
||||||
if (! mmapregion)
|
if (! mmapregion)
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
|
@ -704,7 +705,7 @@ grub_cmd_acpi (struct grub_extcmd_context *ctxt, int argc, char **args)
|
||||||
|
|
||||||
playground = playground_ptr
|
playground = playground_ptr
|
||||||
= grub_mmap_malign_and_register (1, playground_size, &mmapregion,
|
= grub_mmap_malign_and_register (1, playground_size, &mmapregion,
|
||||||
GRUB_MACHINE_MEMORY_ACPI, 0);
|
GRUB_MEMORY_ACPI, 0);
|
||||||
|
|
||||||
if (! playground)
|
if (! playground)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,9 +16,30 @@
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#ifdef GRUB_DSDT_TEST
|
||||||
|
#include <stdio.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <string.h>
|
||||||
|
|
||||||
|
#define grub_dprintf(cond, args...) printf ( args )
|
||||||
|
#define grub_printf printf
|
||||||
|
typedef uint64_t grub_uint64_t;
|
||||||
|
typedef uint32_t grub_uint32_t;
|
||||||
|
typedef uint16_t grub_uint16_t;
|
||||||
|
typedef uint8_t grub_uint8_t;
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <grub/acpi.h>
|
#include <grub/acpi.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
|
#ifndef GRUB_DSDT_TEST
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
|
#include <grub/time.h>
|
||||||
#include <grub/cpu/io.h>
|
#include <grub/cpu/io.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
static inline grub_uint32_t
|
static inline grub_uint32_t
|
||||||
decode_length (const grub_uint8_t *ptr, int *numlen)
|
decode_length (const grub_uint8_t *ptr, int *numlen)
|
||||||
|
@ -123,6 +144,7 @@ skip_ext_op (const grub_uint8_t *ptr, const grub_uint8_t *end)
|
||||||
return 0;
|
return 0;
|
||||||
break;
|
break;
|
||||||
case GRUB_ACPI_EXTOPCODE_FIELD_OP:
|
case GRUB_ACPI_EXTOPCODE_FIELD_OP:
|
||||||
|
case GRUB_ACPI_EXTOPCODE_INDEX_FIELD_OP:
|
||||||
ptr++;
|
ptr++;
|
||||||
ptr += decode_length (ptr, 0);
|
ptr += decode_length (ptr, 0);
|
||||||
break;
|
break;
|
||||||
|
@ -136,7 +158,7 @@ skip_ext_op (const grub_uint8_t *ptr, const grub_uint8_t *end)
|
||||||
static int
|
static int
|
||||||
get_sleep_type (grub_uint8_t *table, grub_uint8_t *end)
|
get_sleep_type (grub_uint8_t *table, grub_uint8_t *end)
|
||||||
{
|
{
|
||||||
grub_uint8_t *ptr, *prev;
|
grub_uint8_t *ptr, *prev = table;
|
||||||
int sleep_type = -1;
|
int sleep_type = -1;
|
||||||
|
|
||||||
ptr = table + sizeof (struct grub_acpi_table_header);
|
ptr = table + sizeof (struct grub_acpi_table_header);
|
||||||
|
@ -156,11 +178,12 @@ get_sleep_type (grub_uint8_t *table, grub_uint8_t *end)
|
||||||
break;
|
break;
|
||||||
case GRUB_ACPI_OPCODE_NAME:
|
case GRUB_ACPI_OPCODE_NAME:
|
||||||
ptr++;
|
ptr++;
|
||||||
if (memcmp (ptr, "_S5_", 4) == 0)
|
if (memcmp (ptr, "_S5_", 4) == 0 || memcmp (ptr, "\\_S5_", 4) == 0)
|
||||||
{
|
{
|
||||||
int ll;
|
int ll;
|
||||||
grub_uint8_t *ptr2 = ptr;
|
grub_uint8_t *ptr2 = ptr;
|
||||||
ptr2 += 4;
|
grub_dprintf ("acpi", "S5 found\n");
|
||||||
|
ptr2 += skip_name_string (ptr, end);
|
||||||
if (*ptr2 != 0x12)
|
if (*ptr2 != 0x12)
|
||||||
{
|
{
|
||||||
grub_printf ("Unknown opcode in _S5: 0x%x\n", *ptr2);
|
grub_printf ("Unknown opcode in _S5: 0x%x\n", *ptr2);
|
||||||
|
@ -208,6 +231,47 @@ get_sleep_type (grub_uint8_t *table, grub_uint8_t *end)
|
||||||
return sleep_type;
|
return sleep_type;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef GRUB_DSDT_TEST
|
||||||
|
int
|
||||||
|
main (int argc, char **argv)
|
||||||
|
{
|
||||||
|
FILE *f;
|
||||||
|
size_t len;
|
||||||
|
unsigned char *buf;
|
||||||
|
if (argc < 2)
|
||||||
|
printf ("Usage: %s FILE\n", argv[0]);
|
||||||
|
f = fopen (argv[1], "rb");
|
||||||
|
if (!f)
|
||||||
|
{
|
||||||
|
printf ("Couldn't open file\n");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
fseek (f, 0, SEEK_END);
|
||||||
|
len = ftell (f);
|
||||||
|
fseek (f, 0, SEEK_SET);
|
||||||
|
buf = malloc (len);
|
||||||
|
if (!buf)
|
||||||
|
{
|
||||||
|
printf ("Couldn't malloc buffer\n");
|
||||||
|
fclose (f);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
if (fread (buf, 1, len, f) != len)
|
||||||
|
{
|
||||||
|
printf ("Read failed\n");
|
||||||
|
free (buf);
|
||||||
|
fclose (f);
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
printf ("Sleep type = %d\n", get_sleep_type (buf, buf + len));
|
||||||
|
free (buf);
|
||||||
|
fclose (f);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
void
|
void
|
||||||
grub_acpi_halt (void)
|
grub_acpi_halt (void)
|
||||||
{
|
{
|
||||||
|
@ -262,5 +326,8 @@ grub_acpi_halt (void)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_printf ("ACPI shutdown failed\n");
|
grub_millisleep (1500);
|
||||||
|
|
||||||
|
grub_puts_ (N_("ACPI shutdown failed"));
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
|
@ -1,7 +1,6 @@
|
||||||
/* pxe.c - command to control the pxe driver */
|
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2008,2009 Free Software Foundation, Inc.
|
* Copyright (C) 2011 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -18,35 +17,37 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
#include <grub/err.h>
|
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/machine/pxe.h>
|
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
#include <grub/i18n.h>
|
#include <grub/i18n.h>
|
||||||
|
#include <grub/arc/arc.h>
|
||||||
|
|
||||||
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_pxe_unload (grub_command_t cmd __attribute__ ((unused)),
|
grub_cmd_lsdev (grub_command_t cmd __attribute__ ((unused)),
|
||||||
int argc __attribute__ ((unused)),
|
int argc __attribute__ ((unused)),
|
||||||
char **args __attribute__ ((unused)))
|
char **args __attribute__ ((unused)))
|
||||||
{
|
{
|
||||||
if (! grub_pxe_pxenv)
|
auto int hook (const char *name, const struct grub_arc_component *comp);
|
||||||
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "no pxe environment");
|
int hook (const char *name, const struct grub_arc_component *comp __attribute__ ((unused)))
|
||||||
|
{
|
||||||
grub_pxe_unload ();
|
grub_printf ("%s\n", name);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
grub_arc_iterate_devs (hook, 0);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_command_t cmd;
|
static grub_command_t cmd;
|
||||||
|
|
||||||
GRUB_MOD_INIT(pxecmd)
|
GRUB_MOD_INIT(lsdev)
|
||||||
{
|
{
|
||||||
cmd = grub_register_command ("pxe_unload", grub_cmd_pxe_unload,
|
cmd = grub_register_command ("lsdev", grub_cmd_lsdev, "",
|
||||||
0,
|
N_("List devices."));
|
||||||
N_("Unload PXE environment."));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(pxecmd)
|
GRUB_MOD_FINI(lsdev)
|
||||||
{
|
{
|
||||||
grub_unregister_command (cmd);
|
grub_unregister_command (cmd);
|
||||||
}
|
}
|
|
@ -26,6 +26,8 @@
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
#include <grub/i18n.h>
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_blocklist (grub_command_t cmd __attribute__ ((unused)),
|
grub_cmd_blocklist (grub_command_t cmd __attribute__ ((unused)),
|
||||||
int argc, char **args)
|
int argc, char **args)
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
#include <grub/mm.h>
|
#include <grub/mm.h>
|
||||||
#include <grub/i18n.h>
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
static grub_err_t (*grub_loader_boot_func) (void);
|
static grub_err_t (*grub_loader_boot_func) (void);
|
||||||
static grub_err_t (*grub_loader_unload_func) (void);
|
static grub_err_t (*grub_loader_unload_func) (void);
|
||||||
static int grub_loader_noreturn;
|
static int grub_loader_noreturn;
|
||||||
|
|
58
grub-core/commands/cacheinfo.c
Normal file
58
grub-core/commands/cacheinfo.c
Normal file
|
@ -0,0 +1,58 @@
|
||||||
|
/* cacheinfo.c - disk cache statistics */
|
||||||
|
/*
|
||||||
|
* GRUB -- GRand Unified Bootloader
|
||||||
|
* Copyright (C) 2008,2010 Free Software Foundation, Inc.
|
||||||
|
*
|
||||||
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GRUB is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <grub/dl.h>
|
||||||
|
#include <grub/misc.h>
|
||||||
|
#include <grub/command.h>
|
||||||
|
#include <grub/i18n.h>
|
||||||
|
#include <grub/disk.h>
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
grub_rescue_cmd_info (struct grub_command *cmd __attribute__ ((unused)),
|
||||||
|
int argc __attribute__ ((unused)),
|
||||||
|
char *argv[] __attribute__ ((unused)))
|
||||||
|
{
|
||||||
|
unsigned long hits, misses;
|
||||||
|
|
||||||
|
grub_disk_cache_get_performance (&hits, &misses);
|
||||||
|
grub_printf_ (N_("Disk cache: hits = %lu, misses = %lu "), hits, misses);
|
||||||
|
if (hits + misses)
|
||||||
|
{
|
||||||
|
unsigned long ratio = hits * 10000 / (hits + misses);
|
||||||
|
grub_printf ("(%lu.%lu%%)\n", ratio / 100, ratio % 100);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
grub_puts_ (N_("(N/A)"));
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_command_t cmd_cacheinfo;
|
||||||
|
|
||||||
|
GRUB_MOD_INIT(cacheinfo)
|
||||||
|
{
|
||||||
|
cmd_cacheinfo =
|
||||||
|
grub_register_command ("cacheinfo", grub_rescue_cmd_info,
|
||||||
|
0, N_("Get disk cache info."));
|
||||||
|
}
|
||||||
|
|
||||||
|
GRUB_MOD_FINI(cacheinfo)
|
||||||
|
{
|
||||||
|
grub_unregister_command (cmd_cacheinfo);
|
||||||
|
}
|
|
@ -25,6 +25,8 @@
|
||||||
#include <grub/extcmd.h>
|
#include <grub/extcmd.h>
|
||||||
#include <grub/i18n.h>
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
static const struct grub_arg_option options[] =
|
||||||
{
|
{
|
||||||
{"dos", -1, 0, N_("Accept DOS-style CR/NL line endings."), 0, 0},
|
{"dos", -1, 0, N_("Accept DOS-style CR/NL line endings."), 0, 0},
|
||||||
|
@ -76,7 +78,7 @@ grub_cmd_cat (grub_extcmd_context_t ctxt, int argc, char **args)
|
||||||
}
|
}
|
||||||
|
|
||||||
while (grub_checkkey () >= 0 &&
|
while (grub_checkkey () >= 0 &&
|
||||||
(key = GRUB_TERM_ASCII_CHAR (grub_getkey ())) != GRUB_TERM_ESC)
|
(key = grub_getkey ()) != GRUB_TERM_ESC)
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
#include <grub/i18n.h>
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
#define BUFFER_SIZE 512
|
#define BUFFER_SIZE 512
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
|
@ -40,7 +42,7 @@ grub_cmd_cmp (grub_command_t cmd __attribute__ ((unused)),
|
||||||
if (argc != 2)
|
if (argc != 2)
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "two arguments required");
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "two arguments required");
|
||||||
|
|
||||||
grub_printf ("Compare file `%s' with `%s':\n", args[0],
|
grub_printf_ (N_("Compare file `%s' with `%s':\n"), args[0],
|
||||||
args[1]);
|
args[1]);
|
||||||
|
|
||||||
file1 = grub_file_open (args[0]);
|
file1 = grub_file_open (args[0]);
|
||||||
|
@ -49,7 +51,7 @@ grub_cmd_cmp (grub_command_t cmd __attribute__ ((unused)),
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
if (grub_file_size (file1) != grub_file_size (file2))
|
if (grub_file_size (file1) != grub_file_size (file2))
|
||||||
grub_printf ("Files differ in size: %llu [%s], %llu [%s]\n",
|
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 (file1), args[0],
|
||||||
(unsigned long long) grub_file_size (file2), args[1]);
|
(unsigned long long) grub_file_size (file2), args[1]);
|
||||||
else
|
else
|
||||||
|
@ -76,9 +78,9 @@ grub_cmd_cmp (grub_command_t cmd __attribute__ ((unused)),
|
||||||
{
|
{
|
||||||
if (buf1[i] != buf2[i])
|
if (buf1[i] != buf2[i])
|
||||||
{
|
{
|
||||||
grub_printf ("Files differ at the offset %llu: 0x%x [%s], 0x%x [%s]\n",
|
grub_printf_ (N_("Files differ at the offset %llu: 0x%x [%s], 0x%x [%s]\n"),
|
||||||
(unsigned long long) (i + pos), buf1[i], args[0],
|
(unsigned long long) (i + pos), buf1[i],
|
||||||
buf2[i], args[1]);
|
args[0], buf2[i], args[1]);
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -87,14 +89,13 @@ grub_cmd_cmp (grub_command_t cmd __attribute__ ((unused)),
|
||||||
}
|
}
|
||||||
while (rd2);
|
while (rd2);
|
||||||
|
|
||||||
grub_printf ("The files are identical.\n");
|
/* TRANSLATORS: it's always exactly 2 files. */
|
||||||
|
grub_printf_ (N_("The files are identical.\n"));
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
|
|
||||||
if (buf1)
|
|
||||||
grub_free (buf1);
|
grub_free (buf1);
|
||||||
if (buf2)
|
|
||||||
grub_free (buf2);
|
grub_free (buf2);
|
||||||
if (file1)
|
if (file1)
|
||||||
grub_file_close (file1);
|
grub_file_close (file1);
|
||||||
|
|
|
@ -24,31 +24,39 @@
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
#include <grub/i18n.h>
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_source (grub_command_t cmd, int argc, char **args)
|
grub_cmd_source (grub_command_t cmd, int argc, char **args)
|
||||||
{
|
{
|
||||||
int new_env;
|
int new_env, extractor;
|
||||||
|
|
||||||
if (argc != 1)
|
if (argc != 1)
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
|
||||||
|
|
||||||
new_env = (cmd->name[0] == 'c');
|
extractor = (cmd->name[0] == 'e');
|
||||||
|
new_env = (cmd->name[extractor ? sizeof ("extract_entries_") - 1 : 0] == 'c');
|
||||||
|
|
||||||
if (new_env)
|
if (new_env)
|
||||||
{
|
|
||||||
grub_cls ();
|
grub_cls ();
|
||||||
grub_env_context_open (1);
|
|
||||||
}
|
if (new_env && !extractor)
|
||||||
|
grub_env_context_open ();
|
||||||
|
if (extractor)
|
||||||
|
grub_env_extractor_open (!new_env);
|
||||||
|
|
||||||
grub_normal_execute (args[0], 1, ! new_env);
|
grub_normal_execute (args[0], 1, ! new_env);
|
||||||
|
|
||||||
if (new_env)
|
if (new_env && !extractor)
|
||||||
grub_env_context_close ();
|
grub_env_context_close ();
|
||||||
|
if (extractor)
|
||||||
|
grub_env_extractor_close (!new_env);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_command_t cmd_configfile, cmd_source, cmd_dot;
|
static grub_command_t cmd_configfile, cmd_source, cmd_dot;
|
||||||
|
static grub_command_t cmd_extractor_source, cmd_extractor_configfile;
|
||||||
|
|
||||||
GRUB_MOD_INIT(configfile)
|
GRUB_MOD_INIT(configfile)
|
||||||
{
|
{
|
||||||
|
@ -60,6 +68,19 @@ GRUB_MOD_INIT(configfile)
|
||||||
N_("FILE"),
|
N_("FILE"),
|
||||||
N_("Load another config file without changing context.")
|
N_("Load another config file without changing context.")
|
||||||
);
|
);
|
||||||
|
|
||||||
|
cmd_extractor_source =
|
||||||
|
grub_register_command ("extract_entries_source", grub_cmd_source,
|
||||||
|
N_("FILE"),
|
||||||
|
N_("Load another config file without changing context but take only menuentries.")
|
||||||
|
);
|
||||||
|
|
||||||
|
cmd_extractor_configfile =
|
||||||
|
grub_register_command ("extract_entries_configfile", grub_cmd_source,
|
||||||
|
N_("FILE"),
|
||||||
|
N_("Load another config file without changing context but take only menuentries.")
|
||||||
|
);
|
||||||
|
|
||||||
cmd_dot =
|
cmd_dot =
|
||||||
grub_register_command (".", grub_cmd_source,
|
grub_register_command (".", grub_cmd_source,
|
||||||
N_("FILE"),
|
N_("FILE"),
|
||||||
|
@ -71,5 +92,7 @@ GRUB_MOD_FINI(configfile)
|
||||||
{
|
{
|
||||||
grub_unregister_command (cmd_configfile);
|
grub_unregister_command (cmd_configfile);
|
||||||
grub_unregister_command (cmd_source);
|
grub_unregister_command (cmd_source);
|
||||||
|
grub_unregister_command (cmd_extractor_configfile);
|
||||||
|
grub_unregister_command (cmd_extractor_source);
|
||||||
grub_unregister_command (cmd_dot);
|
grub_unregister_command (cmd_dot);
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,72 +0,0 @@
|
||||||
/* crc.c - command to calculate the crc32 checksum of a file */
|
|
||||||
/*
|
|
||||||
* GRUB -- GRand Unified Bootloader
|
|
||||||
* Copyright (C) 2008,2010 Free Software Foundation, Inc.
|
|
||||||
*
|
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU General Public License as published by
|
|
||||||
* the Free Software Foundation, either version 3 of the License, or
|
|
||||||
* (at your option) any later version.
|
|
||||||
*
|
|
||||||
* GRUB is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include <grub/dl.h>
|
|
||||||
#include <grub/disk.h>
|
|
||||||
#include <grub/file.h>
|
|
||||||
#include <grub/misc.h>
|
|
||||||
#include <grub/lib/crc.h>
|
|
||||||
#include <grub/command.h>
|
|
||||||
#include <grub/i18n.h>
|
|
||||||
|
|
||||||
static grub_err_t
|
|
||||||
grub_cmd_crc (grub_command_t cmd __attribute__ ((unused)),
|
|
||||||
int argc, char **args)
|
|
||||||
|
|
||||||
{
|
|
||||||
grub_file_t file;
|
|
||||||
char buf[GRUB_DISK_SECTOR_SIZE];
|
|
||||||
grub_ssize_t size;
|
|
||||||
grub_uint32_t crc;
|
|
||||||
|
|
||||||
if (argc != 1)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "file name required");
|
|
||||||
|
|
||||||
grub_file_filter_disable_compression ();
|
|
||||||
file = grub_file_open (args[0]);
|
|
||||||
if (! file)
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
crc = 0;
|
|
||||||
while ((size = grub_file_read (file, buf, sizeof (buf))) > 0)
|
|
||||||
crc = grub_getcrc32 (crc, buf, size);
|
|
||||||
|
|
||||||
if (grub_errno)
|
|
||||||
goto fail;
|
|
||||||
|
|
||||||
grub_printf ("%08x\n", crc);
|
|
||||||
|
|
||||||
fail:
|
|
||||||
grub_file_close (file);
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
static grub_command_t cmd;
|
|
||||||
|
|
||||||
GRUB_MOD_INIT(crc)
|
|
||||||
{
|
|
||||||
cmd = grub_register_command ("crc", grub_cmd_crc,
|
|
||||||
N_("FILE"),
|
|
||||||
N_("Calculate the crc32 checksum of a file."));
|
|
||||||
}
|
|
||||||
|
|
||||||
GRUB_MOD_FINI(crc)
|
|
||||||
{
|
|
||||||
grub_unregister_command (cmd);
|
|
||||||
}
|
|
|
@ -24,6 +24,8 @@
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
#include <grub/i18n.h>
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
#define GRUB_DATETIME_SET_YEAR 1
|
#define GRUB_DATETIME_SET_YEAR 1
|
||||||
#define GRUB_DATETIME_SET_MONTH 2
|
#define GRUB_DATETIME_SET_MONTH 2
|
||||||
#define GRUB_DATETIME_SET_DAY 4
|
#define GRUB_DATETIME_SET_DAY 4
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
/* echo.c - Command to display a line of text */
|
/* echo.c - Command to display a line of text */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2006,2007 Free Software Foundation, Inc.
|
* Copyright (C) 2006,2007,2010 Free Software Foundation, Inc.
|
||||||
*
|
*
|
||||||
* GRUB is free software: you can redistribute it and/or modify
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -21,6 +21,9 @@
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/extcmd.h>
|
#include <grub/extcmd.h>
|
||||||
#include <grub/i18n.h>
|
#include <grub/i18n.h>
|
||||||
|
#include <grub/term.h>
|
||||||
|
|
||||||
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
static const struct grub_arg_option options[] =
|
static const struct grub_arg_option options[] =
|
||||||
{
|
{
|
||||||
|
@ -43,8 +46,14 @@ grub_cmd_echo (grub_extcmd_context_t ctxt, int argc, char **args)
|
||||||
for (i = 0; i < argc; i++)
|
for (i = 0; i < argc; i++)
|
||||||
{
|
{
|
||||||
char *arg = *args;
|
char *arg = *args;
|
||||||
|
/* Unescaping results in a string no longer than the original. */
|
||||||
|
char *unescaped = grub_malloc (grub_strlen (arg) + 1);
|
||||||
|
char *p = unescaped;
|
||||||
args++;
|
args++;
|
||||||
|
|
||||||
|
if (!unescaped)
|
||||||
|
return grub_errno;
|
||||||
|
|
||||||
while (*arg)
|
while (*arg)
|
||||||
{
|
{
|
||||||
/* In case `-e' is used, parse backslashes. */
|
/* In case `-e' is used, parse backslashes. */
|
||||||
|
@ -57,11 +66,11 @@ grub_cmd_echo (grub_extcmd_context_t ctxt, int argc, char **args)
|
||||||
switch (*arg)
|
switch (*arg)
|
||||||
{
|
{
|
||||||
case '\\':
|
case '\\':
|
||||||
grub_printf ("\\");
|
*p++ = '\\';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'a':
|
case 'a':
|
||||||
grub_printf ("\a");
|
*p++ = '\a';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'c':
|
case 'c':
|
||||||
|
@ -69,23 +78,23 @@ grub_cmd_echo (grub_extcmd_context_t ctxt, int argc, char **args)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'f':
|
case 'f':
|
||||||
grub_printf ("\f");
|
*p++ = '\f';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'n':
|
case 'n':
|
||||||
grub_printf ("\n");
|
*p++ = '\n';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'r':
|
case 'r':
|
||||||
grub_printf ("\r");
|
*p++ = '\r';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 't':
|
case 't':
|
||||||
grub_printf ("\t");
|
*p++ = '\t';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'v':
|
case 'v':
|
||||||
grub_printf ("\v");
|
*p++ = '\v';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
arg++;
|
arg++;
|
||||||
|
@ -94,10 +103,14 @@ grub_cmd_echo (grub_extcmd_context_t ctxt, int argc, char **args)
|
||||||
|
|
||||||
/* This was not an escaped character, or escaping is not
|
/* This was not an escaped character, or escaping is not
|
||||||
enabled. */
|
enabled. */
|
||||||
grub_printf ("%c", *arg);
|
*p++ = *arg;
|
||||||
arg++;
|
arg++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*p = '\0';
|
||||||
|
grub_xputs (unescaped);
|
||||||
|
grub_free (unescaped);
|
||||||
|
|
||||||
/* If another argument follows, insert a space. */
|
/* If another argument follows, insert a space. */
|
||||||
if (i != argc - 1)
|
if (i != argc - 1)
|
||||||
grub_printf (" " );
|
grub_printf (" " );
|
||||||
|
@ -106,6 +119,8 @@ grub_cmd_echo (grub_extcmd_context_t ctxt, int argc, char **args)
|
||||||
if (newline)
|
if (newline)
|
||||||
grub_printf ("\n");
|
grub_printf ("\n");
|
||||||
|
|
||||||
|
grub_refresh ();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -24,6 +24,8 @@
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
#include <grub/i18n.h>
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
static struct grub_video_patch
|
static struct grub_video_patch
|
||||||
{
|
{
|
||||||
const char *name;
|
const char *name;
|
||||||
|
@ -54,24 +56,24 @@ scan_card (grub_pci_device_t dev, grub_pci_id_t pciid)
|
||||||
{
|
{
|
||||||
grub_target_addr_t base;
|
grub_target_addr_t base;
|
||||||
|
|
||||||
grub_printf ("Found graphic card: %s\n", p->name);
|
grub_dprintf ("fixvideo", "Found graphic card: %s\n", p->name);
|
||||||
addr += 8 + p->mmio_bar * 4;
|
addr += 8 + p->mmio_bar * 4;
|
||||||
base = grub_pci_read (addr);
|
base = grub_pci_read (addr);
|
||||||
if ((! base) || (base & GRUB_PCI_ADDR_SPACE_IO) ||
|
if ((! base) || (base & GRUB_PCI_ADDR_SPACE_IO) ||
|
||||||
(base & GRUB_PCI_ADDR_MEM_PREFETCH))
|
(base & GRUB_PCI_ADDR_MEM_PREFETCH))
|
||||||
grub_printf ("Invalid MMIO bar %d\n", p->mmio_bar);
|
grub_dprintf ("fixvideo", "Invalid MMIO bar %d\n", p->mmio_bar);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
base &= GRUB_PCI_ADDR_MEM_MASK;
|
base &= GRUB_PCI_ADDR_MEM_MASK;
|
||||||
base += p->mmio_reg;
|
base += p->mmio_reg;
|
||||||
|
|
||||||
if (*((volatile grub_uint32_t *) base) != p->mmio_old)
|
if (*((volatile grub_uint32_t *) base) != p->mmio_old)
|
||||||
grub_printf ("Old value don't match\n");
|
grub_dprintf ("fixvideo", "Old value doesn't match\n");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
*((volatile grub_uint32_t *) base) = 0;
|
*((volatile grub_uint32_t *) base) = 0;
|
||||||
if (*((volatile grub_uint32_t *) base))
|
if (*((volatile grub_uint32_t *) base))
|
||||||
grub_printf ("Set MMIO fails\n");
|
grub_dprintf ("fixvideo", "Setting MMIO fails\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -80,7 +82,7 @@ scan_card (grub_pci_device_t dev, grub_pci_id_t pciid)
|
||||||
p++;
|
p++;
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_printf ("Unknown graphic card: %x\n", pciid);
|
grub_dprintf ("fixvideo", "Unknown graphic card: %x\n", pciid);
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -25,6 +25,8 @@
|
||||||
#include <grub/command.h>
|
#include <grub/command.h>
|
||||||
#include <grub/i18n.h>
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
static grub_efi_guid_t acpi_guid = GRUB_EFI_ACPI_TABLE_GUID;
|
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 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 smbios_guid = GRUB_EFI_SMBIOS_TABLE_GUID;
|
||||||
|
@ -47,7 +49,7 @@ enable_rom_area (void)
|
||||||
rom_ptr = (grub_uint32_t *) VBIOS_ADDR;
|
rom_ptr = (grub_uint32_t *) VBIOS_ADDR;
|
||||||
if (*rom_ptr != BLANK_MEM)
|
if (*rom_ptr != BLANK_MEM)
|
||||||
{
|
{
|
||||||
grub_printf ("ROM image is present.\n");
|
grub_puts_ (N_("ROM image is present."));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -65,7 +67,7 @@ enable_rom_area (void)
|
||||||
*rom_ptr = 0;
|
*rom_ptr = 0;
|
||||||
if (*rom_ptr != 0)
|
if (*rom_ptr != 0)
|
||||||
{
|
{
|
||||||
grub_printf ("Can\'t enable ROM area.\n");
|
grub_puts_ (N_("Can\'t enable ROM area."));
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -207,7 +209,7 @@ GRUB_MOD_INIT(loadbios)
|
||||||
0, N_("Fake BIOS."));
|
0, N_("Fake BIOS."));
|
||||||
|
|
||||||
cmd_loadbios = grub_register_command ("loadbios", grub_cmd_loadbios,
|
cmd_loadbios = grub_register_command ("loadbios", grub_cmd_loadbios,
|
||||||
"BIOS_DUMP [INT10_DUMP]",
|
N_("BIOS_DUMP [INT10_DUMP]"),
|
||||||
N_("Load BIOS dump."));
|
N_("Load BIOS dump."));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
145
grub-core/commands/efi/lsefimmap.c
Normal file
145
grub-core/commands/efi/lsefimmap.c
Normal file
|
@ -0,0 +1,145 @@
|
||||||
|
/* lsefimemmap.c - Display memory map. */
|
||||||
|
/*
|
||||||
|
* GRUB -- GRand Unified Bootloader
|
||||||
|
* Copyright (C) 2008 Free Software Foundation, Inc.
|
||||||
|
*
|
||||||
|
* GRUB is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* GRUB is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
#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>
|
||||||
|
|
||||||
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
|
#define ADD_MEMORY_DESCRIPTOR(desc, size) \
|
||||||
|
((grub_efi_memory_descriptor_t *) ((char *) (desc) + (size)))
|
||||||
|
|
||||||
|
static grub_err_t
|
||||||
|
grub_cmd_lsefimmap (grub_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;
|
||||||
|
|
||||||
|
map_size = 0;
|
||||||
|
if (grub_efi_get_memory_map (&map_size, NULL, NULL, &desc_size, 0) < 0)
|
||||||
|
return 0;
|
||||||
|
|
||||||
|
memory_map = grub_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)
|
||||||
|
goto fail;
|
||||||
|
|
||||||
|
grub_printf
|
||||||
|
("Type Physical start - end #Pages "
|
||||||
|
" Size Attributes\n");
|
||||||
|
memory_map_end = ADD_MEMORY_DESCRIPTOR (memory_map, map_size);
|
||||||
|
for (desc = memory_map;
|
||||||
|
desc < memory_map_end;
|
||||||
|
desc = ADD_MEMORY_DESCRIPTOR (desc, desc_size))
|
||||||
|
{
|
||||||
|
grub_efi_uint64_t size;
|
||||||
|
grub_efi_uint64_t attr;
|
||||||
|
static const char types_str[][9] =
|
||||||
|
{
|
||||||
|
"reserved",
|
||||||
|
"ldr-code",
|
||||||
|
"ldr-data",
|
||||||
|
"BS-code ",
|
||||||
|
"BS-data ",
|
||||||
|
"RT-code ",
|
||||||
|
"RT-data ",
|
||||||
|
"conv-mem",
|
||||||
|
"unusable",
|
||||||
|
"ACPI-rec",
|
||||||
|
"ACPI-nvs",
|
||||||
|
"MMIO ",
|
||||||
|
"IO-ports",
|
||||||
|
"PAL-code"
|
||||||
|
};
|
||||||
|
if (desc->type < ARRAY_SIZE (types_str))
|
||||||
|
grub_printf ("%s ", types_str[desc->type]);
|
||||||
|
else
|
||||||
|
grub_printf ("Unk %02x ", desc->type);
|
||||||
|
|
||||||
|
grub_printf (" %016" PRIxGRUB_UINT64_T "-%016" PRIxGRUB_UINT64_T
|
||||||
|
" %08" PRIxGRUB_UINT64_T,
|
||||||
|
desc->physical_start,
|
||||||
|
desc->physical_start + (desc->num_pages << 12) - 1,
|
||||||
|
desc->num_pages);
|
||||||
|
|
||||||
|
size = desc->num_pages;
|
||||||
|
size <<= (12 - 10);
|
||||||
|
if (size < 1024)
|
||||||
|
grub_printf (" %4" PRIuGRUB_UINT64_T "KB", size);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
size /= 1024;
|
||||||
|
if (size < 1024)
|
||||||
|
grub_printf (" %4" PRIuGRUB_UINT64_T "MB", size);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
size /= 1024;
|
||||||
|
grub_printf (" %4" PRIuGRUB_UINT64_T "GB", size);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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");
|
||||||
|
|
||||||
|
grub_printf ("\n");
|
||||||
|
}
|
||||||
|
|
||||||
|
fail:
|
||||||
|
grub_free (memory_map);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
static grub_command_t cmd;
|
||||||
|
|
||||||
|
GRUB_MOD_INIT(lsefimmap)
|
||||||
|
{
|
||||||
|
cmd = grub_register_command ("lsefimmap", grub_cmd_lsefimmap,
|
||||||
|
"", "Display EFI memory map.");
|
||||||
|
}
|
||||||
|
|
||||||
|
GRUB_MOD_FINI(lsefimmap)
|
||||||
|
{
|
||||||
|
grub_unregister_command (cmd);
|
||||||
|
}
|
|
@ -1,4 +1,4 @@
|
||||||
/* systab.c - Display EFI systab. */
|
/* lsefisystab.c - Display EFI systab. */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
* Copyright (C) 2008 Free Software Foundation, Inc.
|
||||||
|
@ -18,12 +18,15 @@
|
||||||
*/
|
*/
|
||||||
#include <grub/types.h>
|
#include <grub/types.h>
|
||||||
#include <grub/mm.h>
|
#include <grub/mm.h>
|
||||||
|
#include <grub/dl.h>
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/normal.h>
|
#include <grub/normal.h>
|
||||||
#include <grub/charset.h>
|
#include <grub/charset.h>
|
||||||
#include <grub/efi/api.h>
|
#include <grub/efi/api.h>
|
||||||
#include <grub/efi/efi.h>
|
#include <grub/efi/efi.h>
|
||||||
|
|
||||||
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
struct guid_mapping
|
struct guid_mapping
|
||||||
{
|
{
|
||||||
grub_efi_guid_t guid;
|
grub_efi_guid_t guid;
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
/* systab.c - Display EFI systab. */
|
/* lssal.c - Display EFI SAL systab. */
|
||||||
/*
|
/*
|
||||||
* GRUB -- GRand Unified Bootloader
|
* GRUB -- GRand Unified Bootloader
|
||||||
* Copyright (C) 2008 Free Software Foundation, Inc.
|
* Copyright (C) 2008 Free Software Foundation, Inc.
|
||||||
|
@ -23,6 +23,9 @@
|
||||||
#include <grub/charset.h>
|
#include <grub/charset.h>
|
||||||
#include <grub/efi/api.h>
|
#include <grub/efi/api.h>
|
||||||
#include <grub/efi/efi.h>
|
#include <grub/efi/efi.h>
|
||||||
|
#include <grub/dl.h>
|
||||||
|
|
||||||
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
static void
|
static void
|
||||||
disp_sal (void *table)
|
disp_sal (void *table)
|
||||||
|
|
|
@ -22,6 +22,9 @@
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/extcmd.h>
|
#include <grub/extcmd.h>
|
||||||
#include <grub/script_sh.h>
|
#include <grub/script_sh.h>
|
||||||
|
#include <grub/dl.h>
|
||||||
|
|
||||||
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
grub_err_t
|
grub_err_t
|
||||||
grub_extcmd_dispatcher (struct grub_command *cmd, int argc, char **args,
|
grub_extcmd_dispatcher (struct grub_command *cmd, int argc, char **args,
|
||||||
|
|
|
@ -29,6 +29,8 @@
|
||||||
#include <grub/fs.h>
|
#include <grub/fs.h>
|
||||||
#include <grub/i18n.h>
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
/* Convert a LBA address to a CHS address in the INT 13 format. */
|
/* Convert a LBA address to a CHS address in the INT 13 format. */
|
||||||
/* Taken from grub1. */
|
/* Taken from grub1. */
|
||||||
/* XXX: use hardcoded geometry of C = 1024, H = 255, S = 63.
|
/* XXX: use hardcoded geometry of C = 1024, H = 255, S = 63.
|
||||||
|
@ -229,7 +231,7 @@ grub_cmd_gptsync (grub_command_t cmd __attribute__ ((unused)),
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_printf ("New MBR is written to '%s'\n", args[0]);
|
grub_printf_ (N_("New MBR is written to '%s'\n"), args[0]);
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
#include <grub/i18n.h>
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_halt (grub_command_t cmd __attribute__ ((unused)),
|
grub_cmd_halt (grub_command_t cmd __attribute__ ((unused)),
|
||||||
int argc __attribute__ ((unused)),
|
int argc __attribute__ ((unused)),
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
#include <grub/normal.h>
|
#include <grub/normal.h>
|
||||||
#include <grub/i18n.h>
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
static const struct grub_arg_option options[] = {
|
static const struct grub_arg_option options[] = {
|
||||||
{"hash", 'h', 0, N_("Specify hash to use."), N_("HASH"), ARG_TYPE_STRING},
|
{"hash", 'h', 0, N_("Specify hash to use."), N_("HASH"), ARG_TYPE_STRING},
|
||||||
{"check", 'c', 0, N_("Check hash list file."), N_("FILE"), ARG_TYPE_STRING},
|
{"check", 'c', 0, N_("Check hash list file."), N_("FILE"), ARG_TYPE_STRING},
|
||||||
|
@ -36,11 +38,13 @@ static const struct grub_arg_option options[] = {
|
||||||
{0, 0, 0, 0, 0, 0}
|
{0, 0, 0, 0, 0, 0}
|
||||||
};
|
};
|
||||||
|
|
||||||
struct { const char *name; const char *hashname; } aliases[] =
|
static struct { const char *name; const char *hashname; } aliases[] =
|
||||||
{
|
{
|
||||||
{"sha256sum", "sha256"},
|
{"sha256sum", "sha256"},
|
||||||
{"sha512sum", "sha512"},
|
{"sha512sum", "sha512"},
|
||||||
|
{"sha1sum", "sha1"},
|
||||||
{"md5sum", "md5"},
|
{"md5sum", "md5"},
|
||||||
|
{"crc", "crc32"},
|
||||||
};
|
};
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
|
@ -137,7 +141,7 @@ check_list (const gcry_md_spec_t *hash, const char *hashfilename,
|
||||||
grub_file_close (file);
|
grub_file_close (file);
|
||||||
if (err)
|
if (err)
|
||||||
{
|
{
|
||||||
grub_printf ("%s: READ ERROR\n", p);
|
grub_printf_ (N_("%s: READ ERROR\n"), p);
|
||||||
if (!keep)
|
if (!keep)
|
||||||
{
|
{
|
||||||
grub_file_close (hashlist);
|
grub_file_close (hashlist);
|
||||||
|
@ -151,7 +155,7 @@ check_list (const gcry_md_spec_t *hash, const char *hashfilename,
|
||||||
}
|
}
|
||||||
if (grub_crypto_memcmp (expected, actual, hash->mdlen) != 0)
|
if (grub_crypto_memcmp (expected, actual, hash->mdlen) != 0)
|
||||||
{
|
{
|
||||||
grub_printf ("%s: HASH MISMATCH\n", p);
|
grub_printf_ (N_("%s: HASH MISMATCH\n"), p);
|
||||||
if (!keep)
|
if (!keep)
|
||||||
{
|
{
|
||||||
grub_file_close (hashlist);
|
grub_file_close (hashlist);
|
||||||
|
@ -162,7 +166,7 @@ check_list (const gcry_md_spec_t *hash, const char *hashfilename,
|
||||||
mismatch++;
|
mismatch++;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
grub_printf ("%s: OK\n", p);
|
grub_printf_ (N_("%s: OK\n"), p);
|
||||||
}
|
}
|
||||||
if (mismatch || unread)
|
if (mismatch || unread)
|
||||||
return grub_error (GRUB_ERR_TEST_FAILURE,
|
return grub_error (GRUB_ERR_TEST_FAILURE,
|
||||||
|
@ -248,36 +252,49 @@ grub_cmd_hashsum (struct grub_extcmd_context *ctxt,
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static grub_extcmd_t cmd, cmd_md5, cmd_sha256, cmd_sha512;
|
static grub_extcmd_t cmd, cmd_md5, cmd_sha1, cmd_sha256, cmd_sha512, cmd_crc;
|
||||||
|
|
||||||
GRUB_MOD_INIT(hashsum)
|
GRUB_MOD_INIT(hashsum)
|
||||||
{
|
{
|
||||||
cmd = grub_register_extcmd ("hashsum", grub_cmd_hashsum, 0,
|
cmd = grub_register_extcmd ("hashsum", grub_cmd_hashsum, 0,
|
||||||
"hashsum -h HASH [-c FILE [-p PREFIX]] "
|
N_("-h HASH [-c FILE [-p PREFIX]] "
|
||||||
"[FILE1 [FILE2 ...]]",
|
"[FILE1 [FILE2 ...]]"),
|
||||||
"Compute or check hash checksum.",
|
N_("Compute or check hash checksum."),
|
||||||
options);
|
options);
|
||||||
cmd_md5 = grub_register_extcmd ("md5sum", grub_cmd_hashsum, 0,
|
cmd_md5 = grub_register_extcmd ("md5sum", grub_cmd_hashsum, 0,
|
||||||
N_("[-c FILE [-p PREFIX]] "
|
N_("[-c FILE [-p PREFIX]] "
|
||||||
"[FILE1 [FILE2 ...]]"),
|
"[FILE1 [FILE2 ...]]"),
|
||||||
N_("Compute or check hash checksum."),
|
N_("Compute or check hash checksum."),
|
||||||
options);
|
options);
|
||||||
|
cmd_sha1 = grub_register_extcmd ("sha1sum", grub_cmd_hashsum, 0,
|
||||||
|
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 = grub_register_extcmd ("sha256sum", grub_cmd_hashsum, 0,
|
||||||
N_("[-c FILE [-p PREFIX]] "
|
N_("[-c FILE [-p PREFIX]] "
|
||||||
"[FILE1 [FILE2 ...]]"),
|
"[FILE1 [FILE2 ...]]"),
|
||||||
"Compute or check hash checksum.",
|
N_("Compute or check hash checksum."),
|
||||||
options);
|
options);
|
||||||
cmd_sha512 = grub_register_extcmd ("sha512sum", grub_cmd_hashsum, 0,
|
cmd_sha512 = grub_register_extcmd ("sha512sum", grub_cmd_hashsum, 0,
|
||||||
N_("[-c FILE [-p PREFIX]] "
|
N_("[-c FILE [-p PREFIX]] "
|
||||||
"[FILE1 [FILE2 ...]]"),
|
"[FILE1 [FILE2 ...]]"),
|
||||||
N_("Compute or check hash checksum."),
|
N_("Compute or check hash checksum."),
|
||||||
options);
|
options);
|
||||||
|
|
||||||
|
cmd_crc = grub_register_extcmd ("crc", grub_cmd_hashsum, 0,
|
||||||
|
N_("[-c FILE [-p PREFIX]] "
|
||||||
|
"[FILE1 [FILE2 ...]]"),
|
||||||
|
N_("Compute or check hash checksum."),
|
||||||
|
options);
|
||||||
}
|
}
|
||||||
|
|
||||||
GRUB_MOD_FINI(hashsum)
|
GRUB_MOD_FINI(hashsum)
|
||||||
{
|
{
|
||||||
grub_unregister_extcmd (cmd);
|
grub_unregister_extcmd (cmd);
|
||||||
grub_unregister_extcmd (cmd_md5);
|
grub_unregister_extcmd (cmd_md5);
|
||||||
|
grub_unregister_extcmd (cmd_sha1);
|
||||||
grub_unregister_extcmd (cmd_sha256);
|
grub_unregister_extcmd (cmd_sha256);
|
||||||
grub_unregister_extcmd (cmd_sha512);
|
grub_unregister_extcmd (cmd_sha512);
|
||||||
|
grub_unregister_extcmd (cmd_crc);
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <grub/ata.h>
|
#include <grub/ata.h>
|
||||||
|
#include <grub/scsi.h>
|
||||||
#include <grub/disk.h>
|
#include <grub/disk.h>
|
||||||
#include <grub/dl.h>
|
#include <grub/dl.h>
|
||||||
#include <grub/misc.h>
|
#include <grub/misc.h>
|
||||||
|
@ -26,6 +27,8 @@
|
||||||
#include <grub/extcmd.h>
|
#include <grub/extcmd.h>
|
||||||
#include <grub/i18n.h>
|
#include <grub/i18n.h>
|
||||||
|
|
||||||
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
static const struct grub_arg_option options[] = {
|
static const struct grub_arg_option options[] = {
|
||||||
{"apm", 'B', 0, N_("Set Advanced Power Management\n"
|
{"apm", 'B', 0, N_("Set Advanced Power Management\n"
|
||||||
"(1=low, ..., 254=high, 255=off)."),
|
"(1=low, ..., 254=high, 255=off)."),
|
||||||
|
@ -61,60 +64,64 @@ enum grub_ata_smart_commands
|
||||||
static int quiet = 0;
|
static int quiet = 0;
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_hdparm_do_ata_cmd (grub_disk_t disk, grub_uint8_t cmd,
|
grub_hdparm_do_ata_cmd (grub_ata_t ata, grub_uint8_t cmd,
|
||||||
grub_uint8_t features, grub_uint8_t sectors,
|
grub_uint8_t features, grub_uint8_t sectors,
|
||||||
void * buffer, int size)
|
void * buffer, int size)
|
||||||
{
|
{
|
||||||
struct grub_disk_ata_pass_through_parms apt;
|
struct grub_disk_ata_pass_through_parms apt;
|
||||||
grub_memset (&apt, 0, sizeof (apt));
|
grub_memset (&apt, 0, sizeof (apt));
|
||||||
|
|
||||||
apt.taskfile[GRUB_ATA_REG_CMD] = cmd;
|
apt.taskfile.cmd = cmd;
|
||||||
apt.taskfile[GRUB_ATA_REG_FEATURES] = features;
|
apt.taskfile.features = features;
|
||||||
apt.taskfile[GRUB_ATA_REG_SECTORS] = sectors;
|
apt.taskfile.sectors = sectors;
|
||||||
|
apt.taskfile.disk = 0xE0;
|
||||||
|
|
||||||
apt.buffer = buffer;
|
apt.buffer = buffer;
|
||||||
apt.size = size;
|
apt.size = size;
|
||||||
|
|
||||||
if (grub_disk_ata_pass_through (disk, &apt))
|
if (ata->dev->readwrite (ata, &apt, 0))
|
||||||
return grub_errno;
|
return grub_errno;
|
||||||
|
|
||||||
return GRUB_ERR_NONE;
|
return GRUB_ERR_NONE;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
grub_hdparm_do_check_powermode_cmd (grub_disk_t disk)
|
grub_hdparm_do_check_powermode_cmd (grub_ata_t ata)
|
||||||
{
|
{
|
||||||
struct grub_disk_ata_pass_through_parms apt;
|
struct grub_disk_ata_pass_through_parms apt;
|
||||||
grub_memset (&apt, 0, sizeof (apt));
|
grub_memset (&apt, 0, sizeof (apt));
|
||||||
|
|
||||||
apt.taskfile[GRUB_ATA_REG_CMD] = GRUB_ATA_CMD_CHECK_POWER_MODE;
|
apt.taskfile.cmd = GRUB_ATA_CMD_CHECK_POWER_MODE;
|
||||||
|
apt.taskfile.disk = 0xE0;
|
||||||
|
|
||||||
if (grub_disk_ata_pass_through (disk, &apt))
|
if (ata->dev->readwrite (ata, &apt, 0))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
return apt.taskfile[GRUB_ATA_REG_SECTORS];
|
return apt.taskfile.sectors;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
grub_hdparm_do_smart_cmd (grub_disk_t disk, grub_uint8_t features)
|
grub_hdparm_do_smart_cmd (grub_ata_t ata, grub_uint8_t features)
|
||||||
{
|
{
|
||||||
struct grub_disk_ata_pass_through_parms apt;
|
struct grub_disk_ata_pass_through_parms apt;
|
||||||
grub_memset (&apt, 0, sizeof (apt));
|
grub_memset (&apt, 0, sizeof (apt));
|
||||||
|
|
||||||
apt.taskfile[GRUB_ATA_REG_CMD] = GRUB_ATA_CMD_SMART;
|
apt.taskfile.cmd = GRUB_ATA_CMD_SMART;
|
||||||
apt.taskfile[GRUB_ATA_REG_FEATURES] = features;
|
apt.taskfile.features = features;
|
||||||
apt.taskfile[GRUB_ATA_REG_LBAMID] = 0x4f;
|
apt.taskfile.lba_mid = 0x4f;
|
||||||
apt.taskfile[GRUB_ATA_REG_LBAHIGH] = 0xc2;
|
apt.taskfile.lba_high = 0xc2;
|
||||||
|
apt.taskfile.disk = 0xE0;
|
||||||
|
|
||||||
if (grub_disk_ata_pass_through (disk, &apt))
|
if (ata->dev->readwrite (ata, &apt, 0))
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
if (features == GRUB_ATA_FEAT_SMART_STATUS)
|
if (features == GRUB_ATA_FEAT_SMART_STATUS)
|
||||||
{
|
{
|
||||||
if ( apt.taskfile[GRUB_ATA_REG_LBAMID] == 0x4f
|
if ( apt.taskfile.lba_mid == 0x4f
|
||||||
&& apt.taskfile[GRUB_ATA_REG_LBAHIGH] == 0xc2)
|
&& apt.taskfile.lba_high == 0xc2)
|
||||||
return 0; /* Good SMART status. */
|
return 0; /* Good SMART status. */
|
||||||
else if ( apt.taskfile[GRUB_ATA_REG_LBAMID] == 0xf4
|
else if ( apt.taskfile.lba_mid == 0xf4
|
||||||
&& apt.taskfile[GRUB_ATA_REG_LBAHIGH] == 0x2c)
|
&& apt.taskfile.lba_high == 0x2c)
|
||||||
return 1; /* Bad SMART status. */
|
return 1; /* Bad SMART status. */
|
||||||
else
|
else
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -124,12 +131,12 @@ grub_hdparm_do_smart_cmd (grub_disk_t disk, grub_uint8_t features)
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_hdparm_simple_cmd (const char * msg,
|
grub_hdparm_simple_cmd (const char * msg,
|
||||||
grub_disk_t disk, grub_uint8_t cmd)
|
grub_ata_t ata, grub_uint8_t cmd)
|
||||||
{
|
{
|
||||||
if (! quiet && msg)
|
if (! quiet && msg)
|
||||||
grub_printf ("%s", msg);
|
grub_printf ("%s", msg);
|
||||||
|
|
||||||
grub_err_t err = grub_hdparm_do_ata_cmd (disk, cmd, 0, 0, NULL, 0);
|
grub_err_t err = grub_hdparm_do_ata_cmd (ata, cmd, 0, 0, NULL, 0);
|
||||||
|
|
||||||
if (! quiet && msg)
|
if (! quiet && msg)
|
||||||
grub_printf ("%s\n", ! err ? "" : ": not supported");
|
grub_printf ("%s\n", ! err ? "" : ": not supported");
|
||||||
|
@ -138,7 +145,7 @@ grub_hdparm_simple_cmd (const char * msg,
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_hdparm_set_val_cmd (const char * msg, int val,
|
grub_hdparm_set_val_cmd (const char * msg, int val,
|
||||||
grub_disk_t disk, grub_uint8_t cmd,
|
grub_ata_t ata, grub_uint8_t cmd,
|
||||||
grub_uint8_t features, grub_uint8_t sectors)
|
grub_uint8_t features, grub_uint8_t sectors)
|
||||||
{
|
{
|
||||||
if (! quiet && msg && *msg)
|
if (! quiet && msg && *msg)
|
||||||
|
@ -149,7 +156,7 @@ grub_hdparm_set_val_cmd (const char * msg, int val,
|
||||||
grub_printf ("Disable %s", msg);
|
grub_printf ("Disable %s", msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
grub_err_t err = grub_hdparm_do_ata_cmd (disk, cmd, features, sectors,
|
grub_err_t err = grub_hdparm_do_ata_cmd (ata, cmd, features, sectors,
|
||||||
NULL, 0);
|
NULL, 0);
|
||||||
|
|
||||||
if (! quiet && msg)
|
if (! quiet && msg)
|
||||||
|
@ -273,6 +280,7 @@ static grub_err_t
|
||||||
grub_cmd_hdparm (grub_extcmd_context_t ctxt, int argc, char **args) // state????
|
grub_cmd_hdparm (grub_extcmd_context_t ctxt, int argc, char **args) // state????
|
||||||
{
|
{
|
||||||
struct grub_arg_list *state = ctxt->state;
|
struct grub_arg_list *state = ctxt->state;
|
||||||
|
struct grub_ata *ata;
|
||||||
|
|
||||||
/* Check command line. */
|
/* Check command line. */
|
||||||
if (argc != 1)
|
if (argc != 1)
|
||||||
|
@ -283,9 +291,6 @@ grub_cmd_hdparm (grub_extcmd_context_t ctxt, int argc, char **args) // state????
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "argument is not a device name");
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "argument is not a device name");
|
||||||
args[0][len - 1] = 0;
|
args[0][len - 1] = 0;
|
||||||
|
|
||||||
if (! grub_disk_ata_pass_through)
|
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "ATA pass through not available");
|
|
||||||
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int apm = get_int_arg (&state[i++]);
|
int apm = get_int_arg (&state[i++]);
|
||||||
int power = state[i++].set;
|
int power = state[i++].set;
|
||||||
|
@ -311,15 +316,37 @@ grub_cmd_hdparm (grub_extcmd_context_t ctxt, int argc, char **args) // state????
|
||||||
return grub_error (GRUB_ERR_BAD_ARGUMENT, "partition not allowed");
|
return grub_error (GRUB_ERR_BAD_ARGUMENT, "partition not allowed");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
switch (disk->dev->id)
|
||||||
|
{
|
||||||
|
case GRUB_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))
|
||||||
|
{
|
||||||
|
ata = ((struct grub_scsi *) disk->data)->data;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
return grub_error (GRUB_ERR_IO, "not an ATA device");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/* Change settings. */
|
/* Change settings. */
|
||||||
if (aam >= 0)
|
if (aam >= 0)
|
||||||
grub_hdparm_set_val_cmd ("Automatic Acoustic Management", (aam ? aam : -1),
|
grub_hdparm_set_val_cmd ("Automatic Acoustic Management", (aam ? aam : -1),
|
||||||
disk, GRUB_ATA_CMD_SET_FEATURES, (aam ? 0x42 : 0xc2), aam);
|
ata, GRUB_ATA_CMD_SET_FEATURES,
|
||||||
|
(aam ? 0x42 : 0xc2), aam);
|
||||||
|
|
||||||
if (apm >= 0)
|
if (apm >= 0)
|
||||||
grub_hdparm_set_val_cmd ("Advanced Power Management",
|
grub_hdparm_set_val_cmd ("Advanced Power Management",
|
||||||
(apm != 255 ? apm : -1), disk, GRUB_ATA_CMD_SET_FEATURES,
|
(apm != 255 ? apm : -1), ata,
|
||||||
(apm != 255 ? 0x05 : 0x85), (apm != 255 ? apm : 0));
|
GRUB_ATA_CMD_SET_FEATURES,
|
||||||
|
(apm != 255 ? 0x05 : 0x85),
|
||||||
|
(apm != 255 ? apm : 0));
|
||||||
|
|
||||||
if (standby_tout >= 0)
|
if (standby_tout >= 0)
|
||||||
{
|
{
|
||||||
|
@ -330,28 +357,28 @@ grub_cmd_hdparm (grub_extcmd_context_t ctxt, int argc, char **args) // state????
|
||||||
grub_printf (")");
|
grub_printf (")");
|
||||||
}
|
}
|
||||||
/* The IDLE cmd sets disk to idle mode and configures standby timer. */
|
/* The IDLE cmd sets disk to idle mode and configures standby timer. */
|
||||||
grub_hdparm_set_val_cmd ("", -1, disk, GRUB_ATA_CMD_IDLE, 0, standby_tout);
|
grub_hdparm_set_val_cmd ("", -1, ata, GRUB_ATA_CMD_IDLE, 0, standby_tout);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (enable_smart >= 0)
|
if (enable_smart >= 0)
|
||||||
{
|
{
|
||||||
if (! quiet)
|
if (! quiet)
|
||||||
grub_printf ("%sable SMART operations", (enable_smart ? "En" : "Dis"));
|
grub_printf ("%sable SMART operations", (enable_smart ? "En" : "Dis"));
|
||||||
int err = grub_hdparm_do_smart_cmd (disk, (enable_smart ?
|
int err = grub_hdparm_do_smart_cmd (ata, (enable_smart ?
|
||||||
GRUB_ATA_FEAT_SMART_ENABLE : GRUB_ATA_FEAT_SMART_DISABLE));
|
GRUB_ATA_FEAT_SMART_ENABLE : GRUB_ATA_FEAT_SMART_DISABLE));
|
||||||
if (! quiet)
|
if (! quiet)
|
||||||
grub_printf ("%s\n", err ? ": not supported" : "");
|
grub_printf ("%s\n", err ? ": not supported" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (sec_freeze)
|
if (sec_freeze)
|
||||||
grub_hdparm_simple_cmd ("Freeze security settings", disk,
|
grub_hdparm_simple_cmd ("Freeze security settings", ata,
|
||||||
GRUB_ATA_CMD_SECURITY_FREEZE_LOCK);
|
GRUB_ATA_CMD_SECURITY_FREEZE_LOCK);
|
||||||
|
|
||||||
/* Print/dump IDENTIFY. */
|
/* Print/dump IDENTIFY. */
|
||||||
if (ident || dumpid)
|
if (ident || dumpid)
|
||||||
{
|
{
|
||||||
char buf[GRUB_DISK_SECTOR_SIZE];
|
char buf[GRUB_DISK_SECTOR_SIZE];
|
||||||
if (grub_hdparm_do_ata_cmd (disk, GRUB_ATA_CMD_IDENTIFY_DEVICE,
|
if (grub_hdparm_do_ata_cmd (ata, GRUB_ATA_CMD_IDENTIFY_DEVICE,
|
||||||
0, 0, buf, sizeof (buf)))
|
0, 0, buf, sizeof (buf)))
|
||||||
grub_printf ("Cannot read ATA IDENTIFY data\n");
|
grub_printf ("Cannot read ATA IDENTIFY data\n");
|
||||||
else
|
else
|
||||||
|
@ -367,7 +394,7 @@ grub_cmd_hdparm (grub_extcmd_context_t ctxt, int argc, char **args) // state????
|
||||||
if (power)
|
if (power)
|
||||||
{
|
{
|
||||||
grub_printf ("Disk power mode is: ");
|
grub_printf ("Disk power mode is: ");
|
||||||
int mode = grub_hdparm_do_check_powermode_cmd (disk);
|
int mode = grub_hdparm_do_check_powermode_cmd (ata);
|
||||||
if (mode < 0)
|
if (mode < 0)
|
||||||
grub_printf ("unknown\n");
|
grub_printf ("unknown\n");
|
||||||
else
|
else
|
||||||
|
@ -383,7 +410,7 @@ grub_cmd_hdparm (grub_extcmd_context_t ctxt, int argc, char **args) // state????
|
||||||
{
|
{
|
||||||
if (! quiet)
|
if (! quiet)
|
||||||
grub_printf ("SMART status is: ");
|
grub_printf ("SMART status is: ");
|
||||||
int err = grub_hdparm_do_smart_cmd (disk, GRUB_ATA_FEAT_SMART_STATUS);
|
int err = grub_hdparm_do_smart_cmd (ata, GRUB_ATA_FEAT_SMART_STATUS);
|
||||||
if (! quiet)
|
if (! quiet)
|
||||||
grub_printf ("%s\n", (err < 0 ? "unknown" :
|
grub_printf ("%s\n", (err < 0 ? "unknown" :
|
||||||
err == 0 ? "OK" : "*BAD*"));
|
err == 0 ? "OK" : "*BAD*"));
|
||||||
|
@ -392,11 +419,11 @@ grub_cmd_hdparm (grub_extcmd_context_t ctxt, int argc, char **args) // state????
|
||||||
|
|
||||||
/* Change power mode. */
|
/* Change power mode. */
|
||||||
if (standby_now)
|
if (standby_now)
|
||||||
grub_hdparm_simple_cmd ("Set disk to standby mode", disk,
|
grub_hdparm_simple_cmd ("Set disk to standby mode", ata,
|
||||||
GRUB_ATA_CMD_STANDBY_IMMEDIATE);
|
GRUB_ATA_CMD_STANDBY_IMMEDIATE);
|
||||||
|
|
||||||
if (sleep_now)
|
if (sleep_now)
|
||||||
grub_hdparm_simple_cmd ("Set disk to sleep mode", disk,
|
grub_hdparm_simple_cmd ("Set disk to sleep mode", ata,
|
||||||
GRUB_ATA_CMD_SLEEP);
|
GRUB_ATA_CMD_SLEEP);
|
||||||
|
|
||||||
grub_disk_close (disk);
|
grub_disk_close (disk);
|
||||||
|
|
|
@ -26,6 +26,8 @@
|
||||||
#include <grub/normal.h>
|
#include <grub/normal.h>
|
||||||
#include <grub/charset.h>
|
#include <grub/charset.h>
|
||||||
|
|
||||||
|
GRUB_MOD_LICENSE ("GPLv3+");
|
||||||
|
|
||||||
static grub_err_t
|
static grub_err_t
|
||||||
grub_cmd_help (grub_extcmd_context_t ctxt __attribute__ ((unused)), int argc,
|
grub_cmd_help (grub_extcmd_context_t ctxt __attribute__ ((unused)), int argc,
|
||||||
char **args)
|
char **args)
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue