Commit graph

293 commits

Author SHA1 Message Date
Vladimir 'phcoder' Serbinenko
36dd20ad0b * grub-core/kern/main.c (grub_set_prefix_and_root): Init prefix. 2011-10-19 20:30:06 +02:00
Vladimir 'phcoder' Serbinenko
f8f72eb890 * grub-core/kern/ieee1275/openfw.c (grub_ieee1275_encode_devname):
Don't add the bogus brackets.
2011-10-19 20:28:09 +02:00
Vladimir 'phcoder' Serbinenko
544c24876e Move grub_reboot out of the kernel.
* grub-core/Makefile.core.def (reboot): Add platform-specific files.
	* grub-core/kern/efi/efi.c (grub_reboot): Moved to ...
	* grub-core/lib/efi/reboot.c: ... here.
	* grub-core/kern/i386/efi/startup.S: Remove including of realmode.S.
	* grub-core/kern/i386/ieee1275/startup.S: Likewise.
	* grub-core/kern/i386/pc/startup.S (grub_exit): Inline cold_reboot.
	* grub-core/kern/i386/realmode.S (grub_reboot): Moved to...
	* grub-core/lib/i386/reboot_trampoline.S: ... here.
	* grub-core/kern/ieee1275/openfw.c (grub_reboot): Moved to...
	* grub-core/lib/ieee1275/reboot.c: ... here.
	* grub-core/kern/mips/arc/init.c (grub_reboot): Moved to...
	* grub-core/lib/mips/arc/reboot.c: ... here.
	* grub-core/kern/mips/loongson/init.c (grub_reboot): Moved to...
	* grub-core/lib/mips/loongson/reboot.c: ...here.
	* grub-core/kern/mips/qemu_mips/init.c (grub_reboot): Moved to...
	* grub-core/lib/mips/qemu_mips/reboot.c: ... here.
	* include/grub/emu/misc.h (grub_reboot): New function declaration.
	* include/grub/i386/reboot.h: New file.
	* include/grub/mips/loongson/ec.h: Fix includes.
	* include/grub/mips/qemu_mips/kernel.h (grub_reboot): Removed.
	* include/grub/misc.h (grub_reboot): Don't mark as kernel function.
	* grub-core/lib/i386/reboot.c: New file.
2011-10-19 16:53:18 +02:00
Vladimir 'phcoder' Serbinenko
a97501d238 Make grub_prefix into module to fix the arbitrary limit and save
some space.

	* grub-core/kern/emu/main.c (grub_prefix): Removed.
	* grub-core/kern/i386/coreboot/startup.S (grub_prefix): Likewise.
	* grub-core/kern/i386/efi/startup.S (grub_prefix): Likewise.
	* grub-core/kern/i386/ieee1275/startup.S (grub_prefix): Likewise.
	* grub-core/kern/i386/pc/startup.S (grub_prefix): Likewise.
	* grub-core/kern/i386/qemu/startup.S (grub_prefix): Likewise.
	* grub-core/kern/ia64/efi/startup.S (grub_prefix): Likewise.
	* grub-core/kern/mips/startup.S (grub_prefix): Likewise.
	* grub-core/kern/powerpc/ieee1275/startup.S (grub_prefix): Likewise.
	* grub-core/kern/sparc64/ieee1275/crt0.S (grub_prefix): Likewise.
	* grub-core/kern/x86_64/efi/startup.S (grub_prefix): Likewise.
	* include/grub/ia64/efi/kernel.h: Removed.
	* include/grub/kernel.h: New module type OBJ_TYPE_PREFIX.
	(grub_prefix): Removed.
	* include/grub/offsets.h (GRUB_KERNEL_I386_PC_PREFIX): Removed.
	(GRUB_KERNEL_I386_PC_PREFIX_END): Likewise.
	(GRUB_KERNEL_I386_QEMU_PREFIX): Likewise.
	(GRUB_KERNEL_I386_QEMU_PREFIX_END): Likewise.
	(GRUB_KERNEL_SPARC64_IEEE1275_PREFIX): Likewise.
	(GRUB_KERNEL_SPARC64_IEEE1275_PREFIX_END): Likewise.
	(GRUB_KERNEL_POWERPC_IEEE1275_PREFIX): Likewise.
	(GRUB_KERNEL_POWERPC_IEEE1275_PREFIX_END): Likewise.
	(GRUB_KERNEL_MIPS_LOONGSON_PREFIX): Likewise.
	(GRUB_KERNEL_MIPS_LOONGSON_PREFIX_END): Likewise.
	(GRUB_KERNEL_MIPS_QEMU_MIPS_PREFIX): Likewise.
	(GRUB_KERNEL_MIPS_QEMU_MIPS_PREFIX_END): Likewise.
	(GRUB_KERNEL_MIPS_ARC_PREFIX): Likewise.
	(GRUB_KERNEL_MIPS_ARC_PREFIX_END): Likewise.
	(GRUB_KERNEL_I386_EFI_PREFIX): Likewise.
	(GRUB_KERNEL_I386_EFI_PREFIX_END): Likewise.
	(GRUB_KERNEL_IA64_EFI_PREFIX): Likewise.
	(GRUB_KERNEL_IA64_EFI_PREFIX_END): Likewise.
	(GRUB_KERNEL_X86_64_EFI_PREFIX): Likewise.
	(GRUB_KERNEL_X86_64_EFI_PREFIX_END): Likewise.
	(GRUB_KERNEL_I386_COREBOOT_PREFIX): Likewise.
	(GRUB_KERNEL_I386_COREBOOT_PREFIX_END): Likewise.
	(GRUB_KERNEL_I386_MULTIBOOT_PREFIX): Likewise.
	(GRUB_KERNEL_I386_MULTIBOOT_PREFIX_END): Likewise.
	(GRUB_KERNEL_I386_IEEE1275_PREFIX): Likewise.
	(GRUB_KERNEL_I386_IEEE1275_PREFIX_END): Likewise.
	(GRUB_KERNEL_MACHINE_PREFIX): Likewise.
	(GRUB_KERNEL_MACHINE_PREFIX_END): Likewise.
	* grub-core/kern/main.c (grub_set_prefix_and_root): Retrieve grub_prefix
	from module.
	* util/grub-mkimage.c (image_target_desc): Removed prefix and
	prefix_end.
	(image_targets): Likewise.
	(generate_image): Put prefix as a module.
