merge mainline into 4096
This commit is contained in:
commit
a5edbcb3a1
393 changed files with 15834 additions and 2186 deletions
|
@ -125,7 +125,26 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/efi/disk.h
|
|||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
|
||||
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_srcdir)/include/grub/extcmd.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/cpu/cache.h
|
||||
|
@ -145,6 +164,11 @@ 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
|
||||
|
||||
if COND_powerpc_ieee1275
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
|
||||
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
|
||||
|
@ -305,6 +329,7 @@ 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
|
||||
|
|
|
@ -12,14 +12,26 @@ script = {
|
|||
common = genmod.sh.in;
|
||||
};
|
||||
|
||||
script = {
|
||||
installdir = noinst;
|
||||
name = modinfo.sh;
|
||||
common = modinfo.sh.in;
|
||||
};
|
||||
|
||||
kernel = {
|
||||
name = kernel;
|
||||
|
||||
nostrip = emu;
|
||||
|
||||
emu_ldflags = '-Wl,-r,-d';
|
||||
x86_efi_ldflags = '-Wl,-r,-d';
|
||||
x86_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment';
|
||||
i386_efi_ldflags = '-Wl,-r,-d';
|
||||
i386_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment';
|
||||
x86_64_efi_ldflags = '-Wl,-r,-d';
|
||||
x86_64_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment';
|
||||
|
||||
ia64_efi_cflags = '-fno-builtin -fpic -minline-int-divide-max-throughput';
|
||||
ia64_efi_ldflags = '-Wl,-r,-d';
|
||||
ia64_efi_stripflags = '--strip-unneeded -K start -R .note -R .comment';
|
||||
|
||||
i386_pc_ldflags = '$(TARGET_IMG_LDFLAGS)';
|
||||
i386_pc_ldflags = '$(TARGET_IMG_BASE_LDOPT),0x8200';
|
||||
|
@ -32,11 +44,13 @@ kernel = {
|
|||
i386_coreboot_ldflags = '-Wl,-Ttext=0x8200';
|
||||
i386_multiboot_ldflags = '-Wl,-Ttext=0x8200';
|
||||
i386_ieee1275_ldflags = '-Wl,-Ttext=0x10000';
|
||||
mips_yeeloong_ldflags = '-Wl,-Ttext,0x80200000';
|
||||
mips_loongson_ldflags = '-Wl,-Ttext,0x80200000';
|
||||
powerpc_ieee1275_ldflags = '-Wl,-Ttext,0x200000';
|
||||
sparc64_ieee1275_ldflags = '-Wl,-Ttext,0x4400';
|
||||
mips_arc_ldflags = '-Wl,-Ttext,0x8bd00000';
|
||||
mips_qemu_mips_ldflags = '-Wl,-Ttext,0x80200000';
|
||||
|
||||
mips_yeeloong_cppflags = '-DUSE_ASCII_FAILBACK';
|
||||
mips_loongson_cppflags = '-DUSE_ASCII_FAILBACK';
|
||||
i386_qemu_cppflags = '-DGRUB_BOOT_MACHINE_LINK_ADDR=$(GRUB_BOOT_MACHINE_LINK_ADDR)';
|
||||
emu_cflags = '$(CFLAGS_GNULIB)';
|
||||
emu_cppflags = '$(CPPFLAGS_GNULIB)';
|
||||
|
@ -48,7 +62,7 @@ kernel = {
|
|||
i386_ieee1275_startup = kern/i386/ieee1275/startup.S;
|
||||
i386_coreboot_startup = kern/i386/coreboot/startup.S;
|
||||
i386_multiboot_startup = kern/i386/coreboot/startup.S;
|
||||
mips_yeeloong_startup = kern/mips/startup.S;
|
||||
mips_startup = kern/mips/startup.S;
|
||||
sparc64_ieee1275_startup = kern/sparc64/ieee1275/crt0.S;
|
||||
powerpc_ieee1275_startup = kern/powerpc/ieee1275/startup.S;
|
||||
|
||||
|
@ -77,11 +91,10 @@ kernel = {
|
|||
noemu_nodist = symlist.c;
|
||||
|
||||
i386_pc = kern/generic/rtc_get_time_ms.c;
|
||||
x86_efi = kern/generic/rtc_get_time_ms.c;
|
||||
i386_qemu = kern/generic/rtc_get_time_ms.c;
|
||||
i386_coreboot = kern/generic/rtc_get_time_ms.c;
|
||||
i386_multiboot = kern/generic/rtc_get_time_ms.c;
|
||||
mips_yeeloong = kern/generic/rtc_get_time_ms.c;
|
||||
mips = kern/generic/rtc_get_time_ms.c;
|
||||
|
||||
ieee1275 = disk/ieee1275/ofdisk.c;
|
||||
ieee1275 = kern/ieee1275/cmain.c;
|
||||
|
@ -105,18 +118,24 @@ kernel = {
|
|||
|
||||
x86 = kern/i386/pit.c;
|
||||
|
||||
x86_efi = disk/efi/efidisk.c;
|
||||
x86_efi = kern/efi/efi.c;
|
||||
x86_efi = kern/efi/init.c;
|
||||
x86_efi = kern/efi/mm.c;
|
||||
x86_efi = kern/i386/efi/init.c;
|
||||
x86_efi = term/efi/console.c;
|
||||
efi = disk/efi/efidisk.c;
|
||||
efi = kern/efi/efi.c;
|
||||
efi = kern/efi/init.c;
|
||||
efi = kern/efi/mm.c;
|
||||
efi = term/efi/console.c;
|
||||
|
||||
i386_efi = kern/i386/tsc.c;
|
||||
i386_efi = kern/i386/efi/init.c;
|
||||
|
||||
x86_64_efi = kern/i386/tsc.c;
|
||||
x86_64_efi = kern/x86_64/dl.c;
|
||||
x86_64_efi = kern/x86_64/efi/callwrap.S;
|
||||
x86_64_efi = kern/i386/efi/init.c;
|
||||
|
||||
ia64_efi = kern/ia64/efi/startup.S;
|
||||
ia64_efi = kern/ia64/efi/init.c;
|
||||
ia64_efi = kern/ia64/dl.c;
|
||||
ia64_efi = kern/ia64/dl_helper.c;
|
||||
|
||||
i386_pc = kern/i386/pc/init.c;
|
||||
i386_pc = kern/i386/pc/mmap.c;
|
||||
|
@ -136,19 +155,29 @@ kernel = {
|
|||
|
||||
i386_ieee1275 = kern/ieee1275/init.c;
|
||||
|
||||
mips_yeeloong = term/ns8250.c;
|
||||
mips_yeeloong = bus/bonito.c;
|
||||
mips_yeeloong = bus/cs5536.c;
|
||||
mips_yeeloong = bus/pci.c;
|
||||
mips_yeeloong = kern/mips/cache.S;
|
||||
mips_yeeloong = kern/mips/dl.c;
|
||||
mips_yeeloong = kern/mips/init.c;
|
||||
mips_yeeloong = kern/mips/yeeloong/init.c;
|
||||
mips_yeeloong = term/at_keyboard.c;
|
||||
mips_yeeloong = term/serial.c;
|
||||
mips_yeeloong = video/sm712.c;
|
||||
mips = kern/mips/cache.S;
|
||||
mips = kern/mips/dl.c;
|
||||
mips = kern/mips/init.c;
|
||||
|
||||
mips_qemu_mips = kern/mips/qemu_mips/init.c;
|
||||
mips_qemu_mips = term/ns8250.c;
|
||||
mips_qemu_mips = term/serial.c;
|
||||
|
||||
mips_arc = kern/mips/arc/init.c;
|
||||
mips_arc = term/arc/console.c;
|
||||
mips_arc = disk/arc/arcdisk.c;
|
||||
|
||||
mips_loongson = term/ns8250.c;
|
||||
mips_loongson = bus/bonito.c;
|
||||
mips_loongson = bus/cs5536.c;
|
||||
mips_loongson = bus/pci.c;
|
||||
mips_loongson = kern/mips/loongson/init.c;
|
||||
mips_loongson = term/at_keyboard.c;
|
||||
mips_loongson = term/serial.c;
|
||||
mips_loongson = video/sm712.c;
|
||||
mips_loongson = video/sis315pro.c;
|
||||
extra_dist = video/sm712_init.c;
|
||||
mips_yeeloong = commands/keylayouts.c;
|
||||
mips_loongson = commands/keylayouts.c;
|
||||
|
||||
powerpc_ieee1275 = kern/ieee1275/init.c;
|
||||
powerpc_ieee1275 = kern/powerpc/cache.S;
|
||||
|
@ -162,7 +191,7 @@ kernel = {
|
|||
emu = disk/host.c;
|
||||
emu = gnulib/progname.c;
|
||||
emu = gnulib/error.c;
|
||||
emu = kern/emu/cache.S;
|
||||
emu = kern/emu/cache_s.S;
|
||||
emu = kern/emu/console.c;
|
||||
emu = kern/emu/getroot.c;
|
||||
emu = kern/emu/hostdisk.c;
|
||||
|
@ -171,6 +200,7 @@ kernel = {
|
|||
emu = kern/emu/misc.c;
|
||||
emu = kern/emu/mm.c;
|
||||
emu = kern/emu/time.c;
|
||||
emu = kern/emu/cache.c;
|
||||
|
||||
videoinkernel = term/gfxterm.c;
|
||||
videoinkernel = font/font.c;
|
||||
|
@ -178,6 +208,7 @@ kernel = {
|
|||
videoinkernel = io/bufio.c;
|
||||
videoinkernel = video/bitmap.c;
|
||||
videoinkernel = video/bitmap_scale.c;
|
||||
videoinkernel = video/colors.c;
|
||||
videoinkernel = video/fb/fbblit.c;
|
||||
videoinkernel = video/fb/fbfill.c;
|
||||
videoinkernel = video/fb/fbutil.c;
|
||||
|
@ -295,12 +326,12 @@ image = {
|
|||
common = lib/xzembed/xz_dec_lzma2.c;
|
||||
common = lib/xzembed/xz_dec_stream.c;
|
||||
|
||||
cppflags = '-I$(srcdir)/lib/posix_wrap -I$(srcdir)/lib/xzembed';
|
||||
|
||||
mips_cppflags = '-I$(srcdir)/lib/posix_wrap -I$(srcdir)/lib/xzembed -DGRUB_EMBED_DECOMPRESSOR=1 -DGRUB_MACHINE_LINK_ADDR=0x80200000';
|
||||
cppflags = '-I$(srcdir)/lib/posix_wrap -I$(srcdir)/lib/xzembed -DGRUB_EMBED_DECOMPRESSOR=1';
|
||||
|
||||
objcopyflags = '-O binary';
|
||||
ldflags = '-static-libgcc -Wl,-Ttext,0x80100000';
|
||||
mips_loongson_ldflags = '-static-libgcc -Wl,-Ttext,0x80100000';
|
||||
mips_qemu_mips_ldflags = '-static-libgcc -Wl,-Ttext,0x80100000';
|
||||
mips_arc_ldflags = '-static-libgcc -Wl,-Ttext,0x8bc00000';
|
||||
ldadd = '-lgcc';
|
||||
cflags = '-static-libgcc';
|
||||
enable = mips;
|
||||
|
@ -311,10 +342,12 @@ image = {
|
|||
mips = boot/mips/startup_raw.S;
|
||||
common = boot/decompressor/none.c;
|
||||
|
||||
mips_cppflags = '-DGRUB_EMBED_DECOMPRESSOR=1 -DGRUB_MACHINE_LINK_ADDR=0x80200000';
|
||||
cppflags = '-DGRUB_EMBED_DECOMPRESSOR=1';
|
||||
|
||||
objcopyflags = '-O binary';
|
||||
ldflags = '-static-libgcc -Wl,-Ttext,0x80100000';
|
||||
mips_loongson_ldflags = '-static-libgcc -Wl,-Ttext,0x80100000';
|
||||
mips_qemu_mips_ldflags = '-static-libgcc -Wl,-Ttext,0x80100000';
|
||||
mips_arc_ldflags = '-static-libgcc -Wl,-Ttext,0x8bc00000';
|
||||
ldadd = '-lgcc';
|
||||
cflags = '-static-libgcc';
|
||||
enable = mips;
|
||||
|
@ -322,10 +355,18 @@ image = {
|
|||
|
||||
image = {
|
||||
name = fwstart;
|
||||
mips_yeeloong = boot/mips/yeeloong/fwstart.S;
|
||||
mips_loongson = boot/mips/loongson/fwstart.S;
|
||||
objcopyflags = '-O binary';
|
||||
ldflags = '-static-libgcc -lgcc -Wl,-N,-S,-Ttext,0xbfc00000,-Bstatic';
|
||||
enable = mips_yeeloong;
|
||||
enable = mips_loongson;
|
||||
};
|
||||
|
||||
image = {
|
||||
name = fwstart_fuloong;
|
||||
mips_loongson = boot/mips/loongson/fuloong.S;
|
||||
objcopyflags = '-O binary';
|
||||
ldflags = '-static-libgcc -lgcc -Wl,-N,-S,-Ttext,0xbfc00000,-Bstatic';
|
||||
enable = mips_loongson;
|
||||
};
|
||||
|
||||
module = {
|
||||
|
@ -349,8 +390,8 @@ module = {
|
|||
|
||||
module = {
|
||||
name = lsspd;
|
||||
mips_yeeloong = commands/mips/yeeloong/lsspd.c;
|
||||
enable = mips_yeeloong;
|
||||
mips_loongson = commands/mips/loongson/lsspd.c;
|
||||
enable = mips_loongson;
|
||||
};
|
||||
|
||||
module = {
|
||||
|
@ -401,13 +442,21 @@ module = {
|
|||
|
||||
enable = emu;
|
||||
enable = i386_pc;
|
||||
enable = x86_efi;
|
||||
enable = i386_efi;
|
||||
enable = x86_64_efi;
|
||||
enable = i386_ieee1275;
|
||||
enable = i386_coreboot;
|
||||
enable = i386_multiboot;
|
||||
emu_condition = COND_GRUB_EMU_PCI;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = lsdev;
|
||||
common = commands/arc/lsdev.c;
|
||||
|
||||
enable = mips_arc;
|
||||
};
|
||||
|
||||
library = {
|
||||
name = libgnulib.a;
|
||||
common = gnulib/regex.c;
|
||||
|
@ -440,12 +489,12 @@ module = {
|
|||
name = acpi;
|
||||
|
||||
common = commands/acpi.c;
|
||||
x86_efi = commands/efi/acpi.c;
|
||||
efi = commands/efi/acpi.c;
|
||||
i386_pc = commands/i386/pc/acpi.c;
|
||||
i386_coreboot = commands/i386/pc/acpi.c;
|
||||
i386_multiboot = commands/i386/pc/acpi.c;
|
||||
|
||||
enable = x86_efi;
|
||||
enable = efi;
|
||||
enable = i386_pc;
|
||||
enable = i386_coreboot;
|
||||
enable = i386_multiboot;
|
||||
|
@ -456,7 +505,7 @@ module = {
|
|||
|
||||
common = commands/lsacpi.c;
|
||||
|
||||
enable = x86_efi;
|
||||
enable = efi;
|
||||
enable = i386_pc;
|
||||
enable = i386_coreboot;
|
||||
enable = i386_multiboot;
|
||||
|
@ -467,7 +516,7 @@ module = {
|
|||
|
||||
common = commands/efi/lsefisystab.c;
|
||||
|
||||
enable = x86_efi;
|
||||
enable = efi;
|
||||
};
|
||||
|
||||
module = {
|
||||
|
@ -475,7 +524,7 @@ module = {
|
|||
|
||||
common = commands/efi/lssal.c;
|
||||
|
||||
enable = x86_efi;
|
||||
enable = efi;
|
||||
};
|
||||
|
||||
module = {
|
||||
|
@ -483,7 +532,7 @@ module = {
|
|||
|
||||
common = commands/efi/lsefimmap.c;
|
||||
|
||||
enable = x86_efi;
|
||||
enable = efi;
|
||||
};
|
||||
|
||||
module = {
|
||||
|
@ -546,8 +595,9 @@ module = {
|
|||
|
||||
module = {
|
||||
name = fixvideo;
|
||||
x86_efi = commands/efi/fixvideo.c;
|
||||
enable = x86_efi;
|
||||
common = commands/efi/fixvideo.c;
|
||||
enable = i386_efi;
|
||||
enable = x86_64_efi;
|
||||
};
|
||||
|
||||
module = {
|
||||
|
@ -562,11 +612,12 @@ module = {
|
|||
i386_pc = commands/acpihalt.c;
|
||||
i386_coreboot = commands/acpihalt.c;
|
||||
i386_multiboot = commands/acpihalt.c;
|
||||
x86_efi = commands/acpihalt.c;
|
||||
i386_efi = commands/acpihalt.c;
|
||||
x86_64_efi = commands/acpihalt.c;
|
||||
i386_multiboot = lib/i386/halt.c;
|
||||
i386_coreboot = lib/i386/halt.c;
|
||||
i386_qemu = lib/i386/halt.c;
|
||||
x86_efi = lib/efi/halt.c;
|
||||
efi = lib/efi/halt.c;
|
||||
ieee1275 = lib/ieee1275/halt.c;
|
||||
emu = lib/emu/halt.c;
|
||||
};
|
||||
|
@ -581,6 +632,7 @@ module = {
|
|||
common = commands/hdparm.c;
|
||||
common = lib/hexdump.c;
|
||||
enable = pci;
|
||||
enable = mips_qemu_mips;
|
||||
};
|
||||
|
||||
module = {
|
||||
|
@ -601,8 +653,9 @@ module = {
|
|||
|
||||
module = {
|
||||
name = loadbios;
|
||||
x86_efi = commands/efi/loadbios.c;
|
||||
enable = x86_efi;
|
||||
common = commands/efi/loadbios.c;
|
||||
enable = i386_efi;
|
||||
enable = x86_64_efi;
|
||||
};
|
||||
|
||||
module = {
|
||||
|
@ -811,12 +864,14 @@ module = {
|
|||
name = ata;
|
||||
common = disk/ata.c;
|
||||
enable = pci;
|
||||
enable = mips_qemu_mips;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = ata_pthru;
|
||||
common = disk/ata_pthru.c;
|
||||
enable = pci;
|
||||
enable = mips_qemu_mips;
|
||||
};
|
||||
|
||||
module = {
|
||||
|
@ -906,6 +961,7 @@ module = {
|
|||
module = {
|
||||
name = btrfs;
|
||||
common = fs/btrfs.c;
|
||||
common = lib/crc.c;
|
||||
};
|
||||
|
||||
module = {
|
||||
|
@ -958,6 +1014,11 @@ module = {
|
|||
common = fs/minix2.c;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = minix3;
|
||||
common = fs/minix3.c;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = nilfs2;
|
||||
common = fs/nilfs2.c;
|
||||
|
@ -978,11 +1039,21 @@ module = {
|
|||
common = fs/reiserfs.c;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = romfs;
|
||||
common = fs/romfs.c;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = sfs;
|
||||
common = fs/sfs.c;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = squash4;
|
||||
common = fs/squash4.c;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = tar;
|
||||
common = fs/tar.c;
|
||||
|
@ -1050,7 +1121,6 @@ module = {
|
|||
common = gfxmenu/gui_progress_bar.c;
|
||||
common = gfxmenu/gui_util.c;
|
||||
common = gfxmenu/gui_string_util.c;
|
||||
common = gfxmenu/named_colors.c;
|
||||
};
|
||||
|
||||
module = {
|
||||
|
@ -1096,7 +1166,7 @@ module = {
|
|||
x86_64 = lib/x86_64/relocator_asm.S;
|
||||
x86 = lib/i386/relocator.c;
|
||||
ieee1275 = lib/ieee1275/relocator.c;
|
||||
x86_efi = lib/efi/relocator.c;
|
||||
efi = lib/efi/relocator.c;
|
||||
mips = lib/mips/relocator_asm.S;
|
||||
mips = lib/mips/relocator.c;
|
||||
powerpc = lib/powerpc/relocator_asm.S;
|
||||
|
@ -1113,9 +1183,10 @@ module = {
|
|||
module = {
|
||||
name = datetime;
|
||||
cmos = lib/cmos_datetime.c;
|
||||
x86_efi = lib/efi/datetime.c;
|
||||
efi = lib/efi/datetime.c;
|
||||
sparc64_ieee1275 = lib/ieee1275/datetime.c;
|
||||
powerpc_ieee1275 = lib/ieee1275/datetime.c;
|
||||
mips_arc = lib/arc/datetime.c;
|
||||
enable = noemu;
|
||||
};
|
||||
|
||||
|
@ -1127,6 +1198,7 @@ module = {
|
|||
extra_dist = lib/x86_64/setjmp.S;
|
||||
extra_dist = lib/sparc64/setjmp.S;
|
||||
extra_dist = lib/powerpc/setjmp.S;
|
||||
extra_dist = lib/ia64/setjmp.S;
|
||||
};
|
||||
|
||||
module = {
|
||||
|
@ -1160,6 +1232,12 @@ module = {
|
|||
enable = i386_pc;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = freedos;
|
||||
i386_pc = loader/i386/pc/freedos.c;
|
||||
enable = i386_pc;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = multiboot2;
|
||||
cppflags = "-DGRUB_USE_MULTIBOOT2";
|
||||
|
@ -1185,6 +1263,7 @@ module = {
|
|||
mips = loader/mips/linux.c;
|
||||
powerpc_ieee1275 = loader/powerpc/ieee1275/linux.c;
|
||||
sparc64_ieee1275 = loader/sparc64/ieee1275/linux.c;
|
||||
ia64_efi = loader/ia64/efi/linux.c;
|
||||
common = lib/cmdline.c;
|
||||
enable = noemu;
|
||||
};
|
||||
|
@ -1204,16 +1283,17 @@ module = {
|
|||
|
||||
module = {
|
||||
name = appleldr;
|
||||
x86_efi = loader/efi/appleloader.c;
|
||||
enable = x86_efi;
|
||||
common = loader/efi/appleloader.c;
|
||||
enable = i386_efi;
|
||||
enable = x86_64_efi;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = chain;
|
||||
x86_efi = loader/efi/chainloader.c;
|
||||
efi = loader/efi/chainloader.c;
|
||||
i386_pc = loader/i386/pc/chainloader.c;
|
||||
enable = i386_pc;
|
||||
enable = x86_efi;
|
||||
enable = efi;
|
||||
};
|
||||
|
||||
module = {
|
||||
|
@ -1225,12 +1305,13 @@ module = {
|
|||
i386_pc = mmap/i386/pc/mmap.c;
|
||||
i386_pc = mmap/i386/pc/mmap_helper.S;
|
||||
|
||||
x86_efi = mmap/efi/mmap.c;
|
||||
efi = mmap/efi/mmap.c;
|
||||
|
||||
mips_yeeloong = mmap/mips/yeeloong/uppermem.c;
|
||||
mips = mmap/mips/uppermem.c;
|
||||
|
||||
enable = x86;
|
||||
enable = mips_yeeloong;
|
||||
enable = ia64_efi;
|
||||
enable = mips;
|
||||
};
|
||||
|
||||
module = {
|
||||
|
@ -1304,6 +1385,11 @@ module = {
|
|||
common = partmap/sun.c;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = part_dvh;
|
||||
common = partmap/dvh.c;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = part_bsd;
|
||||
common = partmap/bsdlabel.c;
|
||||
|
@ -1337,8 +1423,7 @@ module = {
|
|||
x86 = term/ns8250.c;
|
||||
|
||||
enable = emu;
|
||||
enable = i386;
|
||||
enable = x86_64_efi;
|
||||
enable = x86;
|
||||
emu_condition = COND_GRUB_EMU_USB;
|
||||
};
|
||||
|
||||
|
@ -1414,14 +1499,15 @@ module = {
|
|||
|
||||
module = {
|
||||
name = efi_gop;
|
||||
x86_efi = video/efi_gop.c;
|
||||
enable = x86_efi;
|
||||
efi = video/efi_gop.c;
|
||||
enable = efi;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = efi_uga;
|
||||
x86_efi = video/efi_uga.c;
|
||||
enable = x86_efi;
|
||||
efi = video/efi_uga.c;
|
||||
enable = i386_efi;
|
||||
enable = x86_64_efi;
|
||||
};
|
||||
|
||||
module = {
|
||||
|
@ -1457,13 +1543,14 @@ module = {
|
|||
module = {
|
||||
name = video;
|
||||
common = video/video.c;
|
||||
common = video/colors.c;
|
||||
enable = videomodules;
|
||||
};
|
||||
|
||||
module = {
|
||||
name = ieee1275_fb;
|
||||
ieee1275 = video/ieee1275.c;
|
||||
enable = powerpc;
|
||||
enable = powerpc_ieee1275;
|
||||
};
|
||||
|
||||
module = {
|
||||
|
|
|
@ -25,6 +25,9 @@ grub_decompress_core (void *src, void *dest, unsigned long n,
|
|||
char *d = (char *) dest;
|
||||
const char *s = (const char *) src;
|
||||
|
||||
if (d == s)
|
||||
return;
|
||||
|
||||
if (d < s)
|
||||
while (n--)
|
||||
*d++ = *s++;
|
||||
|
|
2
grub-core/boot/mips/loongson/fuloong.S
Normal file
2
grub-core/boot/mips/loongson/fuloong.S
Normal file
|
@ -0,0 +1,2 @@
|
|||
#define FULOONG 1
|
||||
#include "fwstart.S"
|
|
@ -16,51 +16,73 @@
|
|||
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#include <grub/mips/yeeloong/serial.h>
|
||||
#include <grub/mips/yeeloong/pci.h>
|
||||
#include <grub/mips/loongson/serial.h>
|
||||
#include <grub/mips/loongson/pci.h>
|
||||
#include <grub/mips/loongson.h>
|
||||
#include <grub/pci.h>
|
||||
#include <grub/machine/serial.h>
|
||||
#include <grub/machine/kernel.h>
|
||||
#include <grub/ns8250.h>
|
||||
#include <grub/cs5536.h>
|
||||
#include <grub/smbus.h>
|
||||
|
||||
#ifdef FULOONG
|
||||
#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 noat
|
||||
.set nomacro
|
||||
.set mips3
|
||||
|
||||
.global start,_start,__start
|
||||
start:
|
||||
_start:
|
||||
__start:
|
||||
/* Put serial init as soon as possible. But on Fuloong serial is past
|
||||
Geode, so on Fuloong we need Geode first.
|
||||
*/
|
||||
#ifndef FULOONG
|
||||
bal serial_hw_init
|
||||
nop
|
||||
#endif
|
||||
|
||||
/* Find CS5536 controller. */
|
||||
/* $t4 chooses device in priority encoding. */
|
||||
/* Resulting value is kept in GRUB_MACHINE_PCI_CONF_CTRL_REG.
|
||||
This way we don't need to sacrifice a register for it. */
|
||||
retry_cs5536:
|
||||
/* We have only one bus (0). Function is 0. */
|
||||
lui $t0, %hi(GRUB_MACHINE_PCI_CONF_CTRL_REG_ADDR)
|
||||
lui $t1, %hi(GRUB_MACHINE_PCI_CONFSPACE)
|
||||
lui $t3, %hi(GRUB_CS5536_PCIID)
|
||||
addiu $t3, $t3, %lo(GRUB_CS5536_PCIID)
|
||||
ori $t4, $zero, 1
|
||||
lui $a0, %hi(no_cs5536)
|
||||
1:
|
||||
andi $t4, $t4, ((1 << GRUB_PCI_NUM_DEVICES) - 1)
|
||||
beql $t4, $zero, fatal
|
||||
addiu $a0, $a0, %lo(no_cs5536)
|
||||
/* In case of failure try again. CS5536 may be slow to come up. */
|
||||
beql $t4, $zero, retry_cs5536
|
||||
nop
|
||||
sw $t4, %lo(GRUB_MACHINE_PCI_CONF_CTRL_REG_ADDR) ($t0)
|
||||
lw $t2, (%lo(GRUB_MACHINE_PCI_CONFSPACE) + GRUB_PCI_REG_PCI_ID) ($t1)
|
||||
bnel $t2, $t3, 1b
|
||||
sll $t4, $t4, 1
|
||||
|
||||
#ifndef FULOONG
|
||||
bal message
|
||||
addiu $a0, $a0, %lo(cs5536_found)
|
||||
bal printhex
|
||||
move $a0, $t4
|
||||
#endif
|
||||
|
||||
/* Initialise SMBus controller. */
|
||||
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)
|
||||
|
||||
/* Set GPIO LBAR. */
|
||||
lui $a0, %hi(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 \
|
||||
| GRUB_CS5536_LBAR_ENABLE) >> 32)
|
||||
|
||||
bal gpio_init
|
||||
nop
|
||||
|
||||
#ifdef FULOONG
|
||||
bal serial_hw_init
|
||||
nop
|
||||
#endif
|
||||
|
||||
/* Initialise SMBus controller. */
|
||||
/* Set SMBUS LBAR. */
|
||||
lui $a0, %hi(GRUB_CS5536_MSR_SMB_BAR)
|
||||
addiu $a0, $a0, %lo(GRUB_CS5536_MSR_SMB_BAR)
|
||||
|
@ -83,14 +114,6 @@ __start:
|
|||
bal message
|
||||
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)
|
||||
|
||||
/* 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_CTRL2) ($t0)
|
||||
|
||||
/* Yeeloong has only one memory slot. */
|
||||
/* Yeeloong and Fuloong have only one memory slot. */
|
||||
/* Output first byte on serial for debugging. */
|
||||
ori $a1, $zero, GRUB_SMB_RAM_START_ADDR
|
||||
bal read_spd
|
||||
|
@ -120,7 +143,7 @@ __start:
|
|||
ori $t0, $zero, GRUB_SMBUS_SPD_MEMORY_TYPE_DDR2
|
||||
lui $a0, %hi(unimplemented_memory_type)
|
||||
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. */
|
||||
lui $t0, %hi(GRUB_CPU_LOONGSON_CORECFG)
|
||||
|
@ -206,10 +229,54 @@ other_exception:
|
|||
b fatal
|
||||
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
|
||||
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:
|
||||
move $t2, $ra
|
||||
#ifdef FULOONG
|
||||
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)
|
||||
|
||||
/* Turn off the interrupt. */
|
||||
|
@ -239,6 +306,7 @@ serial_hw_init:
|
|||
/* Let message return to original caller. */
|
||||
lui $a0, %hi(notification_string)
|
||||
addiu $a0, $a0, %lo(notification_string)
|
||||
move $ra, $t2
|
||||
|
||||
/* Print message on serial console. */
|
||||
/* In: $a0 = asciiz message. Out: none. Clobbered: $t0, $t1, $a0. */
|
||||
|
@ -379,7 +447,6 @@ read_spd_fail:
|
|||
ori $v0, $v0, 0x100
|
||||
|
||||
notification_string: .asciz "GRUB "
|
||||
no_cs5536: .asciz "No CS5536 found.\n\r"
|
||||
cs5536_found: .asciz "CS5536 at "
|
||||
sm_failed: .asciz "SM transaction failed.\n\r"
|
||||
unhandled_tlb_refill: .asciz "Unhandled TLB refill.\n\r"
|
||||
|
@ -404,14 +471,22 @@ regdump:
|
|||
.quad 0x0100020200010101 /* 4 */
|
||||
.quad 0x0a04030603050203 /* 6 */
|
||||
.quad 0x0f0e040000010a0b /* 7 */
|
||||
#ifdef FULOONG
|
||||
.quad 0x0000000100000001 /* 8 */
|
||||
#else
|
||||
.quad 0x0000010200000102 /* 8 */
|
||||
#endif
|
||||
.quad 0x0000060c00000000 /* 9 */
|
||||
.quad 0x2323233f3f1f0200 /* a */
|
||||
.quad 0x5f7f232323232323 /* b */
|
||||
.quad 0x002a3c0615000000 /* c */
|
||||
.quad 0x002a002a002a002a /* d */
|
||||
.quad 0x002a002a002a002a /* e */
|
||||
#ifdef FULOONG
|
||||
.quad 0x00b40020005b0004 /* f */
|
||||
#else
|
||||
.quad 0x00b40020006d0004 /* f */
|
||||
#endif
|
||||
.quad 0x070007ff00000087 /* 10 */
|
||||
.quad 0x000000000016101f /* 11 */
|
||||
.quad 0x001c000000000000 /* 12 */
|
||||
|
@ -426,6 +501,45 @@ regdump:
|
|||
.quad 0 /* 1b */
|
||||
.quad 0 /* 1c */
|
||||
|
||||
/* Dump of GPIO connections. FIXME: Remove useless and macroify. */
|
||||
gpio_dump:
|
||||
#ifdef FULOONG
|
||||
.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
|
||||
|
||||
write_dumpreg:
|
||||
|
@ -626,6 +740,10 @@ continue:
|
|||
lui $t0, %hi(cached_continue - 0x20000000)
|
||||
addiu $t0, $t0, %lo(cached_continue - 0x20000000)
|
||||
jr $t0
|
||||
addiu $a2, $zero, -1
|
||||
#ifdef FULOONG
|
||||
addiu $a2, $zero, -(1 + GRUB_ARCH_MACHINE_FULOONG)
|
||||
#else
|
||||
addiu $a2, $zero, -(1 + GRUB_ARCH_MACHINE_YEELOONG)
|
||||
#endif
|
||||
|
||||
cached_continue:
|
||||
cached_continue:
|
|
@ -20,6 +20,7 @@
|
|||
#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
|
||||
|
@ -43,21 +44,31 @@ compressed_size:
|
|||
. = _start + GRUB_KERNEL_MACHINE_UNCOMPRESSED_SIZE
|
||||
uncompressed_size:
|
||||
.long 0
|
||||
. = _start + GRUB_KERNEL_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_YEELOONG
|
||||
#ifdef GRUB_MACHINE_MIPS_QEMU_MIPS
|
||||
lui $t0, %hi (((16 << 20) - 264) | 0x80000000)
|
||||
lw $s4, %lo (((16 << 20) - 264) | 0x80000000) ($t0)
|
||||
#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, $a2, 1
|
||||
beq $t0, $zero, argdone
|
||||
addiu $t0, $zero, -0x10
|
||||
and $t1, $a2, $t0
|
||||
beq $t0, $t1, argfw
|
||||
nop
|
||||
move $t0, $a2
|
||||
argcont:
|
||||
|
@ -72,11 +83,19 @@ argcont:
|
|||
nop ;\
|
||||
b 2f;\
|
||||
move reg, $v0; \
|
||||
1:
|
||||
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_fuloong_verstr, GRUB_ARCH_MACHINE_FULOONG)
|
||||
2:
|
||||
b argcont
|
||||
addiu $t0, $t0, 4
|
||||
|
@ -120,8 +139,47 @@ 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_fuloong_str: .asciiz "machtype=lemote-fuloong-"
|
||||
pmon_yeeloong_str: .asciiz "PMON_VER=LM8"
|
||||
pmon_fuloong_str: .asciiz "PMON_VER=LM6"
|
||||
pmon_yeeloong_verstr: .asciiz "Version=LM8"
|
||||
pmon_fuloong_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_fuloong_str, GRUB_ARCH_MACHINE_FULOONG)
|
||||
DO_CHECKA1 (pmon_fuloong_str, GRUB_ARCH_MACHINE_FULOONG)
|
||||
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)
|
||||
|
@ -150,6 +208,13 @@ argdone:
|
|||
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)
|
||||
|
@ -159,8 +224,7 @@ argdone:
|
|||
subu $a0, $a0, $t0
|
||||
addu $a0, $a0, $s0
|
||||
|
||||
lui $a1, %hi(GRUB_MACHINE_LINK_ADDR)
|
||||
addiu $a1, %lo(GRUB_MACHINE_LINK_ADDR)
|
||||
lw $a1, (GRUB_KERNEL_MACHINE_UNCOMPRESSED_ADDR - BASE_ADDR)($s0)
|
||||
lw $a2, (GRUB_KERNEL_MACHINE_COMPRESSED_SIZE - BASE_ADDR)($s0)
|
||||
lw $a3, (GRUB_KERNEL_MACHINE_UNCOMPRESSED_SIZE - BASE_ADDR)($s0)
|
||||
move $s1, $a1
|
||||
|
@ -170,9 +234,11 @@ argdone:
|
|||
*/
|
||||
move $s6, $a3
|
||||
|
||||
lui $sp, %hi(_start - 256)
|
||||
lui $t0, %hi(EXT_C(grub_decompress_core))
|
||||
addiu $t0, $t0, %lo(EXT_C(grub_decompress_core))
|
||||
|
||||
bal EXT_C(grub_decompress_core)
|
||||
lui $sp, %hi(_start - 256)
|
||||
jalr $t0
|
||||
addiu $sp, $sp, %lo(_start - 256)
|
||||
|
||||
move $a0, $s1
|
||||
|
|
|
@ -21,6 +21,13 @@
|
|||
#include <grub/pci.h>
|
||||
#include <grub/time.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
|
||||
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;
|
||||
}
|
||||
|
||||
/* 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
|
||||
set_io_space (grub_pci_device_t dev, int num, grub_uint16_t start,
|
||||
grub_uint16_t len)
|
||||
|
@ -273,17 +260,6 @@ set_p2d (grub_pci_device_t dev, int num, int dest, grub_uint32_t start)
|
|||
void
|
||||
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. */
|
||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_IRQ_MAP_BAR,
|
||||
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);
|
||||
|
||||
/* Setup DIVIL. */
|
||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_DIVIL_LEG_IO,
|
||||
GRUB_CS5536_MSR_DIVIL_LEG_IO_MODE_X86
|
||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_F_REMAP
|
||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE0
|
||||
| GRUB_CS5536_MSR_DIVIL_LEG_IO_RTC_ENABLE1);
|
||||
#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_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;
|
||||
case GRUB_ARCH_MACHINE_FULOONG:
|
||||
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_DIVIL_LPC_INTERRUPTS) & 0xffff);
|
||||
grub_cs5536_write_msr (dev, GRUB_CS5536_MSR_DIVIL_IRQ_MAPPER_LPC_MASK,
|
||||
|
|
|
@ -20,23 +20,39 @@
|
|||
#include <grub/dl.h>
|
||||
#include <grub/pci.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/mm_private.h>
|
||||
#include <grub/cache.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
/* FIXME: correctly support 64-bit architectures. */
|
||||
/* #if GRUB_TARGET_SIZEOF_VOID_P == 4 */
|
||||
struct grub_pci_dma_chunk *
|
||||
grub_memalign_dma32 (grub_size_t align, grub_size_t size)
|
||||
{
|
||||
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
|
||||
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);
|
||||
}
|
||||
/* #endif */
|
||||
|
||||
#ifdef GRUB_MACHINE_MIPS_YEELOONG
|
||||
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||
volatile void *
|
||||
grub_dma_get_virt (struct grub_pci_dma_chunk *ch)
|
||||
{
|
||||
|
@ -99,13 +115,13 @@ grub_pci_iterate (grub_pci_iteratefunc_t hook)
|
|||
continue;
|
||||
}
|
||||
|
||||
#ifdef GRUB_MACHINE_MIPS_YEELOONG
|
||||
#ifdef GRUB_MACHINE_MIPS_LOONGSON
|
||||
/* Skip ghosts. */
|
||||
if (id == GRUB_YEELOONG_OHCI_PCIID
|
||||
&& dev.function == GRUB_YEELOONG_OHCI_GHOST_FUNCTION)
|
||||
if (id == GRUB_LOONGSON_OHCI_PCIID
|
||||
&& dev.function == GRUB_LOONGSON_OHCI_GHOST_FUNCTION)
|
||||
continue;
|
||||
if (id == GRUB_YEELOONG_EHCI_PCIID
|
||||
&& dev.function == GRUB_YEELOONG_EHCI_GHOST_FUNCTION)
|
||||
if (id == GRUB_LOONGSON_EHCI_PCIID
|
||||
&& dev.function == GRUB_LOONGSON_EHCI_GHOST_FUNCTION)
|
||||
continue;
|
||||
#endif
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include <grub/usb.h>
|
||||
#include <grub/dl.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
|
||||
static struct grub_usb_controller_dev usb_controller =
|
||||
{
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#include <grub/cs5536.h>
|
||||
#include <grub/loader.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
struct grub_ohci_hcca
|
||||
{
|
||||
/* Pointers to Interrupt Endpoint Descriptors. Not used by
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
|
||||
#include <grub/serial.h>
|
||||
#include <grub/usbserial.h>
|
||||
#include <grub/dl.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
void
|
||||
grub_usbserial_fini (struct grub_serial_port *port)
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include <grub/usb.h>
|
||||
#include <grub/usbserial.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
enum
|
||||
{
|
||||
GRUB_FTDI_MODEM_CTRL = 0x01,
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include <grub/usb.h>
|
||||
#include <grub/usbserial.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
/* Convert speed to divisor. */
|
||||
static grub_uint32_t
|
||||
is_speed_supported (unsigned int speed)
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#include <grub/i386/io.h>
|
||||
#include <grub/time.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
#define GRUB_UHCI_IOMASK (0x7FF << 5)
|
||||
|
||||
#define N_QH 256
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include <grub/list.h>
|
||||
#include <grub/term.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_usb_controller_dev_t grub_usb_list;
|
||||
static struct grub_usb_attach_desc *attach_hooks;
|
||||
|
||||
|
@ -183,6 +185,12 @@ grub_usb_device_initialize (grub_usb_device_t dev)
|
|||
for (i = 0; i < 8; i++)
|
||||
dev->config[i].descconf = NULL;
|
||||
|
||||
if (descdev->configcnt == 0)
|
||||
{
|
||||
err = GRUB_USB_ERR_BADDEVICE;
|
||||
goto fail;
|
||||
}
|
||||
|
||||
for (i = 0; i < descdev->configcnt; i++)
|
||||
{
|
||||
int pos;
|
||||
|
|
|
@ -215,6 +215,8 @@ attach_root_port (struct grub_usb_hub *hub, int portno,
|
|||
return;
|
||||
hub->controller->dev->pending_reset = grub_get_time_ms () + 5000;
|
||||
|
||||
grub_millisleep (10);
|
||||
|
||||
/* Enable the port and create a device. */
|
||||
dev = grub_usb_hub_add_dev (hub->controller, speed);
|
||||
hub->controller->dev->pending_reset = 0;
|
||||
|
@ -350,8 +352,8 @@ poll_nonroot_hub (grub_usb_device_t dev)
|
|||
GRUB_USB_REQ_GET_STATUS,
|
||||
0, i, sizeof (status), (char *) &status);
|
||||
|
||||
grub_printf ("dev = %p, i = %d, status = %08x\n",
|
||||
dev, i, status);
|
||||
grub_dprintf ("usb", "dev = %p, i = %d, status = %08x\n",
|
||||
dev, i, status);
|
||||
|
||||
if (err)
|
||||
continue;
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
#include <grub/efi/api.h>
|
||||
#endif
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static const struct grub_arg_option options[] = {
|
||||
{"exclude", 'x', 0,
|
||||
N_("Don't load host tables specified by comma-separated list."),
|
||||
|
|
53
grub-core/commands/arc/lsdev.c
Normal file
53
grub-core/commands/arc/lsdev.c
Normal file
|
@ -0,0 +1,53 @@
|
|||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 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 <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
#include <grub/arc/arc.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_lsdev (grub_command_t cmd __attribute__ ((unused)),
|
||||
int argc __attribute__ ((unused)),
|
||||
char **args __attribute__ ((unused)))
|
||||
{
|
||||
auto int hook (const char *name, const struct grub_arc_component *comp);
|
||||
int hook (const char *name, const struct grub_arc_component *comp __attribute__ ((unused)))
|
||||
{
|
||||
grub_printf ("%s\n", name);
|
||||
return 0;
|
||||
}
|
||||
grub_arc_iterate_devs (hook, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_command_t cmd;
|
||||
|
||||
GRUB_MOD_INIT(lsdev)
|
||||
{
|
||||
cmd = grub_register_command ("lsdev", grub_cmd_lsdev, "",
|
||||
N_("List devices."));
|
||||
}
|
||||
|
||||
GRUB_MOD_FINI(lsdev)
|
||||
{
|
||||
grub_unregister_command (cmd);
|
||||
}
|
|
@ -26,6 +26,8 @@
|
|||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_blocklist (grub_command_t cmd __attribute__ ((unused)),
|
||||
int argc, char **args)
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#include <grub/mm.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_err_t (*grub_loader_boot_func) (void);
|
||||
static grub_err_t (*grub_loader_unload_func) (void);
|
||||
static int grub_loader_noreturn;
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#include <grub/extcmd.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static const struct grub_arg_option options[] =
|
||||
{
|
||||
{"dos", -1, 0, N_("Accept DOS-style CR/NL line endings."), 0, 0},
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
#define BUFFER_SIZE 512
|
||||
|
||||
static grub_err_t
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_source (grub_command_t cmd, int argc, char **args)
|
||||
{
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
#define GRUB_DATETIME_SET_YEAR 1
|
||||
#define GRUB_DATETIME_SET_MONTH 2
|
||||
#define GRUB_DATETIME_SET_DAY 4
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#include <grub/i18n.h>
|
||||
#include <grub/term.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static const struct grub_arg_option options[] =
|
||||
{
|
||||
{0, 'n', 0, N_("Do not output the trailing newline."), 0, 0},
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static struct grub_video_patch
|
||||
{
|
||||
const char *name;
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#include <grub/command.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 acpi2_guid = GRUB_EFI_ACPI_20_TABLE_GUID;
|
||||
static grub_efi_guid_t smbios_guid = GRUB_EFI_SMBIOS_TABLE_GUID;
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#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)))
|
||||
|
||||
|
|
|
@ -18,12 +18,15 @@
|
|||
*/
|
||||
#include <grub/types.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/dl.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/normal.h>
|
||||
#include <grub/charset.h>
|
||||
#include <grub/efi/api.h>
|
||||
#include <grub/efi/efi.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
struct guid_mapping
|
||||
{
|
||||
grub_efi_guid_t guid;
|
||||
|
|
|
@ -23,6 +23,9 @@
|
|||
#include <grub/charset.h>
|
||||
#include <grub/efi/api.h>
|
||||
#include <grub/efi/efi.h>
|
||||
#include <grub/dl.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static void
|
||||
disp_sal (void *table)
|
||||
|
|
|
@ -22,6 +22,9 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/extcmd.h>
|
||||
#include <grub/script_sh.h>
|
||||
#include <grub/dl.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
grub_err_t
|
||||
grub_extcmd_dispatcher (struct grub_command *cmd, int argc, char **args,
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#include <grub/fs.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
/* Convert a LBA address to a CHS address in the INT 13 format. */
|
||||
/* Taken from grub1. */
|
||||
/* XXX: use hardcoded geometry of C = 1024, H = 255, S = 63.
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_halt (grub_command_t cmd __attribute__ ((unused)),
|
||||
int argc __attribute__ ((unused)),
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#include <grub/normal.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static const struct grub_arg_option options[] = {
|
||||
{"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},
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#include <grub/extcmd.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static const struct grub_arg_option options[] = {
|
||||
{"apm", 'B', 0, N_("Set Advanced Power Management\n"
|
||||
"(1=low, ..., 254=high, 255=off)."),
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#include <grub/normal.h>
|
||||
#include <grub/charset.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_help (grub_extcmd_context_t ctxt __attribute__ ((unused)), int argc,
|
||||
char **args)
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#include <grub/extcmd.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static const struct grub_arg_option options[] = {
|
||||
{"skip", 's', 0, N_("Skip offset bytes from the beginning of file."), 0,
|
||||
ARG_TYPE_INT},
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/cmos.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_err_t
|
||||
parse_args (int argc, char *argv[], int *byte, int *bit)
|
||||
{
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include <grub/i386/cpuid.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
#define cpuid(num,a,b,c,d) \
|
||||
asm volatile ("xchgl %%ebx, %1; cpuid; xchgl %%ebx, %1" \
|
||||
: "=a" (a), "=r" (b), "=c" (c), "=d" (d) \
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include <grub/memory.h>
|
||||
#include <grub/machine/memory.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
/* Real mode IVT slot (seg:off far pointer) for interrupt 0x13. */
|
||||
static grub_uint32_t *const int13slot = UINT_TO_PTR (4 * 0x13);
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include <grub/machine/int.h>
|
||||
#include <grub/acpi.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static const struct grub_arg_option options[] =
|
||||
{
|
||||
{"no-apm", 'n', 0, N_("Do not use APM to halt the computer."), 0, 0},
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
int
|
||||
grub_apm_get_info (struct grub_apm_info *info)
|
||||
{
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
#define BASE_TEMPO (60 * GRUB_TICKS_PER_SECOND)
|
||||
|
||||
/* The speaker port. */
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_pxe_unload (grub_command_t cmd __attribute__ ((unused)),
|
||||
int argc __attribute__ ((unused)),
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include <grub/cpu/io.h>
|
||||
#include <grub/loader.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv2+");
|
||||
|
||||
static char sendkey[0x20];
|
||||
/* Length of sendkey. */
|
||||
static int keylen = 0;
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_suspend (grub_command_t cmd __attribute__ ((unused)),
|
||||
int argc __attribute__ ((unused)),
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include <grub/cpu/io.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_extcmd_t cmd_read_byte, cmd_read_word, cmd_read_dword;
|
||||
static grub_command_t cmd_write_byte, cmd_write_word, cmd_write_dword;
|
||||
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include <grub/i18n.h>
|
||||
#include <grub/file.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static struct grub_keyboard_layout layout_us = {
|
||||
.keyboard_map = {
|
||||
/* Keyboard errors. Handled by driver. */
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#include <grub/term.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static const struct grub_arg_option options[] =
|
||||
{
|
||||
{"shift", 's', 0, N_("Check Shift key."), 0, 0},
|
||||
|
|
|
@ -33,6 +33,8 @@
|
|||
#include <grub/disk.h>
|
||||
#include <grub/partition.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_err_t
|
||||
legacy_file (const char *filename)
|
||||
{
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include <grub/extcmd.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static const struct grub_arg_option options[] =
|
||||
{
|
||||
{"file", 'f', 0, N_("Specify filename."), 0, ARG_TYPE_PATHNAME},
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
#include <grub/datetime.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static const struct grub_arg_option options[] =
|
||||
{
|
||||
{"long", 'l', 0, N_("Show a long list with more detailed information."), 0, 0},
|
||||
|
@ -132,11 +134,12 @@ grub_ls_list_files (char *dirname, int longlist, int all, int human)
|
|||
|
||||
if (units)
|
||||
{
|
||||
grub_uint32_t whole, fraction;
|
||||
grub_uint64_t whole, fraction;
|
||||
|
||||
whole = grub_divmod64 (fsize, 100, &fraction);
|
||||
grub_snprintf (buf, sizeof (buf),
|
||||
"%u.%02u%c", whole, fraction,
|
||||
"%" PRIuGRUB_UINT64_T
|
||||
".%02" PRIuGRUB_UINT64_T "%c", whole, fraction,
|
||||
grub_human_sizes[units]);
|
||||
grub_printf ("%-12s", buf);
|
||||
}
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#include <grub/i18n.h>
|
||||
#include <grub/dl.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static void
|
||||
print_strn (grub_uint8_t *str, grub_size_t len)
|
||||
{
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include <grub/i18n.h>
|
||||
#include <grub/memory.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static const char *names[] =
|
||||
{
|
||||
[GRUB_MEMORY_AVAILABLE] = "available",
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#include <grub/extcmd.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
struct grub_pci_classname
|
||||
{
|
||||
int class;
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#include <grub/env.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_extcmd_t cmd_read_byte, cmd_read_word, cmd_read_dword;
|
||||
static grub_command_t cmd_write_byte, cmd_write_word, cmd_write_dword;
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ grub_normal_add_menu_entry (int argc, const char **args, char **classes,
|
|||
if (! menu_sourcecode)
|
||||
return grub_errno;
|
||||
|
||||
if (classes)
|
||||
if (classes && classes[0])
|
||||
{
|
||||
int i;
|
||||
for (i = 0; classes[i]; i++); /* count # of menuentry classes */
|
||||
|
@ -255,7 +255,8 @@ grub_cmd_menuentry (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
|
||||
if (! ctxt->script)
|
||||
return grub_normal_add_menu_entry (argc, (const char **) args,
|
||||
ctxt->state[0].args, ctxt->state[1].arg,
|
||||
(ctxt->state[0].set ? ctxt->state[0].args
|
||||
: NULL), ctxt->state[1].arg,
|
||||
ctxt->state[2].arg, 0,
|
||||
ctxt->state[3].arg,
|
||||
ctxt->extcmd->cmd->name[0] == 's');
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
/* cat FILE */
|
||||
static grub_err_t
|
||||
grub_mini_cmd_cat (struct grub_command *cmd __attribute__ ((unused)),
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include <grub/command.h>
|
||||
#include <grub/cs5536.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_lsspd (grub_command_t cmd __attribute__ ((unused)),
|
||||
int argc __attribute__ ((unused)),
|
|
@ -31,6 +31,8 @@
|
|||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv2+");
|
||||
|
||||
static struct grub_parttool *parts = 0;
|
||||
static int curhandle = 0;
|
||||
static grub_dl_t mymod;
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#include <grub/dl.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_dl_t my_mod;
|
||||
|
||||
static grub_err_t
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#include <grub/dl.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_dl_t my_mod;
|
||||
|
||||
struct pbkdf2_password
|
||||
|
|
|
@ -32,9 +32,11 @@
|
|||
#include <grub/extcmd.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static const struct grub_arg_option options[] =
|
||||
{
|
||||
{"set", 's', GRUB_ARG_OPTION_OPTIONAL,
|
||||
{"set", 's', 0,
|
||||
N_("Set a variable to return value."), "VAR", ARG_TYPE_STRING},
|
||||
{"driver", 'd', 0, N_("Determine driver."), 0, 0},
|
||||
{"partmap", 'p', 0, N_("Determine partition map type."), 0, 0},
|
||||
|
@ -150,7 +152,7 @@ static grub_extcmd_t cmd;
|
|||
|
||||
GRUB_MOD_INIT (probe)
|
||||
{
|
||||
cmd = grub_register_extcmd ("probe", grub_cmd_probe, 0, N_("[DEVICE]"),
|
||||
cmd = grub_register_extcmd ("probe", grub_cmd_probe, 0, N_("DEVICE"),
|
||||
N_("Retrieve device info."), options);
|
||||
}
|
||||
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static char *
|
||||
grub_getline (void)
|
||||
{
|
||||
|
|
|
@ -22,6 +22,8 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_reboot (grub_command_t cmd __attribute__ ((unused)),
|
||||
int argc __attribute__ ((unused)),
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include <grub/script_sh.h>
|
||||
#include <regex.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static const struct grub_arg_option options[] =
|
||||
{
|
||||
{ "set", 's', GRUB_ARG_OPTION_REPEATABLE,
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
#include <grub/disk.h>
|
||||
#include <grub/partition.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
void
|
||||
FUNC_NAME (const char *key, const char *var, int no_floppy,
|
||||
char **hints, unsigned nhints)
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include <grub/search.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static const struct grub_arg_option options[] =
|
||||
{
|
||||
{"file", 'f', 0, N_("Search devices by a file."), 0, 0},
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#include <grub/mm.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
struct pci_register
|
||||
{
|
||||
const char *name;
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#include <grub/extcmd.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static const struct grub_arg_option options[] =
|
||||
{
|
||||
{"verbose", 'v', 0, N_("Verbose countdown."), 0, 0},
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#include <grub/i18n.h>
|
||||
#include <grub/misc.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
struct grub_term_autoload *grub_term_input_autoload = NULL;
|
||||
struct grub_term_autoload *grub_term_output_autoload = NULL;
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
/* A simple implementation for signed numbers. */
|
||||
static int
|
||||
grub_strtosl (char *arg, char **end, int base)
|
||||
|
|
|
@ -29,6 +29,8 @@
|
|||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_testload (struct grub_command *cmd __attribute__ ((unused)),
|
||||
int argc, char *argv[])
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_true (struct grub_command *cmd __attribute__ ((unused)),
|
||||
int argc __attribute__ ((unused)),
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static const char *usb_classes[] =
|
||||
{
|
||||
"Unknown",
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static unsigned height, width, depth;
|
||||
|
||||
static int
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include <grub/gfxmenu_view.h>
|
||||
#include <grub/env.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_err_t
|
||||
grub_cmd_videotest (grub_command_t cmd __attribute__ ((unused)),
|
||||
int argc, char **args)
|
||||
|
|
|
@ -34,6 +34,8 @@
|
|||
#include <grub/i18n.h>
|
||||
#include <grub/crypto.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
/* This prefix is used by xnu and boot-132 to hash
|
||||
together with volume serial. */
|
||||
static grub_uint8_t hash_prefix[16]
|
||||
|
|
295
grub-core/disk/arc/arcdisk.c
Normal file
295
grub-core/disk/arc/arcdisk.c
Normal file
|
@ -0,0 +1,295 @@
|
|||
/* ofdisk.c - Open Firmware disk access. */
|
||||
/*
|
||||
* GRUB -- GRand Unified Bootloader
|
||||
* Copyright (C) 2004,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 <grub/misc.h>
|
||||
#include <grub/disk.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/arc/arc.h>
|
||||
|
||||
static grub_arc_fileno_t last_handle = 0;
|
||||
static char *last_path = NULL;
|
||||
|
||||
static int lnum = 0;
|
||||
|
||||
struct arcdisk_hash_ent
|
||||
{
|
||||
char *devpath;
|
||||
int num;
|
||||
struct arcdisk_hash_ent *next;
|
||||
};
|
||||
|
||||
#define ARCDISK_HASH_SZ 8
|
||||
static struct arcdisk_hash_ent *arcdisk_hash[ARCDISK_HASH_SZ];
|
||||
|
||||
static int
|
||||
arcdisk_hash_fn (const char *devpath)
|
||||
{
|
||||
int hash = 0;
|
||||
while (*devpath)
|
||||
hash ^= *devpath++;
|
||||
return (hash & (ARCDISK_HASH_SZ - 1));
|
||||
}
|
||||
|
||||
static struct arcdisk_hash_ent *
|
||||
arcdisk_hash_find (const char *devpath)
|
||||
{
|
||||
struct arcdisk_hash_ent *p = arcdisk_hash[arcdisk_hash_fn (devpath)];
|
||||
|
||||
while (p)
|
||||
{
|
||||
if (!grub_strcmp (p->devpath, devpath))
|
||||
break;
|
||||
p = p->next;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
|
||||
static struct arcdisk_hash_ent *
|
||||
arcdisk_hash_add (char *devpath)
|
||||
{
|
||||
struct arcdisk_hash_ent *p;
|
||||
struct arcdisk_hash_ent **head = &arcdisk_hash[arcdisk_hash_fn(devpath)];
|
||||
|
||||
p = grub_malloc (sizeof (*p));
|
||||
if (!p)
|
||||
return NULL;
|
||||
|
||||
p->devpath = devpath;
|
||||
p->next = *head;
|
||||
p->num = lnum++;
|
||||
*head = p;
|
||||
return p;
|
||||
}
|
||||
|
||||
|
||||
static int
|
||||
grub_arcdisk_iterate (int (*hook_in) (const char *name))
|
||||
{
|
||||
auto int hook (const char *name, const struct grub_arc_component *comp);
|
||||
int hook (const char *name, const struct grub_arc_component *comp)
|
||||
{
|
||||
if (!(comp->type == GRUB_ARC_COMPONENT_TYPE_DISK
|
||||
|| comp->type == GRUB_ARC_COMPONENT_TYPE_DISK
|
||||
|| comp->type == GRUB_ARC_COMPONENT_TYPE_TAPE))
|
||||
return 0;
|
||||
return hook_in (name);
|
||||
}
|
||||
return grub_arc_iterate_devs (hook, 1);
|
||||
}
|
||||
|
||||
#define RAW_SUFFIX "partition(10)"
|
||||
|
||||
static grub_err_t
|
||||
reopen (const char *name)
|
||||
{
|
||||
grub_arc_fileno_t handle;
|
||||
|
||||
if (last_path && grub_strcmp (last_path, name) == 0)
|
||||
{
|
||||
grub_dprintf ("arcdisk", "using already opened %s\n", name);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
if (last_path)
|
||||
{
|
||||
GRUB_ARC_FIRMWARE_VECTOR->close (last_handle);
|
||||
grub_free (last_path);
|
||||
last_path = NULL;
|
||||
last_handle = 0;
|
||||
}
|
||||
if (GRUB_ARC_FIRMWARE_VECTOR->open (name, 0, &handle))
|
||||
{
|
||||
grub_dprintf ("arcdisk", "couldn't open %s\n", name);
|
||||
return grub_error (GRUB_ERR_IO, "couldn't open %s", name);
|
||||
}
|
||||
last_path = grub_strdup (name);
|
||||
if (!last_path)
|
||||
return grub_errno;
|
||||
last_handle = handle;
|
||||
grub_dprintf ("arcdisk", "opened %s\n", name);
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_arcdisk_open (const char *name, grub_disk_t disk)
|
||||
{
|
||||
char *fullname, *optr;
|
||||
const char *iptr;
|
||||
int state = 0;
|
||||
grub_err_t err;
|
||||
grub_arc_err_t r;
|
||||
struct grub_arc_fileinfo info;
|
||||
struct arcdisk_hash_ent *hash;
|
||||
|
||||
if (grub_memcmp (name, "arc/", 4) != 0)
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "not arc device");
|
||||
fullname = grub_malloc (2 * grub_strlen (name) + sizeof (RAW_SUFFIX));
|
||||
if (!fullname)
|
||||
return grub_errno;
|
||||
optr = fullname;
|
||||
for (iptr = name + 4; *iptr; iptr++)
|
||||
if (state == 0)
|
||||
{
|
||||
if (!grub_isdigit (*iptr))
|
||||
*optr++ = *iptr;
|
||||
else
|
||||
{
|
||||
*optr++ = '(';
|
||||
*optr++ = *iptr;
|
||||
state = 1;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (grub_isdigit (*iptr))
|
||||
*optr++ = *iptr;
|
||||
else
|
||||
{
|
||||
*optr++ = ')';
|
||||
state = 0;
|
||||
}
|
||||
}
|
||||
if (state)
|
||||
*optr++ = ')';
|
||||
grub_memcpy (optr, RAW_SUFFIX, sizeof (RAW_SUFFIX));
|
||||
disk->data = fullname;
|
||||
grub_dprintf ("arcdisk", "opening %s\n", fullname);
|
||||
|
||||
hash = arcdisk_hash_find (fullname);
|
||||
if (!hash)
|
||||
hash = arcdisk_hash_add (fullname);
|
||||
if (!hash)
|
||||
return grub_errno;
|
||||
|
||||
err = reopen (fullname);
|
||||
if (err)
|
||||
return err;
|
||||
|
||||
r = GRUB_ARC_FIRMWARE_VECTOR->getfileinformation (last_handle, &info);
|
||||
if (r)
|
||||
{
|
||||
grub_uint64_t res = 0;
|
||||
int i;
|
||||
|
||||
grub_dprintf ("arcdisk", "couldn't retrieve size: %ld\n", r);
|
||||
for (i = 40; i >= 9; i--)
|
||||
{
|
||||
grub_uint64_t pos = res | (1ULL << i);
|
||||
char buf[512];
|
||||
long unsigned count = 0;
|
||||
grub_dprintf ("arcdisk",
|
||||
"seek to 0x%" PRIxGRUB_UINT64_T "\n", pos);
|
||||
if (GRUB_ARC_FIRMWARE_VECTOR->seek (last_handle, &pos, 0))
|
||||
continue;
|
||||
if (GRUB_ARC_FIRMWARE_VECTOR->read (last_handle, buf,
|
||||
0x200, &count))
|
||||
continue;
|
||||
if (count == 0)
|
||||
continue;
|
||||
res |= (1ULL << i);
|
||||
}
|
||||
grub_dprintf ("arcdisk",
|
||||
"determined disk size 0x%" PRIxGRUB_UINT64_T "\n", res);
|
||||
disk->total_sectors = (res + 0x200) >> 9;
|
||||
}
|
||||
else
|
||||
disk->total_sectors = (info.end >> 9);
|
||||
|
||||
disk->id = hash->num;
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static void
|
||||
grub_arcdisk_close (grub_disk_t disk)
|
||||
{
|
||||
grub_free (disk->data);
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_arcdisk_read (grub_disk_t disk, grub_disk_addr_t sector,
|
||||
grub_size_t size, char *buf)
|
||||
{
|
||||
grub_err_t err;
|
||||
grub_uint64_t pos = sector << 9;
|
||||
unsigned long count;
|
||||
grub_uint64_t totl = size << 9;
|
||||
grub_arc_err_t r;
|
||||
|
||||
err = reopen (disk->data);
|
||||
if (err)
|
||||
return err;
|
||||
r = GRUB_ARC_FIRMWARE_VECTOR->seek (last_handle, &pos, 0);
|
||||
if (r)
|
||||
{
|
||||
grub_dprintf ("arcdisk", "seek to 0x%" PRIxGRUB_UINT64_T " failed: %ld\n",
|
||||
pos, r);
|
||||
return grub_error (GRUB_ERR_IO, "couldn't seek");
|
||||
}
|
||||
|
||||
while (totl)
|
||||
{
|
||||
if (GRUB_ARC_FIRMWARE_VECTOR->read (last_handle, buf,
|
||||
totl, &count))
|
||||
return grub_error (GRUB_ERR_READ_ERROR, "read failed");
|
||||
totl -= count;
|
||||
buf += count;
|
||||
}
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_arcdisk_write (grub_disk_t disk __attribute ((unused)),
|
||||
grub_disk_addr_t sector __attribute ((unused)),
|
||||
grub_size_t size __attribute ((unused)),
|
||||
const char *buf __attribute ((unused)))
|
||||
{
|
||||
return GRUB_ERR_NOT_IMPLEMENTED_YET;
|
||||
}
|
||||
|
||||
static struct grub_disk_dev grub_arcdisk_dev =
|
||||
{
|
||||
.name = "arcdisk",
|
||||
.id = GRUB_DISK_DEVICE_ARCDISK_ID,
|
||||
.iterate = grub_arcdisk_iterate,
|
||||
.open = grub_arcdisk_open,
|
||||
.close = grub_arcdisk_close,
|
||||
.read = grub_arcdisk_read,
|
||||
.write = grub_arcdisk_write,
|
||||
.next = 0
|
||||
};
|
||||
|
||||
void
|
||||
grub_arcdisk_init (void)
|
||||
{
|
||||
grub_disk_dev_register (&grub_arcdisk_dev);
|
||||
}
|
||||
|
||||
void
|
||||
grub_arcdisk_fini (void)
|
||||
{
|
||||
if (last_path)
|
||||
{
|
||||
GRUB_ARC_FIRMWARE_VECTOR->close (last_handle);
|
||||
grub_free (last_path);
|
||||
last_path = NULL;
|
||||
last_handle = 0;
|
||||
}
|
||||
|
||||
grub_disk_dev_unregister (&grub_arcdisk_dev);
|
||||
}
|
|
@ -22,9 +22,15 @@
|
|||
#include <grub/disk.h>
|
||||
#include <grub/mm.h>
|
||||
#include <grub/time.h>
|
||||
#ifndef GRUB_MACHINE_MIPS_QEMU_MIPS
|
||||
#include <grub/pci.h>
|
||||
#include <grub/scsi.h>
|
||||
#include <grub/cs5536.h>
|
||||
#else
|
||||
#define GRUB_MACHINE_PCI_IO_BASE 0xb4000000
|
||||
#endif
|
||||
#include <grub/scsi.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
/* At the moment, only two IDE ports are supported. */
|
||||
static const grub_port_t grub_ata_ioaddress[] = { GRUB_ATA_CH0_PORT1,
|
||||
|
@ -158,18 +164,23 @@ grub_atapi_identify (struct grub_ata_device *dev)
|
|||
|
||||
grub_ata_regset (dev, GRUB_ATA_REG_DISK, 0xE0 | dev->device << 4);
|
||||
grub_ata_wait ();
|
||||
if (grub_ata_check_ready (dev))
|
||||
if ((grub_ata_regget (dev, GRUB_ATA_REG_STATUS) & GRUB_ATA_STATUS_BUSY)
|
||||
&& grub_ata_wait_not_busy (dev, dev->present ? GRUB_ATA_TOUT_DEV_INIT
|
||||
: GRUB_ATA_TOUT_STD))
|
||||
{
|
||||
grub_free (info);
|
||||
dev->present = 0;
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
grub_ata_regset (dev, GRUB_ATA_REG_CMD, GRUB_ATA_CMD_IDENTIFY_PACKET_DEVICE);
|
||||
grub_ata_wait ();
|
||||
|
||||
if (grub_ata_wait_drq (dev, 0, GRUB_ATA_TOUT_STD))
|
||||
if (grub_ata_wait_drq (dev, 0, dev->present ? GRUB_ATA_TOUT_DEV_INIT
|
||||
: GRUB_ATA_TOUT_STD))
|
||||
{
|
||||
grub_free (info);
|
||||
dev->present = 0;
|
||||
return grub_errno;
|
||||
}
|
||||
grub_ata_pio_read (dev, info, GRUB_DISK_SECTOR_SIZE);
|
||||
|
@ -256,8 +267,11 @@ grub_ata_identify (struct grub_ata_device *dev)
|
|||
|
||||
grub_ata_regset (dev, GRUB_ATA_REG_DISK, 0xE0 | dev->device << 4);
|
||||
grub_ata_wait ();
|
||||
if (grub_ata_check_ready (dev))
|
||||
if ((grub_ata_regget (dev, GRUB_ATA_REG_STATUS) & GRUB_ATA_STATUS_BUSY)
|
||||
&& grub_ata_wait_not_busy (dev, dev->present ? GRUB_ATA_TOUT_DEV_INIT
|
||||
: GRUB_ATA_TOUT_STD))
|
||||
{
|
||||
dev->present = 0;
|
||||
grub_free (info);
|
||||
return grub_errno;
|
||||
}
|
||||
|
@ -265,7 +279,8 @@ grub_ata_identify (struct grub_ata_device *dev)
|
|||
grub_ata_regset (dev, GRUB_ATA_REG_CMD, GRUB_ATA_CMD_IDENTIFY_DEVICE);
|
||||
grub_ata_wait ();
|
||||
|
||||
if (grub_ata_wait_drq (dev, 0, GRUB_ATA_TOUT_STD))
|
||||
if (grub_ata_wait_drq (dev, 0, dev->present ? GRUB_ATA_TOUT_DEV_INIT
|
||||
: GRUB_ATA_TOUT_STD))
|
||||
{
|
||||
grub_free (info);
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
|
@ -278,13 +293,18 @@ grub_ata_identify (struct grub_ata_device *dev)
|
|||
return grub_atapi_identify (dev);
|
||||
|
||||
else if (sts == 0x00)
|
||||
/* No device, return error but don't print message. */
|
||||
return GRUB_ERR_UNKNOWN_DEVICE;
|
||||
|
||||
{
|
||||
dev->present = 0;
|
||||
/* No device, return error but don't print message. */
|
||||
return GRUB_ERR_UNKNOWN_DEVICE;
|
||||
}
|
||||
else
|
||||
/* Other Error. */
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
|
||||
"device cannot be identified");
|
||||
{
|
||||
dev->present = 0;
|
||||
/* Other Error. */
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
|
||||
"device cannot be identified");
|
||||
}
|
||||
}
|
||||
|
||||
grub_ata_pio_read (dev, info, GRUB_DISK_SECTOR_SIZE);
|
||||
|
@ -379,6 +399,7 @@ grub_ata_device_initialize (int port, int device, int addr, int addr2)
|
|||
dev->device = device;
|
||||
dev->ioaddress = addr + GRUB_MACHINE_PCI_IO_BASE;
|
||||
dev->ioaddress2 = addr2 + GRUB_MACHINE_PCI_IO_BASE;
|
||||
dev->present = 1;
|
||||
dev->next = NULL;
|
||||
|
||||
/* Register the device. */
|
||||
|
@ -392,6 +413,7 @@ grub_ata_device_initialize (int port, int device, int addr, int addr2)
|
|||
return 0;
|
||||
}
|
||||
|
||||
#ifndef GRUB_MACHINE_MIPS_QEMU_MIPS
|
||||
static int NESTED_FUNC_ATTR
|
||||
grub_ata_pciinit (grub_pci_device_t dev,
|
||||
grub_pci_id_t pciid)
|
||||
|
@ -507,6 +529,21 @@ grub_ata_initialize (void)
|
|||
grub_pci_iterate (grub_ata_pciinit);
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
static grub_err_t
|
||||
grub_ata_initialize (void)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < 2; i++)
|
||||
{
|
||||
grub_ata_device_initialize (i, 0, grub_ata_ioaddress[i],
|
||||
grub_ata_ioaddress2[i]);
|
||||
grub_ata_device_initialize (i, 1, grub_ata_ioaddress[i],
|
||||
grub_ata_ioaddress2[i]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
static void
|
||||
grub_ata_setlba (struct grub_ata_device *dev, grub_disk_addr_t sector,
|
||||
|
|
|
@ -22,6 +22,7 @@
|
|||
#include <grub/dl.h>
|
||||
#include <grub/mm.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
/* ATA pass through support, used by hdparm.mod. */
|
||||
static grub_err_t
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/raid.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
#define NV_SIGNATURES 4
|
||||
|
||||
#define NV_IDLE 0
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include <grub/err.h>
|
||||
#include <grub/term.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static int cd_drive = 0;
|
||||
static int grub_biosdisk_rw_int13_extensions (int ah, int drive, void *dap);
|
||||
|
||||
|
@ -513,7 +515,7 @@ static grub_size_t
|
|||
get_safe_sectors (grub_disk_t disk, grub_disk_addr_t sector)
|
||||
{
|
||||
grub_size_t size;
|
||||
grub_uint32_t offset;
|
||||
grub_uint64_t offset;
|
||||
struct grub_biosdisk_data *data = disk->data;
|
||||
grub_uint32_t sectors = data->sectors;
|
||||
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#include <grub/dl.h>
|
||||
#include <grub/ieee1275/ieee1275.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
struct grub_nand_data
|
||||
{
|
||||
grub_ieee1275_ihandle_t handle;
|
||||
|
|
|
@ -25,6 +25,8 @@
|
|||
#include <grub/extcmd.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
struct grub_loopback
|
||||
{
|
||||
char *devname;
|
||||
|
@ -97,10 +99,6 @@ grub_cmd_loopback (grub_extcmd_context_t ctxt, int argc, char **args)
|
|||
|
||||
if (newdev)
|
||||
{
|
||||
char *newname = grub_strdup (args[1]);
|
||||
if (! newname)
|
||||
goto fail;
|
||||
|
||||
grub_file_close (newdev->file);
|
||||
newdev->file = file;
|
||||
|
||||
|
@ -166,7 +164,7 @@ grub_loopback_open (const char *name, grub_disk_t disk)
|
|||
disk->total_sectors = GRUB_DISK_SIZE_UNKNOWN;
|
||||
disk->id = (unsigned long) dev;
|
||||
|
||||
disk->data = dev->file;
|
||||
disk->data = dev;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -175,7 +173,7 @@ static grub_err_t
|
|||
grub_loopback_read (grub_disk_t disk, grub_disk_addr_t sector,
|
||||
grub_size_t size, char *buf)
|
||||
{
|
||||
grub_file_t file = (grub_file_t) disk->data;
|
||||
grub_file_t file = ((struct grub_loopback *) disk->data)->file;
|
||||
grub_off_t pos;
|
||||
|
||||
grub_file_seek (file, sector << GRUB_DISK_SECTOR_BITS);
|
||||
|
@ -222,7 +220,7 @@ static grub_extcmd_t cmd;
|
|||
GRUB_MOD_INIT(loopback)
|
||||
{
|
||||
cmd = grub_register_extcmd ("loopback", grub_cmd_loopback, 0,
|
||||
N_("[-d|-p] DEVICENAME FILE."),
|
||||
N_("[-d] DEVICENAME FILE."),
|
||||
N_("Make a device of a file."), options);
|
||||
grub_disk_dev_register (&grub_loopback_dev);
|
||||
}
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include <grub/emu/misc.h>
|
||||
#endif
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static struct grub_lvm_vg *vg_list;
|
||||
static int lv_count;
|
||||
|
||||
|
@ -45,6 +47,7 @@ grub_lvm_getvalue (char **p, char *str)
|
|||
return grub_strtoul (*p, NULL, 10);
|
||||
}
|
||||
|
||||
#if 0
|
||||
static int
|
||||
grub_lvm_checkvalue (char **p, char *str, char *tmpl)
|
||||
{
|
||||
|
@ -57,6 +60,7 @@ grub_lvm_checkvalue (char **p, char *str, char *tmpl)
|
|||
return 0;
|
||||
return (grub_memcmp (*p + 1, tmpl, tmpllen) == 0 && (*p)[tmpllen + 1] == '"');
|
||||
}
|
||||
#endif
|
||||
|
||||
static int
|
||||
grub_lvm_check_flag (char *p, char *str, char *flag)
|
||||
|
@ -100,7 +104,7 @@ grub_lvm_iterate (int (*hook) (const char *name))
|
|||
struct grub_lvm_lv *lv;
|
||||
if (vg->lvs)
|
||||
for (lv = vg->lvs; lv; lv = lv->next)
|
||||
if (hook (lv->name))
|
||||
if (lv->visible && hook (lv->name))
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -164,18 +168,45 @@ grub_lvm_close (grub_disk_t disk __attribute ((unused)))
|
|||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_lvm_read (grub_disk_t disk, grub_disk_addr_t sector,
|
||||
grub_size_t size, char *buf)
|
||||
read_lv (struct grub_lvm_lv *lv, grub_disk_addr_t sector,
|
||||
grub_size_t size, char *buf);
|
||||
|
||||
static grub_err_t
|
||||
read_node (const struct grub_lvm_node *node, grub_disk_addr_t sector,
|
||||
grub_size_t size, char *buf)
|
||||
{
|
||||
/* Check whether we actually know the physical volume we want to
|
||||
read from. */
|
||||
if (node->pv)
|
||||
{
|
||||
if (node->pv->disk)
|
||||
return grub_disk_read (node->pv->disk, sector + node->pv->start, 0,
|
||||
size << GRUB_DISK_SECTOR_BITS, buf);
|
||||
else
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE,
|
||||
"physical volume %s not found", node->pv->name);
|
||||
|
||||
}
|
||||
if (node->lv)
|
||||
return read_lv (node->lv, sector, size, buf);
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "unknown node '%s'", node->name);
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
read_lv (struct grub_lvm_lv *lv, grub_disk_addr_t sector,
|
||||
grub_size_t size, char *buf)
|
||||
{
|
||||
grub_err_t err = 0;
|
||||
struct grub_lvm_lv *lv = disk->data;
|
||||
struct grub_lvm_vg *vg = lv->vg;
|
||||
struct grub_lvm_segment *seg = lv->segments;
|
||||
struct grub_lvm_pv *pv;
|
||||
struct grub_lvm_node *node;
|
||||
grub_uint64_t offset;
|
||||
grub_uint64_t extent;
|
||||
unsigned int i;
|
||||
|
||||
if (!lv)
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "unknown volume");
|
||||
|
||||
extent = grub_divmod64 (sector, vg->extent_size, NULL);
|
||||
|
||||
/* Find the right segment. */
|
||||
|
@ -190,59 +221,75 @@ grub_lvm_read (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
seg++;
|
||||
}
|
||||
|
||||
if (seg->stripe_count == 1)
|
||||
if (i == lv->segment_count)
|
||||
return grub_error (GRUB_ERR_READ_ERROR, "incorrect segment");
|
||||
|
||||
switch (seg->type)
|
||||
{
|
||||
/* This segment is linear, so that's easy. We just need to find
|
||||
out the offset in the physical volume and read SIZE bytes
|
||||
from that. */
|
||||
struct grub_lvm_stripe *stripe = seg->stripes;
|
||||
grub_uint64_t seg_offset; /* Offset of the segment in PV device. */
|
||||
case GRUB_LVM_STRIPED:
|
||||
if (seg->node_count == 1)
|
||||
{
|
||||
/* This segment is linear, so that's easy. We just need to find
|
||||
out the offset in the physical volume and read SIZE bytes
|
||||
from that. */
|
||||
struct grub_lvm_node *stripe = seg->nodes;
|
||||
grub_uint64_t seg_offset; /* Offset of the segment in PV device. */
|
||||
|
||||
pv = stripe->pv;
|
||||
seg_offset = ((grub_uint64_t) stripe->start
|
||||
* (grub_uint64_t) vg->extent_size) + pv->start;
|
||||
node = stripe;
|
||||
seg_offset = ((grub_uint64_t) stripe->start
|
||||
* (grub_uint64_t) vg->extent_size);
|
||||
|
||||
offset = sector - ((grub_uint64_t) seg->start_extent
|
||||
* (grub_uint64_t) vg->extent_size) + seg_offset;
|
||||
offset = sector - ((grub_uint64_t) seg->start_extent
|
||||
* (grub_uint64_t) vg->extent_size) + seg_offset;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This is a striped segment. We have to find the right PV
|
||||
similar to RAID0. */
|
||||
struct grub_lvm_node *stripe = seg->nodes;
|
||||
grub_uint64_t a, b;
|
||||
grub_uint64_t seg_offset; /* Offset of the segment in PV device. */
|
||||
grub_uint64_t stripenr;
|
||||
|
||||
offset = sector - ((grub_uint64_t) seg->start_extent
|
||||
* (grub_uint64_t) vg->extent_size);
|
||||
|
||||
a = grub_divmod64 (offset, seg->stripe_size, NULL);
|
||||
grub_divmod64 (a, seg->node_count, &stripenr);
|
||||
|
||||
a = grub_divmod64 (offset, seg->stripe_size * seg->node_count, NULL);
|
||||
grub_divmod64 (offset, seg->stripe_size, &b);
|
||||
offset = a * seg->stripe_size + b;
|
||||
|
||||
stripe += stripenr;
|
||||
node = stripe;
|
||||
|
||||
seg_offset = ((grub_uint64_t) stripe->start
|
||||
* (grub_uint64_t) vg->extent_size);
|
||||
|
||||
offset += seg_offset;
|
||||
}
|
||||
return read_node (node, offset, size, buf);
|
||||
case GRUB_LVM_MIRROR:
|
||||
i = 0;
|
||||
while (1)
|
||||
{
|
||||
err = read_node (&seg->nodes[i], sector, size, buf);
|
||||
if (!err)
|
||||
return err;
|
||||
if (++i >= seg->node_count)
|
||||
return err;
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/* This is a striped segment. We have to find the right PV
|
||||
similar to RAID0. */
|
||||
struct grub_lvm_stripe *stripe = seg->stripes;
|
||||
grub_uint32_t a, b;
|
||||
grub_uint64_t seg_offset; /* Offset of the segment in PV device. */
|
||||
unsigned int stripenr;
|
||||
return grub_error (GRUB_ERR_IO, "unknown LVM segment");
|
||||
}
|
||||
|
||||
offset = sector - ((grub_uint64_t) seg->start_extent
|
||||
* (grub_uint64_t) vg->extent_size);
|
||||
|
||||
a = grub_divmod64 (offset, seg->stripe_size, NULL);
|
||||
grub_divmod64 (a, seg->stripe_count, &stripenr);
|
||||
|
||||
a = grub_divmod64 (offset, seg->stripe_size * seg->stripe_count, NULL);
|
||||
grub_divmod64 (offset, seg->stripe_size, &b);
|
||||
offset = a * seg->stripe_size + b;
|
||||
|
||||
stripe += stripenr;
|
||||
pv = stripe->pv;
|
||||
|
||||
seg_offset = ((grub_uint64_t) stripe->start
|
||||
* (grub_uint64_t) vg->extent_size) + pv->start;
|
||||
|
||||
offset += seg_offset;
|
||||
}
|
||||
|
||||
/* Check whether we actually know the physical volume we want to
|
||||
read from. */
|
||||
if (pv->disk)
|
||||
err = grub_disk_read (pv->disk, offset, 0,
|
||||
size << GRUB_DISK_SECTOR_BITS, buf);
|
||||
else
|
||||
err = grub_error (GRUB_ERR_UNKNOWN_DEVICE,
|
||||
"physical volume %s not found", pv->name);
|
||||
|
||||
return err;
|
||||
static grub_err_t
|
||||
grub_lvm_read (grub_disk_t disk, grub_disk_addr_t sector,
|
||||
grub_size_t size, char *buf)
|
||||
{
|
||||
return read_lv (disk->data, sector, size, buf);
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
|
@ -303,7 +350,7 @@ grub_lvm_scan_device (const char *name)
|
|||
if (i == GRUB_LVM_LABEL_SCAN_SECTORS)
|
||||
{
|
||||
#ifdef GRUB_UTIL
|
||||
grub_util_info ("no LVM signature found\n");
|
||||
grub_util_info ("no LVM signature found");
|
||||
#endif
|
||||
goto fail;
|
||||
}
|
||||
|
@ -511,6 +558,7 @@ grub_lvm_scan_device (const char *name)
|
|||
int skip_lv = 0;
|
||||
struct grub_lvm_lv *lv;
|
||||
struct grub_lvm_segment *seg;
|
||||
int is_pvmove;
|
||||
|
||||
while (grub_isspace (*p))
|
||||
p++;
|
||||
|
@ -533,11 +581,8 @@ grub_lvm_scan_device (const char *name)
|
|||
|
||||
lv->size = 0;
|
||||
|
||||
if (!grub_lvm_check_flag (p, "status", "VISIBLE"))
|
||||
{
|
||||
skip_lv = 1;
|
||||
goto lv_parsed;
|
||||
}
|
||||
lv->visible = grub_lvm_check_flag (p, "status", "VISIBLE");
|
||||
is_pvmove = grub_lvm_check_flag (p, "status", "PVMOVE");
|
||||
|
||||
lv->segment_count = grub_lvm_getvalue (&p, "segment_count = ");
|
||||
if (p == NULL)
|
||||
|
@ -552,7 +597,6 @@ grub_lvm_scan_device (const char *name)
|
|||
|
||||
for (i = 0; i < lv->segment_count; i++)
|
||||
{
|
||||
struct grub_lvm_stripe *stripe;
|
||||
|
||||
p = grub_strstr (p, "segment");
|
||||
if (p == NULL)
|
||||
|
@ -580,90 +624,147 @@ grub_lvm_scan_device (const char *name)
|
|||
goto lvs_segment_fail;
|
||||
}
|
||||
|
||||
if (grub_lvm_checkvalue (&p, "type = ", "snapshot"))
|
||||
{
|
||||
/* Found a snapshot, give up and move on. */
|
||||
skip_lv = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
seg->stripe_count = grub_lvm_getvalue (&p, "stripe_count = ");
|
||||
p = grub_strstr (p, "type = \"");
|
||||
if (p == NULL)
|
||||
{
|
||||
#ifdef GRUB_UTIL
|
||||
grub_util_info ("unknown stripe_count\n");
|
||||
#endif
|
||||
goto lvs_segment_fail;
|
||||
}
|
||||
goto lvs_segment_fail;
|
||||
p += sizeof("type = \"") - 1;
|
||||
|
||||
lv->size += seg->extent_count * vg->extent_size;
|
||||
|
||||
if (seg->stripe_count != 1)
|
||||
seg->stripe_size = grub_lvm_getvalue (&p, "stripe_size = ");
|
||||
if (grub_memcmp (p, "striped\"",
|
||||
sizeof ("striped\"") - 1) == 0)
|
||||
{
|
||||
struct grub_lvm_node *stripe;
|
||||
|
||||
seg->stripes = grub_malloc (sizeof (*stripe)
|
||||
* seg->stripe_count);
|
||||
stripe = seg->stripes;
|
||||
seg->type = GRUB_LVM_STRIPED;
|
||||
seg->node_count = grub_lvm_getvalue (&p, "stripe_count = ");
|
||||
if (p == NULL)
|
||||
{
|
||||
#ifdef GRUB_UTIL
|
||||
grub_util_info ("unknown stripe_count\n");
|
||||
#endif
|
||||
goto lvs_segment_fail;
|
||||
}
|
||||
|
||||
p = grub_strstr (p, "stripes = [");
|
||||
if (p == NULL)
|
||||
if (seg->node_count != 1)
|
||||
seg->stripe_size = grub_lvm_getvalue (&p, "stripe_size = ");
|
||||
|
||||
seg->nodes = grub_zalloc (sizeof (*stripe)
|
||||
* seg->node_count);
|
||||
stripe = seg->nodes;
|
||||
|
||||
p = grub_strstr (p, "stripes = [");
|
||||
if (p == NULL)
|
||||
{
|
||||
#ifdef GRUB_UTIL
|
||||
grub_util_info ("unknown stripes\n");
|
||||
#endif
|
||||
goto lvs_segment_fail2;
|
||||
}
|
||||
p += sizeof("stripes = [") - 1;
|
||||
|
||||
for (j = 0; j < seg->node_count; j++)
|
||||
{
|
||||
p = grub_strchr (p, '"');
|
||||
if (p == NULL)
|
||||
continue;
|
||||
q = ++p;
|
||||
while (*q != '"')
|
||||
q++;
|
||||
|
||||
s = q - p;
|
||||
|
||||
stripe->name = grub_malloc (s + 1);
|
||||
if (stripe->name == NULL)
|
||||
goto lvs_segment_fail2;
|
||||
|
||||
grub_memcpy (stripe->name, p, s);
|
||||
stripe->name[s] = '\0';
|
||||
|
||||
stripe->start = grub_lvm_getvalue (&p, ",");
|
||||
if (p == NULL)
|
||||
continue;
|
||||
|
||||
stripe++;
|
||||
}
|
||||
}
|
||||
else if (grub_memcmp (p, "mirror\"", sizeof ("mirror\"") - 1)
|
||||
== 0)
|
||||
{
|
||||
seg->type = GRUB_LVM_MIRROR;
|
||||
seg->node_count = grub_lvm_getvalue (&p, "mirror_count = ");
|
||||
if (p == NULL)
|
||||
{
|
||||
#ifdef GRUB_UTIL
|
||||
grub_util_info ("unknown mirror_count\n");
|
||||
#endif
|
||||
goto lvs_segment_fail;
|
||||
}
|
||||
|
||||
seg->nodes = grub_zalloc (sizeof (seg->nodes[0])
|
||||
* seg->node_count);
|
||||
|
||||
p = grub_strstr (p, "mirrors = [");
|
||||
if (p == NULL)
|
||||
{
|
||||
#ifdef GRUB_UTIL
|
||||
grub_util_info ("unknown mirrors\n");
|
||||
#endif
|
||||
goto lvs_segment_fail2;
|
||||
}
|
||||
p += sizeof("mirrors = [") - 1;
|
||||
|
||||
for (j = 0; j < seg->node_count; j++)
|
||||
{
|
||||
char *lvname;
|
||||
|
||||
p = grub_strchr (p, '"');
|
||||
if (p == NULL)
|
||||
continue;
|
||||
q = ++p;
|
||||
while (*q != '"')
|
||||
q++;
|
||||
|
||||
s = q - p;
|
||||
|
||||
lvname = grub_malloc (s + 1);
|
||||
if (lvname == NULL)
|
||||
goto lvs_segment_fail2;
|
||||
|
||||
grub_memcpy (lvname, p, s);
|
||||
lvname[s] = '\0';
|
||||
seg->nodes[j].name = lvname;
|
||||
p = q + 1;
|
||||
}
|
||||
/* Only first (original) is ok with in progress pvmove. */
|
||||
if (is_pvmove)
|
||||
seg->node_count = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef GRUB_UTIL
|
||||
grub_util_info ("unknown stripes\n");
|
||||
char *p2;
|
||||
p2 = grub_strchr (p, '"');
|
||||
if (p2)
|
||||
*p2 = 0;
|
||||
grub_util_info ("unknown LVM type %s\n", p);
|
||||
if (p2)
|
||||
*p2 ='"';
|
||||
#endif
|
||||
goto lvs_segment_fail2;
|
||||
}
|
||||
p += sizeof("stripes = [") - 1;
|
||||
|
||||
for (j = 0; j < seg->stripe_count; j++)
|
||||
{
|
||||
char *pvname;
|
||||
|
||||
p = grub_strchr (p, '"');
|
||||
if (p == NULL)
|
||||
continue;
|
||||
q = ++p;
|
||||
while (*q != '"')
|
||||
q++;
|
||||
|
||||
s = q - p;
|
||||
|
||||
pvname = grub_malloc (s + 1);
|
||||
if (pvname == NULL)
|
||||
goto lvs_segment_fail2;
|
||||
|
||||
grub_memcpy (pvname, p, s);
|
||||
pvname[s] = '\0';
|
||||
|
||||
if (vg->pvs)
|
||||
for (pv = vg->pvs; pv; pv = pv->next)
|
||||
{
|
||||
if (! grub_strcmp (pvname, pv->name))
|
||||
{
|
||||
stripe->pv = pv;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
grub_free(pvname);
|
||||
|
||||
stripe->start = grub_lvm_getvalue (&p, ",");
|
||||
if (p == NULL)
|
||||
continue;
|
||||
|
||||
stripe++;
|
||||
/* Found a non-supported type, give up and move on. */
|
||||
skip_lv = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
seg++;
|
||||
|
||||
continue;
|
||||
lvs_segment_fail2:
|
||||
grub_free (seg->stripes);
|
||||
grub_free (seg->nodes);
|
||||
lvs_segment_fail:
|
||||
goto fail4;
|
||||
}
|
||||
|
||||
lv_parsed:
|
||||
if (p != NULL)
|
||||
p = grub_strchr (p, '}');
|
||||
if (p == NULL)
|
||||
|
@ -690,6 +791,33 @@ grub_lvm_scan_device (const char *name)
|
|||
}
|
||||
}
|
||||
|
||||
/* Match lvs. */
|
||||
{
|
||||
struct grub_lvm_lv *lv1;
|
||||
struct grub_lvm_lv *lv2;
|
||||
for (lv1 = vg->lvs; lv1; lv1 = lv1->next)
|
||||
for (i = 0; i < lv1->segment_count; i++)
|
||||
for (j = 0; j < lv1->segments[i].node_count; j++)
|
||||
{
|
||||
if (vg->pvs)
|
||||
for (pv = vg->pvs; pv; pv = pv->next)
|
||||
{
|
||||
if (! grub_strcmp (pv->name,
|
||||
lv1->segments[i].nodes[j].name))
|
||||
{
|
||||
lv1->segments[i].nodes[j].pv = pv;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (lv1->segments[i].nodes[j].pv == NULL)
|
||||
for (lv2 = vg->lvs; lv2; lv2 = lv2->next)
|
||||
if (grub_strcmp (lv2->name + grub_strlen (vg->name) + 1,
|
||||
lv1->segments[i].nodes[j].name) == 0)
|
||||
lv1->segments[i].nodes[j].lv = lv2;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
vg->next = vg_list;
|
||||
vg_list = vg;
|
||||
}
|
||||
|
@ -728,6 +856,7 @@ grub_lvm_scan_device (const char *name)
|
|||
grub_disk_close (disk);
|
||||
if (grub_errno == GRUB_ERR_OUT_OF_RANGE)
|
||||
grub_errno = GRUB_ERR_NONE;
|
||||
grub_print_error ();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/raid.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
/* Linux RAID on disk structures and constants,
|
||||
copied from include/linux/raid/md_p.h. */
|
||||
|
||||
|
@ -110,7 +112,6 @@ grub_mdraid_detect (grub_disk_t disk, struct grub_raid_array *array,
|
|||
struct grub_raid_super_1x sb;
|
||||
grub_uint8_t minor_version;
|
||||
|
||||
/* The sector where the mdraid 0.90 superblock is stored, if available. */
|
||||
size = grub_disk_get_size (disk);
|
||||
|
||||
/* Check for an 1.x superblock.
|
||||
|
@ -193,16 +194,22 @@ grub_mdraid_detect (grub_disk_t disk, struct grub_raid_array *array,
|
|||
array->level = grub_le_to_cpu32 (real_sb->level);
|
||||
array->layout = grub_le_to_cpu32 (real_sb->layout);
|
||||
array->total_devs = grub_le_to_cpu32 (real_sb->raid_disks);
|
||||
array->disk_size = grub_le_to_cpu64 (real_sb->size);
|
||||
if (real_sb->size)
|
||||
array->disk_size = grub_le_to_cpu64 (real_sb->size);
|
||||
else
|
||||
array->disk_size = grub_le_to_cpu64 (real_sb->data_size);
|
||||
array->chunk_size = grub_le_to_cpu32 (real_sb->chunksize);
|
||||
|
||||
if (grub_le_to_cpu32 (real_sb->dev_number) >=
|
||||
grub_le_to_cpu32 (real_sb->max_dev))
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
"spares aren't implemented");
|
||||
|
||||
array->index = grub_le_to_cpu16
|
||||
(real_sb->dev_roles[grub_le_to_cpu32 (real_sb->dev_number)]);
|
||||
if (array->index >= array->total_devs)
|
||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
"spares aren't implemented");
|
||||
array->uuid_len = 16;
|
||||
array->uuid = grub_malloc (16);
|
||||
if (!array->uuid)
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
/* Linux RAID on disk structures and constants,
|
||||
copied from include/linux/raid/md_p.h. */
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
#define RESERVED_BYTES (64 * 1024)
|
||||
#define RESERVED_SECTORS (RESERVED_BYTES / 512)
|
||||
|
||||
|
@ -202,7 +204,7 @@ grub_mdraid_detect (grub_disk_t disk, struct grub_raid_array *array,
|
|||
"unsupported RAID level: %d", level);
|
||||
if (grub_le_to_cpu32 (sb.this_disk.number) == 0xffff
|
||||
|| grub_le_to_cpu32 (sb.this_disk.number) == 0xfffe)
|
||||
return grub_error (GRUB_ERR_NOT_IMPLEMENTED_YET,
|
||||
return grub_error (GRUB_ERR_OUT_OF_RANGE,
|
||||
"spares aren't implemented");
|
||||
|
||||
array->name = NULL;
|
||||
|
@ -219,10 +221,10 @@ grub_mdraid_detect (grub_disk_t disk, struct grub_raid_array *array,
|
|||
return grub_errno;
|
||||
|
||||
uuid = (grub_uint32_t *) array->uuid;
|
||||
uuid[0] = sb.set_uuid0;
|
||||
uuid[1] = sb.set_uuid1;
|
||||
uuid[2] = sb.set_uuid2;
|
||||
uuid[3] = sb.set_uuid3;
|
||||
uuid[0] = grub_swap_bytes32 (sb.set_uuid0);
|
||||
uuid[1] = grub_swap_bytes32 (sb.set_uuid1);
|
||||
uuid[2] = grub_swap_bytes32 (sb.set_uuid2);
|
||||
uuid[3] = grub_swap_bytes32 (sb.set_uuid3);
|
||||
|
||||
*start_sector = 0;
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include <grub/mm.h>
|
||||
#include <grub/types.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static char *memdisk_addr;
|
||||
static grub_off_t memdisk_size = 0;
|
||||
|
||||
|
|
|
@ -23,6 +23,11 @@
|
|||
#include <grub/err.h>
|
||||
#include <grub/misc.h>
|
||||
#include <grub/raid.h>
|
||||
#ifdef GRUB_UTIL
|
||||
#include <grub/util/misc.h>
|
||||
#endif
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
/* Linked list of RAID arrays. */
|
||||
static struct grub_raid_array *array_list;
|
||||
|
@ -117,18 +122,49 @@ grub_raid_getname (struct grub_disk *disk)
|
|||
}
|
||||
#endif
|
||||
|
||||
static inline int
|
||||
ascii2hex (char c)
|
||||
{
|
||||
if (c >= '0' && c <= '9')
|
||||
return c - '0';
|
||||
if (c >= 'a' && c <= 'f')
|
||||
return c - 'a' + 10;
|
||||
if (c >= 'A' && c <= 'F')
|
||||
return c - 'A' + 10;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static grub_err_t
|
||||
grub_raid_open (const char *name, grub_disk_t disk)
|
||||
{
|
||||
struct grub_raid_array *array;
|
||||
unsigned n;
|
||||
|
||||
for (array = array_list; array != NULL; array = array->next)
|
||||
if (grub_memcmp (name, "mduuid/", sizeof ("mduuid/") - 1) == 0)
|
||||
{
|
||||
if (!grub_strcmp (array->name, name))
|
||||
if (grub_is_array_readable (array))
|
||||
break;
|
||||
const char *uuidstr = name + sizeof ("mduuid/") - 1;
|
||||
grub_size_t uuid_len = grub_strlen (uuidstr) / 2;
|
||||
grub_uint8_t uuidbin[uuid_len];
|
||||
unsigned i;
|
||||
for (i = 0; i < uuid_len; i++)
|
||||
uuidbin[i] = ascii2hex (uuidstr[2 * i + 1])
|
||||
| (ascii2hex (uuidstr[2 * i]) << 4);
|
||||
|
||||
for (array = array_list; array != NULL; array = array->next)
|
||||
{
|
||||
if (uuid_len == (unsigned) array->uuid_len
|
||||
&& grub_memcmp (uuidbin, array->uuid, uuid_len) == 0)
|
||||
if (grub_is_array_readable (array))
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
for (array = array_list; array != NULL; array = array->next)
|
||||
{
|
||||
if (!grub_strcmp (array->name, name))
|
||||
if (grub_is_array_readable (array))
|
||||
break;
|
||||
}
|
||||
|
||||
if (!array)
|
||||
return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "unknown RAID device %s",
|
||||
|
@ -209,7 +245,7 @@ grub_raid_read (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
case 10:
|
||||
{
|
||||
grub_disk_addr_t read_sector, far_ofs;
|
||||
grub_uint32_t disknr, b, near, far, ofs;
|
||||
grub_uint64_t disknr, b, near, far, ofs;
|
||||
|
||||
read_sector = grub_divmod64 (sector, array->chunk_size, &b);
|
||||
far = ofs = near = 1;
|
||||
|
@ -315,7 +351,7 @@ grub_raid_read (grub_disk_t disk, grub_disk_addr_t sector,
|
|||
case 6:
|
||||
{
|
||||
grub_disk_addr_t read_sector;
|
||||
grub_uint32_t b, p, n, disknr, e;
|
||||
grub_uint64_t b, p, n, disknr, e;
|
||||
|
||||
/* n = 1 for level 4 and 5, 2 for level 6. */
|
||||
n = array->level / 3;
|
||||
|
@ -638,6 +674,10 @@ insert_array (grub_disk_t disk, struct grub_raid_array *new_array,
|
|||
|
||||
grub_dprintf ("raid", "Found array %s (%s)\n", array->name,
|
||||
scanner_name);
|
||||
#ifdef GRUB_UTIL
|
||||
grub_util_info ("Found array %s (%s)", array->name,
|
||||
scanner_name);
|
||||
#endif
|
||||
|
||||
/* Add our new array to the list. */
|
||||
array->next = array_list;
|
||||
|
@ -698,6 +738,10 @@ grub_raid_register (grub_raid_t raid)
|
|||
|
||||
grub_dprintf ("raid", "Scanning for %s RAID devices on disk %s\n",
|
||||
grub_raid_list->name, name);
|
||||
#ifdef GRUB_UTIL
|
||||
grub_util_info ("Scanning for %s RAID devices on disk %s",
|
||||
grub_raid_list->name, name);
|
||||
#endif
|
||||
|
||||
disk = grub_disk_open (name);
|
||||
if (!disk)
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/raid.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_err_t
|
||||
grub_raid5_recover (struct grub_raid_array *array, int disknr,
|
||||
char *buf, grub_disk_addr_t sector, int size)
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include <grub/misc.h>
|
||||
#include <grub/raid.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
static grub_uint8_t raid6_table1[256][256];
|
||||
static grub_uint8_t raid6_table2[256][256];
|
||||
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
#include <grub/scsicmd.h>
|
||||
#include <grub/time.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
|
||||
static grub_scsi_dev_t grub_scsi_dev_list;
|
||||
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
#include <grub/scsicmd.h>
|
||||
#include <grub/misc.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
#define GRUB_USBMS_DIRECTION_BIT 7
|
||||
|
||||
/* The USB Mass Storage Command Block Wrapper. */
|
||||
|
|
|
@ -32,6 +32,8 @@
|
|||
#include <grub/command.h>
|
||||
#include <grub/i18n.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
/* System table. Two version depending on mode */
|
||||
grub_efi_system_table32_t *grub_efiemu_system_table32 = 0;
|
||||
grub_efi_system_table64_t *grub_efiemu_system_table64 = 0;
|
||||
|
@ -191,7 +193,7 @@ grub_efiemu_load_file (const char *filename)
|
|||
|
||||
file = grub_file_open (filename);
|
||||
if (! file)
|
||||
return 0;
|
||||
return grub_errno;
|
||||
|
||||
err = grub_efiemu_mm_init ();
|
||||
if (err)
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
#include <grub/unicode.h>
|
||||
#include <grub/fontformat.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
#ifdef USE_ASCII_FAILBACK
|
||||
#include "ascii.h"
|
||||
#endif
|
||||
|
@ -314,10 +316,7 @@ load_font_index (grub_file_t file, grub_uint32_t sect_length, struct
|
|||
return 1;
|
||||
font->bmp_idx = grub_malloc (0x10000 * sizeof (grub_uint16_t));
|
||||
if (!font->bmp_idx)
|
||||
{
|
||||
grub_free (font->char_index);
|
||||
return 1;
|
||||
}
|
||||
return 1;
|
||||
grub_memset (font->bmp_idx, 0xff, 0x10000 * sizeof (grub_uint16_t));
|
||||
|
||||
|
||||
|
@ -492,7 +491,7 @@ grub_font_load (const char *filename)
|
|||
#endif
|
||||
|
||||
/* Allocate the font object. */
|
||||
font = (grub_font_t) grub_malloc (sizeof (struct grub_font));
|
||||
font = (grub_font_t) grub_zalloc (sizeof (struct grub_font));
|
||||
if (!font)
|
||||
goto fail;
|
||||
|
||||
|
@ -638,6 +637,11 @@ grub_font_load (const char *filename)
|
|||
return 0;
|
||||
|
||||
fail:
|
||||
if (file)
|
||||
grub_file_close (file);
|
||||
if (font)
|
||||
font->file = 0;
|
||||
|
||||
free_font (font);
|
||||
return 1;
|
||||
}
|
||||
|
@ -797,6 +801,7 @@ free_font (grub_font_t font)
|
|||
grub_free (font->name);
|
||||
grub_free (font->family);
|
||||
grub_free (font->char_index);
|
||||
grub_free (font->bmp_idx);
|
||||
grub_free (font);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,11 @@ loadfont_command (grub_command_t cmd __attribute__ ((unused)),
|
|||
|
||||
while (argc--)
|
||||
if (grub_font_load (*args++) != 0)
|
||||
return GRUB_ERR_BAD_FONT;
|
||||
{
|
||||
if (!grub_errno)
|
||||
return grub_error (GRUB_ERR_BAD_FONT, "invalid font");
|
||||
return grub_errno;
|
||||
}
|
||||
|
||||
return GRUB_ERR_NONE;
|
||||
}
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#include <grub/types.h>
|
||||
#include <grub/fshelp.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
/* The affs bootblock. */
|
||||
struct grub_affs_bblock
|
||||
{
|
||||
|
@ -50,12 +52,20 @@ struct grub_affs_rblock
|
|||
grub_uint32_t hashtable[1];
|
||||
} __attribute__ ((packed));
|
||||
|
||||
struct grub_affs_time
|
||||
{
|
||||
grub_int32_t day;
|
||||
grub_uint32_t min;
|
||||
grub_uint32_t hz;
|
||||
} __attribute__ ((packed));
|
||||
|
||||
/* The second part of a file header block. */
|
||||
struct grub_affs_file
|
||||
{
|
||||
grub_uint8_t unused1[12];
|
||||
grub_uint32_t size;
|
||||
grub_uint8_t unused2[104];
|
||||
grub_uint8_t unused2[92];
|
||||
struct grub_affs_time mtime;
|
||||
grub_uint8_t namelen;
|
||||
grub_uint8_t name[30];
|
||||
grub_uint8_t unused3[33];
|
||||
|
@ -85,9 +95,9 @@ struct grub_affs_file
|
|||
struct grub_fshelp_node
|
||||
{
|
||||
struct grub_affs_data *data;
|
||||
int block;
|
||||
int size;
|
||||
int parent;
|
||||
grub_disk_addr_t block;
|
||||
struct grub_fshelp_node *parent;
|
||||
struct grub_affs_file di;
|
||||
};
|
||||
|
||||
/* Information about a "mounted" affs filesystem. */
|
||||
|
@ -115,7 +125,7 @@ grub_affs_read_block (grub_fshelp_node_t node, grub_disk_addr_t fileblock)
|
|||
int block = node->block;
|
||||
struct grub_affs_file file;
|
||||
struct grub_affs_data *data = node->data;
|
||||
grub_uint32_t mod;
|
||||
grub_uint64_t mod;
|
||||
|
||||
/* Find the block that points to the fileblock we are looking up by
|
||||
following the chain until the right table is reached. */
|
||||
|
@ -154,7 +164,7 @@ grub_affs_read_file (grub_fshelp_node_t node,
|
|||
{
|
||||
return grub_fshelp_read_file (node->data->disk, node, read_hook,
|
||||
pos, len, buf, grub_affs_read_block,
|
||||
node->size, 0);
|
||||
grub_be_to_cpu32 (node->di.size), 0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -166,7 +176,6 @@ grub_affs_mount (grub_disk_t disk)
|
|||
struct grub_affs_rblock *rblock;
|
||||
|
||||
int checksum = 0;
|
||||
int checksumr = 0;
|
||||
int blocksize = 0;
|
||||
|
||||
data = grub_malloc (sizeof (struct grub_affs_data));
|
||||
|
@ -216,8 +225,6 @@ grub_affs_mount (grub_disk_t disk)
|
|||
/* The filesystem blocksize is not stored anywhere in the filesystem
|
||||
itself. One way to determine it is reading blocks for the
|
||||
rootblock until the checksum is correct. */
|
||||
checksumr = grub_be_to_cpu32 (rblock->checksum);
|
||||
rblock->checksum = 0;
|
||||
for (blocksize = 0; blocksize < 8; blocksize++)
|
||||
{
|
||||
grub_uint32_t *currblock = rootblock + GRUB_DISK_SECTOR_SIZE * blocksize;
|
||||
|
@ -226,10 +233,10 @@ grub_affs_mount (grub_disk_t disk)
|
|||
for (i = 0; i < GRUB_DISK_SECTOR_SIZE / sizeof (*currblock); i++)
|
||||
checksum += grub_be_to_cpu32 (currblock[i]);
|
||||
|
||||
if (checksumr == -checksum)
|
||||
if (checksum == 0)
|
||||
break;
|
||||
}
|
||||
if (-checksum != checksumr)
|
||||
if (checksum != 0)
|
||||
{
|
||||
grub_error (GRUB_ERR_BAD_FS, "AFFS blocksize couldn't be determined");
|
||||
goto fail;
|
||||
|
@ -241,6 +248,8 @@ grub_affs_mount (grub_disk_t disk)
|
|||
data->htsize = grub_be_to_cpu32 (rblock->htsize);
|
||||
data->diropen.data = data;
|
||||
data->diropen.block = grub_be_to_cpu32 (data->bblock.rootblock);
|
||||
data->diropen.parent = NULL;
|
||||
grub_memcpy (&data->diropen.di, rootblock, sizeof (data->diropen.di));
|
||||
|
||||
grub_free (rootblock);
|
||||
|
||||
|
@ -291,12 +300,15 @@ grub_affs_iterate_dir (grub_fshelp_node_t dir,
|
|||
struct grub_affs_data *data = dir->data;
|
||||
grub_uint32_t *hashtable;
|
||||
|
||||
auto int NESTED_FUNC_ATTR grub_affs_create_node (const char *name, int block,
|
||||
int size, int type);
|
||||
auto int NESTED_FUNC_ATTR grub_affs_create_node (const char *name,
|
||||
grub_disk_addr_t block,
|
||||
const struct grub_affs_file *fil);
|
||||
|
||||
int NESTED_FUNC_ATTR grub_affs_create_node (const char *name, int block,
|
||||
int size, int type)
|
||||
int NESTED_FUNC_ATTR grub_affs_create_node (const char *name,
|
||||
grub_disk_addr_t block,
|
||||
const struct grub_affs_file *fil)
|
||||
{
|
||||
int type;
|
||||
node = grub_malloc (sizeof (*node));
|
||||
if (!node)
|
||||
{
|
||||
|
@ -304,10 +316,19 @@ grub_affs_iterate_dir (grub_fshelp_node_t dir,
|
|||
return 1;
|
||||
}
|
||||
|
||||
if ((int) grub_be_to_cpu32 (fil->type) == GRUB_AFFS_FILETYPE_DIR)
|
||||
type = GRUB_FSHELP_REG;
|
||||
else if (grub_be_to_cpu32 (fil->type) == GRUB_AFFS_FILETYPE_REG)
|
||||
type = GRUB_FSHELP_DIR;
|
||||
else if (grub_be_to_cpu32 (fil->type) == GRUB_AFFS_FILETYPE_SYMLINK)
|
||||
type = GRUB_FSHELP_SYMLINK;
|
||||
else
|
||||
type = GRUB_FSHELP_UNKNOWN;
|
||||
|
||||
node->data = data;
|
||||
node->size = size;
|
||||
node->block = block;
|
||||
node->parent = grub_be_to_cpu32 (file.parent);
|
||||
node->di = *fil;
|
||||
node->parent = dir;
|
||||
|
||||
if (hook (name, type, node))
|
||||
{
|
||||
|
@ -317,6 +338,24 @@ grub_affs_iterate_dir (grub_fshelp_node_t dir,
|
|||
return 0;
|
||||
}
|
||||
|
||||
/* Create the directory entries for `.' and `..'. */
|
||||
node = grub_malloc (sizeof (*node));
|
||||
if (!node)
|
||||
return 1;
|
||||
|
||||
*node = *dir;
|
||||
if (hook (".", GRUB_FSHELP_DIR, node))
|
||||
return 1;
|
||||
if (dir->parent)
|
||||
{
|
||||
node = grub_malloc (sizeof (*node));
|
||||
if (!node)
|
||||
return 1;
|
||||
*node = *dir->parent;
|
||||
if (hook ("..", GRUB_FSHELP_DIR, node))
|
||||
return 1;
|
||||
}
|
||||
|
||||
hashtable = grub_malloc (data->htsize * sizeof (*hashtable));
|
||||
if (!hashtable)
|
||||
return 1;
|
||||
|
@ -326,16 +365,8 @@ grub_affs_iterate_dir (grub_fshelp_node_t dir,
|
|||
if (grub_errno)
|
||||
goto fail;
|
||||
|
||||
/* Create the directory entries for `.' and `..'. */
|
||||
if (grub_affs_create_node (".", dir->block, dir->size, GRUB_FSHELP_DIR))
|
||||
return 1;
|
||||
if (grub_affs_create_node ("..", dir->parent ? dir->parent : dir->block,
|
||||
dir->size, GRUB_FSHELP_DIR))
|
||||
return 1;
|
||||
|
||||
for (i = 0; i < data->htsize; i++)
|
||||
{
|
||||
enum grub_fshelp_filetype type;
|
||||
grub_uint64_t next;
|
||||
|
||||
if (!hashtable[i])
|
||||
|
@ -356,17 +387,7 @@ grub_affs_iterate_dir (grub_fshelp_node_t dir,
|
|||
|
||||
file.name[file.namelen] = '\0';
|
||||
|
||||
if ((int) grub_be_to_cpu32 (file.type) == GRUB_AFFS_FILETYPE_DIR)
|
||||
type = GRUB_FSHELP_REG;
|
||||
else if (grub_be_to_cpu32 (file.type) == GRUB_AFFS_FILETYPE_REG)
|
||||
type = GRUB_FSHELP_DIR;
|
||||
else if (grub_be_to_cpu32 (file.type) == GRUB_AFFS_FILETYPE_SYMLINK)
|
||||
type = GRUB_FSHELP_SYMLINK;
|
||||
else
|
||||
type = GRUB_FSHELP_UNKNOWN;
|
||||
|
||||
if (grub_affs_create_node ((char *) (file.name), next,
|
||||
grub_be_to_cpu32 (file.size), type))
|
||||
if (grub_affs_create_node ((char *) (file.name), next, &file))
|
||||
return 1;
|
||||
|
||||
next = grub_be_to_cpu32 (file.next);
|
||||
|
@ -401,7 +422,7 @@ grub_affs_open (struct grub_file *file, const char *name)
|
|||
if (grub_errno)
|
||||
goto fail;
|
||||
|
||||
file->size = fdiro->size;
|
||||
file->size = grub_be_to_cpu32 (fdiro->di.size);
|
||||
data->diropen = *fdiro;
|
||||
grub_free (fdiro);
|
||||
|
||||
|
@ -465,6 +486,11 @@ grub_affs_dir (grub_device_t device, const char *path,
|
|||
struct grub_dirhook_info info;
|
||||
grub_memset (&info, 0, sizeof (info));
|
||||
info.dir = ((filetype & GRUB_FSHELP_TYPE_MASK) == GRUB_FSHELP_DIR);
|
||||
info.mtimeset = 1;
|
||||
info.mtime = grub_be_to_cpu32 (node->di.mtime.day) * 86400
|
||||
+ grub_be_to_cpu32 (node->di.mtime.min) * 60
|
||||
+ grub_be_to_cpu32 (node->di.mtime.hz) / 50
|
||||
+ 8 * 365 * 86400 + 86400 * 2;
|
||||
grub_free (node);
|
||||
return hook (filename, &info);
|
||||
}
|
||||
|
|
|
@ -26,6 +26,8 @@
|
|||
#include <grub/types.h>
|
||||
#include <grub/fshelp.h>
|
||||
|
||||
GRUB_MOD_LICENSE ("GPLv3+");
|
||||
|
||||
#ifdef MODE_BIGENDIAN
|
||||
#define GRUB_AFS_FSNAME_SUFFIX "_be"
|
||||
#else
|
||||
|
|
1428
grub-core/fs/btrfs.c
1428
grub-core/fs/btrfs.c
File diff suppressed because it is too large
Load diff
Some files were not shown because too many files have changed in this diff Show more
Loading…
Add table
Add a link
Reference in a new issue