2011-10-18 15:21:51 +02:00
Vladimir 'phcoder' Serbinenko
39705fadd7 Replace grub_module_iterate with FOR_MODULES.
* grub-core/disk/memdisk.c (GRUB_MOD_INIT): Switched to new interface.
	* grub-core/kern/efi/efi.c (grub_arch_modules_addr): Renamed to...
	(grub_efi_modules_addr): ...this.
	* grub-core/kern/efi/init.c (grub_modbase): New variable.
	(grub_efi_init): Set grub_modbase.
	* grub-core/kern/emu/main.c (grub_arch_modules_addr): Removed.
	(grub_modbase): New variable.
	* grub-core/kern/i386/coreboot/init.c (grub_arch_modules_addr): Removed.
	(grub_modbase): New variable.
	(grub_machine_init): Set grub_modbase.
	* grub-core/kern/i386/pc/init.c (grub_arch_modules_addr): Removed.
	(grub_modbase): New variable.
	(grub_machine_init): Set grub_modbase.
	* grub-core/kern/ieee1275/init.c (grub_arch_modules_addr): Removed.
	(grub_modbase): New variable.
	(grub_machine_init): Set grub_modbase.
	* grub-core/kern/main.c (grub_module_iterate): Remove.
	(grub_modules_get_end): Use grub_modbase.
	(grub_load_modules): Use FOR_MODULES.
	(grub_load_config): Likewise.
	* grub-core/kern/mips/arc/init.c (grub_arch_modules_addr): Removed.
	(grub_modbase): New variable.
	(grub_machine_init): Set grub_modbase.
	* grub-core/kern/mips/loongson/init.c (grub_arch_modules_addr): Removed.
	(grub_modbase): New variable.
	(grub_machine_init): Set grub_modbase.
	* grub-core/kern/mips/qemu_mips/init.c (grub_arch_modules_addr):
	Removed.
	(grub_modbase): New variable.
	(grub_machine_init): Set grub_modbase.
	* include/grub/efi/efi.h (grub_efi_modules_addr): New declaration.
	* include/grub/kernel.h (grub_arch_modules_addr): Removed.
	(grub_module_iterate): Likewise.
	(grub_modbase): New variable declaration.
	(FOR_MODULES): New macro.
2011-10-16 15:23:29 +02:00
Vladimir 'phcoder' Serbinenko
c81296b65f * grub-core/kern/emu/hostdisk.c
(convert_system_partition_to_system_disk): Don't assume that children
	of mapper nodes are mapper nodes.
2011-10-14 19:20:44 +02:00
Mario Limonciello
c05de0329b * grub-core/kern/emu/misc.c (canonicalize_file_name) [__MINGW32__]: Use
_fullpath.
2011-09-29 10:36:55 +02:00
Vladimir 'phcoder' Serbinenko
6991503094 * grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_is_floppy):
Return 0 if disk isn't biosdisk.
2011-09-28 14:07:53 +02:00
Grégoire Sutre
1a7d7db97f Get sector size from disk label for NetBSD. 2011-09-17 23:01:48 +02:00
Vladimir 'phcoder' Serbinenko
ca51c4a04f * grub-core/kern/mips/loongson/init.c (grub_machine_init): Handle the
case of less than 256 MiB of RAM.
2011-08-23 11:20:56 +02:00
Vladimir 'phcoder' Serbinenko
f87abff538 * grub-core/kern/mips/loongson/init.c (grub_reboot): Reboot Fuloong.
* include/grub/cs5536.h (GRUB_CS5536_MSR_DIVIL_RESET): New definition.
2011-08-19 23:11:09 +02:00
Vladimir 'phcoder' Serbinenko
d94497eaca * grub-core/Makefile.core.def (kernel): Add video/radeon_fuloong2e.c on
loongson.
	* grub-core/kern/mips/loongson/init.c (grub_machine_init): Init
	video_radeon_fuloong2e.
	* grub-core/video/radeon_fuloong2e.c: New file.
	* include/grub/video.h (grub_video_id_t): Add new ID
	GRUB_VIDEO_DRIVER_RADEON_FULOONG2E.
2011-08-19 23:08:36 +02:00
Vladimir 'phcoder' Serbinenko
0d1fd0113b * include/grub/mips/loongson.h (GRUB_CPU_LOONGSON_COP0_PRID): New
define.
	* grub-core/kern/mips/loongson/init.c (grub_machine_init): Check
	that PRID matches the detected subplatform and reset the subplatform
	if it doesn't.
2011-08-19 23:04:18 +02:00
Vladimir 'phcoder' Serbinenko
84beb0eeb9 * grub-core/kern/misc.c (grub_vprintf): Fix a bug on malloc failure. 2011-08-19 22:59:24 +02:00
Vladimir 'phcoder' Serbinenko
14a2562cf7 Rename Fuloong into Fuloong 2F. Add new ID for Fuloong2E.
* grub-core/Makefile.core.def (fwstart_fuloong): Rename fwstart_fuloong
	into fwstart_fuloong2f. Use boot/mips/loongson/fuloong2f.S.
	* grub-core/boot/mips/loongson/fuloong.S: Rename to ...
	* grub-core/boot/mips/loongson/fuloong2f.S: ... this.
	(FULOONG): Rename to ...
	(FULOONG2F): ... this. All users updated.
	* grub-core/boot/mips/startup_raw.S (machtype_fuloong_str): Rename to
	(machtype_fuloong2f_str): ... this.
	(machtype_fuloong2e_str): New string.
	Check for machtype_fuloong2e_str.
	* grub-core/loader/mips/linux.c (loongson_machtypes)
	[GRUB_MACHINE_MIPS_LOONGSON]: Add GRUB_ARCH_MACHINE_FULOONG2E.
	* grub-core/term/serial.c (loongson_defserial)
	[GRUB_MACHINE_MIPS_LOONGSON]: New array.
	(grub_serial_register) [GRUB_MACHINE_MIPS_LOONGSON]: Use
	loongson_defserial.
	* include/grub/mips/loongson/kernel.h (GRUB_ARCH_MACHINE_FULOONG):
	Rename to ...
	(GRUB_ARCH_MACHINE_FULOONG2F): ... this.
	(GRUB_ARCH_MACHINE_FULOONG2E): New const.
	* util/grub-mkimage.c (image_target_desc): Rename IMAGE_FULOONG_FLASH
	to IMAGE_FULOONG2F_FLASH. All users updated.
	(image_targets): Rename images.
	* util/grub-mkstandalone.in: Accept fuloong2f and fuloong2e.
2011-08-19 22:46:11 +02:00
Szymon Janc
b526cbb6fa Make enable of disk cache statistics code configurable.
* configure.ac: --enable-cache-stats added.
* config.h.in (DISK_CACHE_STATS): New define.
* grub-core/Makefile.core.def (cacheinfo): New command.
* include/grub/disk.h(grub_disk_cache_get_performance): New function.
* grub-core/commands/cacheinfo.c: New file.
* grub-core/commands/minicmd.c (grub_rescue_cmd_info): Updated and
moved to cacheinfo.c.
* grub-core/kern/disk.c: Use DISK_CACHE_STATS to disable disk cache
debug code.
* include/grub/disk.h: Likewise.
2011-08-19 21:28:09 +02:00
Vladimir 'phcoder' Serbinenko
2bba8cfd55 * grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_iterate): Skip with
non-zero pull.
2011-08-16 23:12:20 +02:00
Szymon Janc
99cecb4fc7 merge trunk 2011-08-13 15:00:48 +02:00
Vladimir 'phcoder' Serbinenko
bf66054fb3 * grub-core/kern/mips/cache_flush.S [GRUB_MACHINE_MIPS_LOONGSON]: Flush
all four ways.
2011-07-23 16:44:40 +02:00
Vladimir 'phcoder' Serbinenko
2e418de646 Remove getroot.c from core on emu platform.
* grub-core/Makefile.core.def (kernel): Remove kern/emu/getroot.c and
	kern/emu/raid.c.
	* grub-core/kern/emu/main.c (main): Don't try to guess root device. It's
	useless.
	* grub-core/kern/emu/misc.c (get_win32_path): Moved from here...
	* util/getroot.c (get_win32_path): ... here.
	* grub-core/kern/emu/misc.c (fini_libzfs): Moved from here...
	* util/getroot.c (fini_libzfs): ... here.
	* grub-core/kern/emu/misc.c (grub_get_libzfs_handle): Moved from here...
	* util/getroot.c (grub_get_libzfs_handle): ... here.
	* grub-core/kern/emu/misc.c (grub_find_zpool_from_dir):
	Moved from here...
	* util/getroot.c (grub_find_zpool_from_dir): ... here.
	* grub-core/kern/emu/misc.c
	(grub_make_system_path_relative_to_its_root): Moved from here...
	* util/getroot.c (grub_make_system_path_relative_to_its_root): ... here.
	* grub-core/kern/emu/getroot.c: Moved from here ...
	* util/getroot.c: ... here. All users updated.
	* grub-core/kern/emu/raid.c: Moved from here ...
	* util/raid.c: ... here. All users updated.
2011-07-08 13:33:12 +02:00
Vladimir 'phcoder' Serbinenko
cd8fe79a59 Fix compilation on GNU/Linux.
* grub-core/kern/emu/getroot.c (grub_util_pull_device) [!FreeBSD]:
	Disable geli.
	(grub_util_get_grub_dev) [!FreeBSD]: Likewise.
	(grub_util_pull_device) [HAVE_DEVICE_MAPPER]: Fix const and func name.
	* grub-core/disk/cryptodisk.c (grub_cryptodisk_open): Fix proto.
2011-07-08 03:59:05 +02:00
Vladimir Serbinenko
a251b71915 LUKS and GELI support.
* Makefile.util.def (libgrubkern.a): Add grub-core/lib/crypto.c,
	grub-core/disk/luks.c, grub-core/disk/geli.c,
	grub-core/disk/cryptodisk.c, grub-core/disk/AFSplitter.c,
	grub-core/lib/pbkdf2.c, grub-core/commands/extcmd.c,
	grub-core/lib/arg.c.
	(libgrubmods.a): Remove gcrypts cflags and cppflags.
	Remove grub-core/commands/extcmd.c, grub-core/lib/arg.c,
	grub-core/lib/crypto.c, grub-core/lib/libgcrypt-grub/cipher/sha512.c,
	grub-core/lib/libgcrypt-grub/cipher/crc.c and grub-core/lib/pbkdf2.c.
	(grub-bin2h): Add libgcry.a.
	(grub-mkimage): Likewise.
	(grub-mkrelpath): Likewise.
	(grub-script-check): Likewise.
	(grub-editenv): Likewise.
	(grub-mkpasswd-pbkdf2): Likewise.
	(grub-pe2elf): Likewise.
	(grub-fstest): Likewise.
	(grub-mkfont): Likewise.
	(grub-mkdevicemap): Likewise.
	(grub-probe): Likewise.
	(grub-ofpath): Likewise.
	(grub-mklayout): Likewise.
	(example_unit_test): Likewise.
	(grub-menulst2cfg): Likewise.
	* autogen.sh (UTIL_DEFS): Add Makefile.utilgcry.def.
	* grub-core/Makefile.core.def (cryptodisk): New module.
	(luks): Likewise.
	(geli): Likewise.
	* grub-core/disk/AFSplitter.c: New file.
	* grub-core/disk/cryptodisk.c: Likewise.
	* grub-core/disk/geli.c: Likewise.
	* grub-core/disk/luks.c: Likewise.
	* grub-core/kern/emu/getroot.c (get_dm_uuid): New function based on
	grub_util_is_lvm.
	(grub_util_get_dm_abstraction): New function.
	(grub_util_follow_gpart_up): Likewise.
	(grub_util_get_geom_abstraction): Likewise.
	(grub_util_get_dev_abstraction): Use new functions.
	(grub_util_pull_device): Pull GELI and LUKS.
	(grub_util_get_grub_dev): Handle LUKS and GELI.
	* grub-core/kern/emu/hostdisk.c (grub_util_get_fd_sectors): New function.
	(grub_util_biosdisk_open): Use grub_util_get_fd_sectors.
	(follow_geom_up): Removed.
	(grub_util_fd_seek): New function.
	(open_device): Use grub_util_fd_seek.
	(nread): Rename to ..
	(grub_util_fd_read): ... this. All users updated.
	* grub-core/lib/crypto.c (grub_crypto_ecb_decrypt): A better prototype.
	(grub_crypto_cbc_decrypt): Likewise.
	(grub_crypto_hmac_write): Likewise.
	(grub_crypto_hmac_buffer): Likewise.
	(grub_password_get): Extend to util.
	* include/grub/crypto.h (gcry_cipher_spec) [GRUB_UTIL]:
	New member modname.
	(gcry_md_spec) [GRUB_UTIL]: Likewise.
	* include/grub/cryptodisk.h: New file.
	* include/grub/disk.h (grub_disk_dev_id): Rename LUKS to CRYPTODISK.
	* include/grub/emu/getroot.h (grub_dev_abstraction_types): Add
	LUKS and GELI.
	(grub_util_follow_gpart_up): New proto.
	* include/grub/emu/hostdisk.h (grub_util_fd_seek): Likewise.
	(grub_util_fd_read): Likewise.
	(grub_cryptodisk_cheat_mount): Likewise.
	(grub_util_cryptodisk_print_uuid): Likewise.
	(grub_util_get_fd_sectors): Likewise.
	* util/grub-fstest.c (mount_crypt): New var.
	(fstest): Mount crypto if requested.
	(options): New option -C.
	(argp_parser): Parse -C.
	(main): Init and fini gcry.
	* util/grub-install.in: Support cryptodisk install.
	* util/grub-mkconfig.in: Export GRUB_ENABLE_CRYPTODISK.
	* util/grub-mkconfig_lib.in (is_path_readable_by_grub): Support
	cryptodisk.
	(prepare_grub_to_access_device): Likewise.
	* util/grub-mkpasswd-pbkdf2.c (main): Use grub_password_get.
	* util/grub-probe.c (probe_partmap): Support cryptodisk UUID probe.
	(probe_cryptodisk_uuid): New function.
	(probe_abstraction): Likewise.
	(probe): Use new functions.
	* util/import_gcry.py: Create Makefile.utilgcry.def.
	Add modname member.

	Also-By: Michael Gorven <michael@gorven.za.net>

	Also-By: Clemens Fruhwirth <clemens@endorphin.org>
2011-07-07 23:52:58 +02:00
Vladimir 'phcoder' Serbinenko
0044d1db2e Simplify disk opening 2011-07-07 21:46:25 +02:00
Vladimir 'phcoder' Serbinenko
00542307eb merge mainline into lazy 2011-07-07 12:21:53 +02:00
Vladimir 'phcoder' Serbinenko
abee94edf9 Unify sparc init with other ieee1275.
* grub-core/Makefile.core.def (kernel): Use kern/ieee1275/init.c
	instead of kern/sparc64/ieee1275/init.c.
	* grub-core/kern/ieee1275/cmain.c (grub_ieee1275_find_options)
	[__sparc__]: Set GRUB_IEEE1275_FLAG_NO_PARTITION_0.
	* grub-core/kern/ieee1275/init.c [__sparc__]: Include
	grub/machine/kernel.h.
	(grub_ieee1275_original_stack) [__sparc__]: New variable.
	(grub_claim_heap) [__sparc__]: Use sparc version.
	(grub_machine_init): Moved args parsing to
	(grub_parse_cmdline): ...this.
	* grub-core/kern/sparc64/ieee1275/init.c: Removed.
	* include/grub/offsets.h (GRUB_KERNEL_SPARC64_IEEE1275_MOD_GAP):
	New definition.
	(GRUB_KERNEL_SPARC64_IEEE1275_MOD_ALIGN): Likewise.

	Move BOOTP to separate file.

	* grub-core/Makefile.core.def (net): Add net/bootp.c.
	* grub-core/net/net.c: Move all BOOTP functions to
	* grub-core/net/bootp.c: ... here.

	Use frame interface on PXE.

	* grub-core/Makefile.core.def (pxecmd): Removed.
	(pxe): Use net/drivers/i386/pc/pxe.c rather than net/i386/pc/pxe.c.
	* grub-core/commands/i386/pc/pxecmd.c: Removed.
	* grub-core/i386/pc/pxe.c: Moved from here ...
	* grub-core/net/i386/pc/pxe.c: ... here. Rewritten.
	* grub-core/net/net.c (grub_net_open_real): Handle old pxe syntax.
	* include/grub/i386/pc/pxe.h (grub_pxe_unload): Removed.

	EFI network support.

	* grub-core/Makefile.core.def (efinet): New module.
	* grub-core/disk/efi/efidisk.c (compare_device_paths): Moved from
	here...
	* grub-core/kern/efi/efi.c (grub_efi_compare_device_paths): ... here.
	All users updated.
	* grub-core/kern/efi/init.c (grub_efi_net_config): New variable.
	(grub_machine_get_bootlocation): Call grub_efi_net_config if needed.
	* grub-core/kern/x86_64/efi/callwrap.S (efi_wrap_7): New function.
	* grub-core/net/drivers/efi/efinet.c: New file.
	* include/grub/efi/efi.h (grub_efi_compare_device_paths): New proto.
	(grub_efi_net_config): New extern var.

	Various cleanups and bugfixes.

	* grub-core/disk/efi/efidisk.c (grub_efidisk_open): Fix off-by-one
	error.
	(grub_efidisk_get_device_name): Unify similar codepaths. Accept whole
	disk declared as partition.
	* grub-core/disk/ieee1275/ofdisk.c (grub_ofdisk_open): Fix memory
	leak on failure.
	* grub-core/kern/dl.c (grub_dl_load_file): Fix memory leak.
	* grub-core/kern/mm.c (grub_debug_malloc): Don't use unsupported %zx.
	(grub_debug_zalloc): Likewise.
	(grub_debug_realloc): Likewise.
	(grub_debug_memalign): Likewise.
	* grub-core/net/arp.c (grub_net_arp_receive): IPv4 is 4-byte wide.
	Check that target is IPv4.
	* grub-core/net/drivers/ieee1275/ofnet.c (grub_ofnet_findcards): Use
	local-mac-address as fallback.
	* grub-core/net/ethernet.c (grub_net_recv_ethernet_packet): Prevent
	memory leak.
	* grub-core/net/ip.c (ipchksum): Rename to ...
	(grub_net_ip_chksum): ... this. All users updated.
	(grub_net_recv_ip_packets): Special handling for DHCP.
	* util/grub-mkimage.c (generate_image): Zero-out aout header.

	Unify prefix handling

	* grub-core/kern/efi/init.c (grub_efi_set_prefix): Revamped into ...
	(grub_machine_get_bootlocation): ... this.
	* grub-core/kern/emu/main.c (grub_machine_set_prefix): Revamped into ...
	(grub_machine_get_bootlocation): ... this.
	(grub_prefix): New variable.
	(prefix): Removed.
	(root_dev): New variable.
	(dir): Likewise.
	(main): Use new variables.
	* grub-core/kern/i386/coreboot/init.c (grub_machine_set_prefix):
	Revamped into ...
	(grub_machine_get_bootlocation): ... this.
	* grub-core/kern/i386/efi/init.c (grub_machine_set_prefix): Removed.
	* grub-core/kern/i386/pc/init.c (make_install_device): Revamped into ...
	(grub_machine_get_bootlocation): ... this.
	(grub_machine_set_prefix): Removed.
	* grub-core/kern/ia64/efi/init.c (grub_machine_set_prefix): Removed.
	* grub-core/kern/ieee1275/init.c (grub_machine_set_prefix):
	Revamped into ...
	(grub_machine_get_bootlocation): ... this.
	* grub-core/kern/main.c (grub_set_root_dev): Revamped into ...
	(grub_set_prefix_and_root): ... this. All users updated.
	* grub-core/kern/mips/init.c (grub_machine_set_prefix):
	Revamped into ...
	(grub_machine_get_bootlocation): ... this.
	* include/grub/kernel.h (grub_machine_set_prefix): Removed.
	(grub_machine_get_bootlocation): New proto.
	* include/grub/i386/pc/kernel.h (grub_pc_net_config): New var.

	Less intrusive and more reliable seek on network implementation.

	* grub-core/kern/file.c (grub_file_net_seek): Removed.
	(grub_file_seek): Don't call grub_file_net_seek.
	* grub-core/net/net.c (grub_net_fs_read): Renamed to ...
	(grub_net_fs_read_real): .. this.
	(grub_net_seek_real): Use net->offset.
	(grub_net_fs_read): Seek if necessary.

	Unify IEEE1275 netwotk config with the other platforms.

	* grub-core/kern/ieee1275/init.c (grub_ieee1275_net_config):
	New variable.
	(grub_machine_get_bootlocation): Support network.
	* grub-core/kern/ieee1275/openfw.c (grub_ieee1275_parse_args):
	Support type and device parsing.
	(grub_ieee1275_get_device_type): New function.
	* grub-core/net/drivers/ieee1275/ofnet.c (grub_getbootp_real): Revamped
	into ...
	(grub_ieee1275_net_config_real): ... this.
	(grub_ofnet_probecards): Removed.
	* grub-core/Makefile.am (KERNEL_HEADER_FILES): Remove ofnet.h.
	* include/grub/ieee1275/ofnet.h: Removed.
	* include/grub/ieee1275/ieee1275.h (grub_ieee1275_net_config): NEw
	extern var.
	(grub_ieee1275_get_device_type): New function.

	Unify network device closing across platforms and make more robust.

	* grub-core/kern/ieee1275/init.c (grub_machine_fini): Don't call
	grub_grubnet_fini.
	* grub-core/net/ethernet.c (send_ethernet_packet): Open card if it isn't
	already.
	* grub-core/net/net.c (grub_net_network_level_interface_register):
	Update num_ifaces.
	(grub_net_card_unregister): Close all interfaces.
	(receive_packets): Don't poll if no iterfaces are registered.
	Open if necessary.
	(grub_net_fini_hw): New function.
	(grub_net_restore_hw): Likewise.
	(fini_hnd): New variable.
	(GRUB_MOD_INIT): Register preboot hook.
	(GRUB_MOD_FINI): Run and unregister preboot hook.

	Poll network cards when idle.

	* grub-core/kern/term.c (grub_net_poll_cards_idle): New variable.
	(grub_checkkey): Call grub_net_poll_cards_idle if it's not NULL.
	* grub-core/net/net.c (receive_packets): Save last poll time.
	(grub_net_poll_cards_idle_real): New function.
	(GRUB_MOD_INIT): Register grub_net_poll_cards_idle.
	(GRUB_MOD_FINI): Unregister grub_net_poll_cards_idle.
	* include/grub/kernel.h (grub_poll_cards_idle): New extern variable.

	Rename ofnet interfaces.

	* grub-core/net/drivers/ieee1275/ofnet.c (find_alias): New function.
	(grub_ofnet_findcards): Use ofnet_%s names.

	* util/grub-mknetdir.in: Support for EFI and IEEE1275.

	Cleanup socket opening.

	* grub-core/net/net.c (grub_net_fs_open): Rewritten.
	(grub_net_fs_close): Likewise.
	(grub_net_fs_read_real): Use eof member.
	* include/grub/net/udp.h (+grub_net_udp_open): New proto.
	(+grub_net_udp_close): New inline function.

	* include/grub/net/tftp.h: Moved to the top of ...
	* grub-core/net/tftp.c: ... here.
	* include/grub/net/ip.h: Moved mostly to the top of ...
	* grub-core/net/ip.c: ... here.
	* include/grub/net/ethernet.h: Moved mostly to the top of ...
	* grub-core/net/ethernet.c: ... here.

	* grub-core/kern/device.c (grub_device_close): Free device->net->server.

	* grub-core/commands/probe.c (grub_cmd_probe): Use protocol name for
	FS name.

	* include/grub/net/ip.h (ipv4_ini): Removed.
	(ipv4_fini): Likewise.

	* include/grub/net/ip.h (grub_net_recv_ip_packets): New proto.
	(grub_net_send_ip_packets): Likewise.
2011-07-06 20:05:26 +02:00
Vladimir 'phcoder' Serbinenko
e1a0e1b428 Fix the usage of unsupported %zx 2011-07-06 17:41:19 +02:00
Vladimir 'phcoder' Serbinenko
f872d4744e Fix compilation error 2011-07-06 17:40:56 +02:00
Vladimir 'phcoder' Serbinenko
c2aa00f059 Fix a memory leak 2011-07-06 17:40:36 +02:00
Vladimir 'phcoder' Serbinenko
228ccedb5e poll cards when idle 2011-07-06 13:37:33 +02:00
Vladimir 'phcoder' Serbinenko
cf1337aa02 * grub-core/kern/i386/qemu/mmap.c (grub_machine_mmap_init): Use new
grub_read_cmos prototype.
2011-07-06 02:50:35 +02:00
Vladimir 'phcoder' Serbinenko
d53bf34924 merge mainline into net 2011-07-06 01:35:41 +02:00
Vladimir 'phcoder' Serbinenko
93c06ff9c6 VGA text support in qemu-mips
* grub-core/Makefile.core.def (kernel): Add term/i386/pc/vga_text.c,
	term/i386/vga_common.c and kern/vga_init.c on qemu-mips.
	* grub-core/kern/mips/qemu_mips/init.c (grub_machine_init): Init vga
	text.
	* grub-core/kern/i386/qemu/init.c: Renamed to ...
	* grub-core/kern/vga_init.c: ... this.
	* grub-core/kern/vga_init.c (VGA_ADDR) [__mips__]: Adjust.
	(grub_qemu_init_cirrus) [__mips__]: Skip PCI and adjust the I/O base.
	* grub-core/term/i386/pc/vga_text.c (VGA_TEXT_SCREEN) [__mips__]:
	Adjust.
	* include/grub/vga.h [GRUB_MACHINE_MIPS_QEMU_MIPS]: Declare
	GRUB_MACHINE_PCI_IO_BASE.
2011-07-05 23:46:15 +02:00
Vladimir 'phcoder' Serbinenko
748ccabea1 MIPS qemu flash support.
* grub-core/boot/mips/startup_raw.S [GRUB_MACHINE_MIPS_QEMU_MIPS]: Check
	magic.
	* grub-core/kern/mips/qemu_mips/init.c (probe_mem): New function.
	(grub_machine_init): Probe memory if its size isn't known.
	* util/grub-mkimage.c (image_targets): Add flash targets.
	(generate_image): Handle flash targets.
2011-07-05 21:42:36 +02:00
Vladimir 'phcoder' Serbinenko
d734599439 MIPS qemu at_keyboard support.
* gentpl.py (videoinkernel): Add qemu-mips.
	* grub-core/Makefile.am (KERNEL_HEADER_FILES): Add necessary headers.
	* grub-core/Makefile.core.def (kernel): Add at_keyboard and layout.
	* grub-core/kern/mips/qemu_mips/init.c (grub_machine_init): Init new
	modules.
	* grub-core/term/at_keyboard.c (grub_keyboard_controller_init)
	[GRUB_MACHINE_MIPS_QEMU_MIPS]: Don't consider original set.
	* grub-core/term/serial.c (grub_serial_register)
	[GRUB_MACHINE_MIPS_QEMU_MIPS]: Make com0 explicitly active.
2011-07-05 21:00:01 +02:00
Vladimir 'phcoder' Serbinenko
0bc2cd0f82 Reintroduce open/close of net cards. Clean up ofnet. 2011-07-05 16:37:14 +02:00
Vladimir 'phcoder' Serbinenko
c4d038f632 Don't react to adressed bootp packets unless in bootp transaction 2011-07-02 20:11:29 +02:00
Vladimir 'phcoder' Serbinenko
03a0046581 merge mainline into net 2011-07-02 18:52:50 +02:00
Vladimir 'phcoder' Serbinenko
6708faafde Fix broken blksize negotiation, fix broken seek and change a way net device is filled n i386-pc 2011-07-02 17:58:23 +02:00
Vladimir 'phcoder' Serbinenko
cae730b452 Automatically determine prefix when netbooted on EFI 2011-07-02 16:56:35 +02:00
Vladimir 'phcoder' Serbinenko
574618a2e9 unify prefix handling across platforms 2011-07-02 14:09:36 +02:00
Vladimir 'phcoder' Serbinenko
9fc9ce3795 Coreboot video support.
* grub-core/Makefile.core.def (vga): Extend to coreboot and multiboot.
	(vbe): Likewise.
	* grub-core/kern/i386/coreboot/startup.S: Include int.S.
	* grub-core/kern/i386/pc/startup.S (grub_bios_interrupt): Moved from
	here ...
	* grub-core/kern/i386/int.S: ... here.
	* grub-core/video/i386/pc/vbe.c: Updated includes.
	* grub-core/video/i386/pc/vga.c: Likewise.
	* include/grub/i386/coreboot/memory.h
	(GRUB_MEMORY_MACHINE_SCRATCH_ADDR): New definition.
	(GRUB_MEMORY_MACHINE_SCRATCH_SEG): Likewise.
	(GRUB_MEMORY_MACHINE_SCRATCH_SIZE): Likewise.
	* include/grub/i386/pc/int.h (GRUB_CPU_INT_FLAGS_DEFAULT) [!PCBIOS]:
	Disable interrupts.
	* include/grub/i386/pc/vga.h: Removed. All users updated.
2011-06-27 08:54:55 +02:00
Vladimir 'phcoder' Serbinenko
9d22909b85 efinet support 2011-06-26 22:42:04 +02:00
Vladimir 'phcoder' Serbinenko
80ca250565 Add backward compatibiulity with old (pxe) syntax. Several cleanups 2011-06-26 17:06:18 +02:00
Patrick
6295b32f79 * grub-core/kern/main.c (grub_load_normal_mode): Correct the comment. 2011-06-25 01:09:32 +02:00
Vladimir 'phcoder' Serbinenko
8f72becdef merge mainline into net 2011-06-24 22:20:50 +02:00
Manoel Rebelo Abranches
90162423e9 Network infrastructure.
The ARP protocol was made by Paulo Pinatti <ppinatti@br.ibm.com>

	* include/grub/net/arp.h: New file.
	* include/grub/net/device.h: Likewise.
	* include/grub/net/ethernet.h: Likewise.
	* include/grub/net/ip.h: Likewise.
	* include/grub/net/netbuff.h: Likewise.
	* include/grub/net/tftp.h: Likewise.
	* include/grub/net/udp.h: Likewise.
	* include/grub/ieee1275/ofnet.h: Likewise.
	* include/grub/emu/export.h: Likewise.
	* include/grub/net.h: Likewise.
	* grub-core/net/arp.c: Likewise.
	* grub-core/net/ethernet.c: Likewise.
	* grub-core/net/ip.c: Likewise.
	* grub-core/net/udp.c: Likewise.
	* grub-core/net/tftp.c: Likewise.
	* grub-core/net/netbuff.c: Likewise.
	* grub-core/net/net.c: Likewise.
	* grub-core/net/drivers/emu/emunet.c: Likewise.
	* grub-core/net/drivers/ieee1275/ofnet.c: Likewise.
	* grub-core/Makefile.am (KERNEL_HEADER_FILES): Add net.h, ofnet.h and
	export.h.
	* grub-core/Makefile.core.def (net): New module.
	(tftp): Likewise.
	(ofnet): Likewise.
	(emunet): Likewise.
	* grub-core/commands/ls.c (grub_ls_list_devices) [!GRUB_UTIL]: List
	network protocols.
	* grub-core/kern/device.c (grub_net_open) : New variable.
	(grub_device_open): Handle network device.
	(grub_device_close): Likewise.
	* grub-core/kern/file.c (grub_file_net_seek) : New variable.
	(grub_grubnet_fini): Likewise.
	(grub_file_seek): Seek in network device.
	* grub-core/kern/fs.c (grub_fs_probe): Handle network devices.
	* grub-core/kern/ieee1275/init.c (grub_machine_set_prefix): Handle
	network root.
	(grub_machine_fini): Call grub_grubnet_fini.
	* grub-core/kern/ieee1275/openfw.c (grub_ieee1275_parse_args): Handle
	network.
	(grub_ieee1275_get_aliasdevname): New function.
	* grub-core/loader/i386/multiboot_mbi.c (grub_multiboot_get_mbi_size):
	Add unofficial Solaris network info.
	(grub_multiboot_make_mbi): Likewise.
	* grub-core/fs/i386/pc/pxe.c: Moved from here ...
	* grub-core/net/i386/pc/pxe.c: ...here. Adapted for new design.
	* include/grub/device.h (grub_fs): Removed.
	* include/grub/err.h (grub_err_t): Add network-related values.
	* include/grub/i386/pc/pxe.h: Removed bootp parts.
	* include/grub/ieee1275/ieee1275.h (grub_ofnetcard_data): New struct.
	(grub_ieee1275_get_aliasdevname): New proto.
	* include/grub/net.h: Rewritten.

	Also-By: Paulo Pinatti <ppinatti@br.ibm.com>

	Also-By: Vladimir Serbinenko <phcoder@gmail.com>
2011-06-24 22:16:05 +02:00
Vladimir 'phcoder' Serbinenko
a057797f18 merge mine and abranches' branches. Fix several issues 2011-06-24 21:51:57 +02:00
Vladimir 'phcoder' Serbinenko
bc09e1a238 * grub-core/kern/emu/getroot.c (grub_guess_root_device): Revert to
old method if mountinfo would return /dev/root and /dev/root doesn't
	exist.
2011-06-24 04:32:54 +02:00
Vladimir 'phcoder' Serbinenko
5ab3f48a92 AHCI support.
* grub-core/Makefile.core.def (ata_pthru): Removed.
	(ahci): New module.
	(pata): Likewise.
	* grub-core/bus/usb/ohci.c (GRUB_MOD_FINI): Unregister preboot hook
	on unload.
	* grub-core/commands/hdparm.c (grub_hdparm_do_ata_cmd): Use ATA
	readwrite.
	(grub_hdparm_do_check_powermode_cmd): Likewise.
	(grub_hdparm_do_smart_cmd): Likewise.
	(grub_hdparm_set_val_cmd): Likewise.
	(grub_cmd_hdparm): Likewise. Check thta we have an ATA device.
	* grub-core/disk/ahci.c: New file.
	* grub-core/disk/ata.c: Factor out the low-level part into ...
	* grub-core/disk/pata.c: ... here.
	* grub-core/disk/ata_pthru.c: Contents moved to ...
	* grub-core/disk/pata.c: ... here.
	* grub-core/disk/scsi.c (grub_scsi_names): New array.
	(grub_scsi_iterate): Use grub_scsi_names.
	(grub_scsi_open): Likewise.
	* grub-core/kern/disk.c (grub_disk_ata_pass_through): Removed.
	* include/grub/ata.h (grub_ata_commands): Add DMA commands.
	(grub_ata_regs_t): New struct.
	(grub_disk_ata_pass_through_parms): Likewise.
	(grub_ata_device): Renamed to ...
	(grub_ata): ... this.
	(grub_ata_dev): New struct.
	Removed all low-level inline functions.
	* include/grub/scsi.h: Add PATA and AHCI subsystems.
	(grub_scsi_dev): Removed 'name' and 'id'. Added 'id' parameter to
	iterate hooks and open. All users updated.
	* util/grub-install.in: Handle AHCI disk module.
2011-06-24 00:07:55 +02:00
Vladimir 'phcoder' Serbinenko
cad3237fb5 * grub-core/kern/emu/hostdisk.c (grub_util_biosdisk_is_floppy): Close
file after stat.
	Reported by: David Volgyes <dvolgyes>.
2011-06-23 22:02:05 +02:00