Merge mainline into keylayouts

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-08-31 14:12:34 +02:00
commit 70770806f3
45 changed files with 1329 additions and 1548 deletions

258
ChangeLog
View file

@ -1,3 +1,261 @@
2010-08-30 Vladimir Serbinenko <phcoder@gmail.com>
Interrupt wrapping and code simplifications.
* Makefile.util.def (grub-mkrescue): Use x86 tg instead of
x86_noieee1275 which are functionaly equivalent in this case.
(grub-install): Make source on each platform explicit. Enable on
all noemu.
* gentpl.py (x86_efi_pc): Removed group.
(x86_noefi): Likewise.
(i386_noefi): Likewise.
(x86_noieee1275): Likewise.
(i386_noieee1275): Likewise.
(i386_noefi_noieee1275): Likewise.
(i386_pc_qemu_coreboot): Likewise.
(i386_coreboot_multiboot): Likewise.
(i386_pc_coreboot_multiboot_qemu): Likewise.
(x86_noefi_mips): Likewise.
(noieee1275): Likewise.
(ieee1275_mips): Likewise.
(noemu_noieee1275): Likewise.
(cmos): New group.
(usb): Likewise.
(videoinkernel): Likewise.
(videomodules): Likewise.
* grub-core/Makefile.am (KERNEL_HEADER_FILES): Remove
include/grub/elf.h, include/grub/elfload.h, include/grub/net.h,
include/grub/reader.h, include/grub/symbol.h, include/grub/types.h,
include/grub/loader.h, include/grub/msdos_partition.h,
include/grub/machine/biosdisk.h, include/grub/machine/boot.h,
include/grub/machine/console.h, include/grub/machine/vga.h,
include/grub/machine/vbe.h, include/grub/machine/init.h,
include/grub/machine/kernel.h, include/grub/cpu/time.h,
include/grub/cpu/types.h, include/grub/gzio.h and include/grub/menu.h
(KERNEL_HEADER_FILES) [i386-pc]: Add include/grub/machine/int.h.
(KERNEL_HEADER_FILES) [i386-ieee1275]: Add include/grub/i386/pit.h
* grub-core/Makefile.core.def (kernel): Explicit the source for
startup. Explicit the platforms using kern/generic/rtc_get_time_ms.c.
Split ieee1275_mips. Remove kern/i386/halt.c. Remove kern/i386/misc.S.
Enable kern/i386/pit.c on all x86. Remove kern/i386/ieee1275/init.c.
Use videoinkernel tag.
(usb): Enable on all usb.
(usbserial_common): Likewise.
(usbserial_pl2303): Likewise.
(usbserial_ftdi): Likewise.
(uhci): Enable on all x86.
(ohci): Enable on all pci.
(cmostest): Enable on all CMOS.
(acpi): Include commands/acpi.c on all platforms.
(halt): Add relevant lib/*/halt.c.
(hdparm): Enable on all pci.
(lspci): Likewise.
(usbtest): Enable on all usb.
(ata): Enable on all pci.
(ata_pthru): Likewise.
(usbms): Enable on all usb.
(usb_keyboard): Likewise.
(font): Use tag videomodules.
(bufio): Likewise.
(datetime): Use tag cmos. Enable on all noemu.
(mmap): Use tags common and x86.
(gfxterm): Use tag videomodules.
(bitmap): Likewise.
(bitmap_scale): Likewise.
(video_fb): Likewise.
(video): Likewise.
* grub-core/bus/usb/ohci.c (grub_ohci_td): Make link_td a pointer and
adjust padding accordingly. All users updated.
(grub_ohci_transaction): Fix bad format specification.
(GRUB_MOD_INIT): Add asserts for struct size.
* grub-core/bus/usb/uhci.c (grub_uhci_pci_iter): Add explicit casts.
(grub_alloc_td): Likewise.
(grub_free_queue): Likewise.
(grub_uhci_transfer): Likewise.
(grub_uhci_transaction): Fix bad format specification.
* grub-core/bus/usb/usbtrans.c (grub_usb_control_msg): Likewise.
(grub_usb_bulk_readwrite): Likewise.
* grub-core/kern/i386/misc.S (grub_stop): Moved from here ...
* grub-core/commands/i386/pc/halt.c (stop): ...here. Transformed into C.
Made static.
* grub-core/lib/i386/halt.c (stop): ... and here. Transformed into C.
Made static.
* grub-core/kern/i386/pc/startup.S (grub_halt): Moved from here ...
* grub-core/commands/i386/pc/halt.c (grub_halt): ...here.
Transformed into C.
* grub-core/kern/i386/pc/startup.S (grub_biosdisk_rw_int13_extensions):
Moved from here ...
* grub-core/disk/i386/pc/biosdisk.c (grub_biosdisk_rw_int13_extensions):
... here. Transformed into C. Made static.
* grub-core/kern/i386/pc/startup.S (grub_biosdisk_rw_standard):
Moved from here ...
* grub-core/disk/i386/pc/biosdisk.c (grub_biosdisk_rw_standard):
... here. Transformed into C. Made static.
* grub-core/kern/i386/pc/startup.S
(grub_biosdisk_check_int13_extensions): Moved from here ...
* grub-core/disk/i386/pc/biosdisk.c
(grub_biosdisk_check_int13_extensions): ... here. Transformed into C.
Made static.
* grub-core/kern/i386/pc/startup.S
(grub_biosdisk_get_cdinfo_int13_extensions): Moved from here ...
* grub-core/disk/i386/pc/biosdisk.c
(grub_biosdisk_get_cdinfo_int13_extensions): ... here.
Transformed into C. Made static.
* grub-core/kern/i386/pc/startup.S
(grub_biosdisk_get_diskinfo_int13_extensions): Moved from here ...
* grub-core/disk/i386/pc/biosdisk.c
(grub_biosdisk_get_diskinfo_int13_extensions): ... here.
Transformed into C. Made static.
* grub-core/kern/i386/pc/startup.S
(grub_biosdisk_get_diskinfo_standard): Moved from here ...
* grub-core/disk/i386/pc/biosdisk.c
(grub_biosdisk_get_diskinfo_standard): ... here.
Transformed into C. Made static.
* grub-core/kern/i386/pc/startup.S
(grub_biosdisk_get_num_floppies): Moved from here ...
* grub-core/disk/i386/pc/biosdisk.c
(grub_biosdisk_get_num_floppies): ... here.
Transformed into C. Made static.
* grub-core/disk/i386/pc/biosdisk.c (grub_biosdisk_get_diskinfo_real):
New function.
* grub-core/kern/i386/pc/startup.S (grub_pxe_scan): Moved from here ...
* grub-core/fs/i386/pc/pxe.c (grub_pxe_scan): ... here.
Transformed into C. Made static.
* grub-core/kern/i386/pc/startup.S (grub_rm_entry): Moved from here ...
* grub-core/fs/i386/pc/pxe.c (grub_rm_entry): ... here.
Transformed into C. Made static.
* grub-core/kern/i386/ieee1275/init.c: Removed.
* grub-core/kern/i386/misc.S: Likewise.
* grub-core/kern/i386/pc/startup.S (grub_get_memsize):
Splitted from here ...
* grub-core/kern/i386/pc/init.c (grub_get_conv_memsize): ... here.
Transformed into C. Made static. All users updated.
* grub-core/kern/i386/pc/mmap.c (grub_get_ext_memsize): ... and here.
Transformed into C. Made static. All users updated.
* grub-core/kern/i386/pc/startup.S (grub_get_eisa_mmap):
Moved from here...
* grub-core/kern/i386/pc/mmap.c (grub_get_eisa_mmap): ... here.
Transformed into C. Made static. All users updated.
* grub-core/kern/i386/pc/startup.S (grub_get_mmap_entry):
Moved from here...
* grub-core/kern/i386/pc/mmap.c (grub_get_mmap_entry): ... here.
Transformed into C. Made static. All users updated.
* grub-core/kern/i386/pc/startup.S (grub_stop_floppy):
Removed (replaced by C version).
* grub-core/kern/i386/pc/startup.S (grub_vga_set_mode):
Moved from here...
* grub-core/video/i386/pc/vga.c (grub_vga_set_mode): ...here.
Transformed into C. Made static.
* grub-core/kern/i386/pc/startup.S (grub_vbe_bios_get_controller_info):
Moved from here...
* grub-core/video/i386/pc/vbe.c (grub_vbe_bios_get_controller_info):
... here. Transformed into C.
* grub-core/kern/i386/pc/startup.S (grub_vbe_bios_get_mode_info):
Moved from here...
* grub-core/video/i386/pc/vbe.c (grub_vbe_bios_get_mode_info):
... here. Transformed into C.
* grub-core/kern/i386/pc/startup.S (grub_vbe_bios_set_mode):
Moved from here...
* grub-core/video/i386/pc/vbe.c (grub_vbe_bios_set_mode):
... here. Transformed into C. Made static.
* grub-core/kern/i386/pc/startup.S (grub_vbe_bios_get_mode):
Moved from here...
* grub-core/video/i386/pc/vbe.c (grub_vbe_bios_get_mode):
... here. Transformed into C.
* grub-core/kern/i386/pc/startup.S
(grub_vbe_bios_getset_dac_palette_width):Moved from here...
* grub-core/video/i386/pc/vbe.c
(grub_vbe_bios_getset_dac_palette_width):... here. Transformed into C.
* grub-core/kern/i386/pc/startup.S (grub_vbe_bios_set_memory_window):
Moved from here...
* grub-core/video/i386/pc/vbe.c (grub_vbe_bios_set_memory_window):
... here. Transformed into C.
* grub-core/kern/i386/pc/startup.S (grub_vbe_bios_get_memory_window):
Moved from here...
* grub-core/video/i386/pc/vbe.c (grub_vbe_bios_get_memory_window):
... here. Transformed into C.
* grub-core/kern/i386/pc/startup.S (grub_vbe_bios_set_scanline_length):
Moved from here...
* grub-core/video/i386/pc/vbe.c (grub_vbe_bios_set_scanline_length):
... here. Transformed into C.
* grub-core/kern/i386/pc/startup.S (grub_vbe_bios_get_scanline_length):
Moved from here...
* grub-core/video/i386/pc/vbe.c (grub_vbe_bios_get_scanline_length):
... here. Transformed into C.
* grub-core/kern/i386/pc/startup.S (grub_vbe_bios_set_display_start):
Moved from here...
* grub-core/video/i386/pc/vbe.c (grub_vbe_bios_set_display_start):
... here. Transformed into C. Made static.
* grub-core/kern/i386/pc/startup.S (grub_vbe_bios_get_display_start):
Moved from here...
* grub-core/video/i386/pc/vbe.c (grub_vbe_bios_get_display_start):
... here. Transformed into C. Made static.
* grub-core/kern/i386/pc/startup.S (grub_vbe_bios_set_palette_data):
Moved from here...
* grub-core/video/i386/pc/vbe.c (grub_vbe_bios_set_palette_data):
... here. Transformed into C. Made static.
* grub-core/kern/i386/pc/startup.S (grub_pxe_call): Receive
pxe_rm_entry as third argument.
(grub_bios_interrupt): New function.
* grub-core/kern/i386/qemu/mmap.c: Remove useless include.
* grub-core/kern/i386/qemu/startup.S (codestart): Do cli;hlt instead
of calling grub_stop.
* grub-core/kern/efi/efi.c (grub_halt): Moved from here ...
* grub-core/lib/efi/halt.c (grub_halt): ...here.
* grub-core/kern/emu/main.c (grub_halt): Moved from here ...
* grub-core/lib/emu/halt.c (grub_halt): ... here.
* grub-core/lib/i386/halt.c: Moved from here ...
* grub-core/lib/i386/halt.c: ... here.
* grub-core/kern/ieee1275/openfw.c (grub_halt): Moved from here ...
* grub-core/lib/ieee1275/halt.c (grub_halt): ... here.
* grub-core/loader/i386/pc/linux.c (grub_linux16_boot): Call
grub_stop_floppy.
* grub-core/loader/i386/xnu.c (guessfsb) [IEEE1275]: Enable.
* include/grub/i386/coreboot/init.h: Removed.
* include/grub/i386/multiboot/init.h: Likewise.
* include/grub/i386/pc/biosdisk.h: Removed all function prototypes.
* include/grub/i386/pc/init.h: Likewise except grub_gate_a20.
* include/grub/i386/pc/int.h: New file.
* include/grub/i386/pc/pxe.h (GRUB_PXE_SIGNATURE): New definition.
(grub_pxe_scan): Removed.
(grub_pxe_call): Update prototype.
* include/grub/i386/pc/vbe.h: Removed EXPORT_FUNC and useless
prototypes.
* include/grub/i386/pc/vga.h (grub_vga_set_mode): Removed.
* include/grub/i386/qemu/init.h: Removed.
* include/grub/mips/yeeloong/kernel.h (grub_reboot): Add missing
noreturn.
(grub_halt): Likewise.
* include/grub/misc.h (grub_halt): Removed EXPORT_FUNC.
(grub_reboot): Likewise.
* grub-core/kern/i386/coreboot/init.c (grub_stop_floppy): Moved from here...
* include/grub/i386/floppy.h (grub_stop_floppy): ...here. Inlined.
* grub-core/kern/i386/pc/startup.S (grub_hard_stop): Removed.
2010-08-30 Robert Millan <rmh@gnu.org>
* NEWS: Document addition of ZFS support in `grub-install' and
`grub-mkconfig'.
2010-08-30 BVK Chaitanya <bvk.groups@gmail.com>
* conf/Makefile.common (CPPFLAGS_DEFAULT): Remove leading / from
dprintf output.
2010-08-30 Vladimir Serbinenko <phcoder@gmail.com>
Remove leftover embedding of font objects.
* include/grub/kernel.h (OBJ_TYPE_FONT): Removed.
* util/grub-install.in (font): Removed.
* util/grub-mkimage.c (generate_image): Remove font support. All users
updated.
2010-08-30 Vladimir Serbinenko <phcoder@gmail.com>
* docs/grub.texi (Network): Fix reference to pxe_blksize.
Reported by: Ian Turner
2010-08-30 Vladimir Serbinenko <phcoder@gmail.com>
* grub-core/normal/menu.c (grub_wait_after_message): Add a 10 second

View file

@ -340,7 +340,7 @@ script = {
script = {
mansection = 1;
name = grub-mkrescue;
x86_noieee1275 = util/grub-mkrescue.in;
x86 = util/grub-mkrescue.in;
powerpc_ieee1275 = util/powerpc/ieee1275/grub-mkrescue.in;
enable = i386_pc;
enable = x86_efi;
@ -356,15 +356,17 @@ script = {
name = grub-install;
mips = util/grub-install.in;
i386_noefi_noieee1275 = util/grub-install.in;
i386_pc = util/grub-install.in;
i386_qemu = util/grub-install.in;
i386_coreboot = util/grub-install.in;
i386_multiboot = util/grub-install.in;
sparc64_ieee1275 = util/grub-install.in;
x86_efi = util/i386/efi/grub-install.in;
i386_ieee1275 = util/ieee1275/grub-install.in;
powerpc_ieee1275 = util/ieee1275/grub-install.in;
enable = x86;
enable = mips;
enable = powerpc_ieee1275;
enable = noemu;
};
script = {

6
NEWS
View file

@ -1,3 +1,9 @@
New in 1.99:
* ZFS support in `grub-install' and `grub-mkconfig'. Note: complete
functionality requires external ZFS implementation (available from
grub-extras).
New in 1.98 - 2010-03-06:
* Multiboot on EFI support.

View file

@ -31,7 +31,7 @@ endif
# Other options
CPPFLAGS_DEFAULT = -DGRUB_FILE=\"$(subst $(srcdir),,$<)\"
CPPFLAGS_DEFAULT = -DGRUB_FILE=\"$(subst $(srcdir)/,,$<)\"
CPPFLAGS_DEFAULT += -I$(builddir)
CPPFLAGS_DEFAULT += -I$(srcdir)
CPPFLAGS_DEFAULT += -I$(top_builddir)

View file

@ -1436,7 +1436,7 @@ The boot file name provided by DHCP. Read-only.
The name of the DHCP server responsible for these boot parameters.
Read-only.
@item net_pxe_blksize
@item pxe_blksize
The PXE transfer block size. Read-write, defaults to 512.
@item pxe_default_server

View file

@ -10,46 +10,38 @@ GRUB_PLATFORMS = [ "emu", "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot",
"powerpc_ieee1275" ]
GROUPS = {}
GROUPS["common"] = GRUB_PLATFORMS[:]
# Groups based on CPU
GROUPS["i386"] = [ "i386_pc", "i386_efi", "i386_qemu", "i386_coreboot", "i386_multiboot", "i386_ieee1275" ]
GROUPS["x86_64"] = [ "x86_64_efi" ]
GROUPS["x86"] = GROUPS["i386"] + GROUPS["x86_64"]
GROUPS["x86_efi"] = [ "i386_efi", "x86_64_efi" ]
GROUPS["nopc"] = GRUB_PLATFORMS[:]; GROUPS["nopc"].remove("i386_pc")
GROUPS["x86_efi_pc"] = GROUPS["x86_efi"] + ["i386_pc"]
GROUPS["x86_noefi"] = GROUPS["x86"][:]; GROUPS["x86_noefi"].remove("i386_efi"); GROUPS["x86_noefi"].remove("x86_64_efi")
GROUPS["i386_noefi"] = GROUPS["i386"][:]; GROUPS["i386_noefi"].remove("i386_efi")
GROUPS["x86_noieee1275"] = GROUPS["x86"][:]; GROUPS["x86_noieee1275"].remove("i386_ieee1275")
GROUPS["i386_noieee1275"] = GROUPS["i386"][:]; GROUPS["i386_noieee1275"].remove("i386_ieee1275")
GROUPS["i386_noefi_noieee1275"] = GROUPS["i386_noefi"][:]; GROUPS["i386_noefi_noieee1275"].remove("i386_ieee1275")
GROUPS["i386_pc_qemu_coreboot"] = ["i386_pc", "i386_qemu", "i386_coreboot"]
GROUPS["i386_coreboot_multiboot"] = ["i386_coreboot", "i386_multiboot"]
GROUPS["i386_coreboot_multiboot_qemu"] = ["i386_coreboot", "i386_multiboot", "i386_qemu"]
GROUPS["i386_pc_coreboot_multiboot_qemu"] = ["i386_pc", "i386_coreboot", "i386_multiboot", "i386_qemu"]
GROUPS["mips"] = [ "mips_yeeloong" ]
GROUPS["sparc64"] = [ "sparc64_ieee1275" ]
GROUPS["powerpc"] = [ "powerpc_ieee1275" ]
GROUPS["nosparc64"] = GRUB_PLATFORMS[:]; GROUPS["nosparc64"].remove("sparc64_ieee1275")
GROUPS["x86_noefi_mips"] = GROUPS["x86_noefi"] + GROUPS["mips"]
# Groups based on firmware
GROUPS["x86_efi"] = [ "i386_efi", "x86_64_efi" ]
GROUPS["ieee1275"] = [ "i386_ieee1275", "sparc64_ieee1275", "powerpc_ieee1275" ]
GROUPS["noieee1275"] = GRUB_PLATFORMS[:]
for i in GROUPS["ieee1275"]: GROUPS["noieee1275"].remove(i)
GROUPS["ieee1275_mips"] = GROUPS["ieee1275"] + GROUPS["mips"]
GROUPS["pci"] = GROUPS["x86"] + GROUPS["mips"]
# emu is a special case so many core functionality isn't needed on this platform
GROUPS["noemu"] = GRUB_PLATFORMS[:]; GROUPS["noemu"].remove("emu")
GROUPS["noemu_noieee1275"] = GRUB_PLATFORMS[:]
for i in ["emu"] + GROUPS["ieee1275"]: GROUPS["noemu_noieee1275"].remove(i)
GROUPS["common"] = GRUB_PLATFORMS[:]
# Groups based on hardware features
GROUPS["cmos"] = GROUPS["x86"][:] + ["mips_yeeloong"]; GROUPS["cmos"].remove("i386_efi"); GROUPS["cmos"].remove("x86_64_efi")
GROUPS["pci"] = GROUPS["x86"] + GROUPS["mips"]
GROUPS["usb"] = GROUPS["pci"]
# If gfxterm is main output console integrate it into kernel
GROUPS["videoinkernel"] = ["mips_yeeloong"]
GROUPS["videomodules"] = GRUB_PLATFORMS[:];
for i in GROUPS["videoinkernel"]: GROUPS["videomodules"].remove(i)
# Miscelaneous groups schedulded to disappear in future
GROUPS["nosparc64"] = GRUB_PLATFORMS[:]; GROUPS["nosparc64"].remove("sparc64_ieee1275")
GROUPS["i386_coreboot_multiboot_qemu"] = ["i386_coreboot", "i386_multiboot", "i386_qemu"]
GROUPS["nopc"] = GRUB_PLATFORMS[:]; GROUPS["nopc"].remove("i386_pc")
#
# Create platform => groups reverse map, where groups covering that

View file

@ -58,8 +58,6 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/command.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/device.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/disk.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/dl.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/elf.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/elfload.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/env_private.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/err.h
@ -70,29 +68,19 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/kernel.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/list.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/misc.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/net.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/parser.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/partition.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/reader.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/symbol.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/term.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/time.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/types.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/mm_private.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/boot.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h
if COND_i386_pc
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/biosdisk.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/boot.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/console.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/loader.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/vga.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/vbe.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/pxe.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/int.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
endif
@ -104,36 +92,26 @@ KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
endif
if COND_i386_coreboot
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/boot.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/console.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/init.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
endif
if COND_i386_multiboot
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/boot.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/console.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/init.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
endif
if COND_i386_qemu
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/boot.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/console.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/init.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/pci.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
endif
if COND_i386_ieee1275
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/loader.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/msdos_partition.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/memory.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/terminfo.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/i386/pit.h
endif
if COND_x86_64_efi
@ -169,15 +147,10 @@ endif
if COND_sparc64_ieee1275
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/libgcc.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/ieee1275/ieee1275.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/machine/kernel.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/sparc64/ieee1275/ieee1275.h
endif
if COND_emu
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/time.h
KERNEL_HEADER_FILES += $(top_builddir)/include/grub/cpu/types.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/gzio.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/menu.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/datetime.h
KERNEL_HEADER_FILES += $(top_srcdir)/include/grub/emu/misc.h
if COND_GRUB_EMU_SDL

View file

@ -36,7 +36,8 @@ kernel = {
x86_64_efi_startup = kern/x86_64/efi/startup.S;
i386_qemu_startup = kern/i386/qemu/startup.S;
i386_ieee1275_startup = kern/i386/ieee1275/startup.S;
i386_coreboot_multiboot_startup = kern/i386/coreboot/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;
sparc64_ieee1275_startup = kern/sparc64/ieee1275/crt0.S;
powerpc_ieee1275_startup = kern/powerpc/ieee1275/startup.S;
@ -65,7 +66,12 @@ kernel = {
noemu_nodist = symlist.c;
noemu_noieee1275 = kern/generic/rtc_get_time_ms.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;
ieee1275 = disk/ieee1275/ofdisk.c;
ieee1275 = kern/ieee1275/cmain.c;
@ -74,20 +80,20 @@ kernel = {
ieee1275 = kern/ieee1275/openfw.c;
ieee1275 = term/ieee1275/ofconsole.c;
ieee1275_mips = term/terminfo.c;
ieee1275_mips = term/tparm.c;
ieee1275 = term/terminfo.c;
ieee1275 = term/tparm.c;
mips = term/terminfo.c;
mips = term/tparm.c;
i386 = kern/i386/dl.c;
i386_coreboot_multiboot_qemu = kern/i386/coreboot/init.c;
i386_coreboot_multiboot_qemu = kern/i386/halt.c;
i386_coreboot_multiboot_qemu = term/i386/pc/vga_text.c;
i386_pc_coreboot_multiboot_qemu = term/i386/vga_common.c;
i386_coreboot_multiboot_qemu = term/i386/vga_common.c;
i386_pc = term/i386/vga_common.c;
i386_noefi = kern/i386/misc.S;
x86_noieee1275 = kern/i386/pit.c;
x86 = kern/i386/pit.c;
x86_efi = disk/efi/efidisk.c;
x86_efi = kern/efi/efi.c;
@ -118,33 +124,19 @@ kernel = {
i386_multiboot = kern/i386/multiboot_mmap.c;
i386_multiboot = kern/i386/tsc.c;
i386_ieee1275 = kern/i386/ieee1275/init.c;
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 = commands/extcmd.c;
mips_yeeloong = font/font.c;
mips_yeeloong = font/font_cmd.c;
mips_yeeloong = io/bufio.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 = lib/arg.c;
mips_yeeloong = term/at_keyboard.c;
mips_yeeloong = term/gfxterm.c;
mips_yeeloong = term/serial.c;
mips_yeeloong = video/bitmap.c;
mips_yeeloong = video/bitmap_scale.c;
mips_yeeloong = video/fb/fbblit.c;
mips_yeeloong = video/fb/fbfill.c;
mips_yeeloong = video/fb/fbutil.c;
mips_yeeloong = video/fb/video_fb.c;
mips_yeeloong = video/sm712.c;
mips_yeeloong = video/video.c;
mips_yeeloong = commands/keylayouts.c;
powerpc_ieee1275 = kern/ieee1275/init.c;
@ -167,6 +159,20 @@ kernel = {
emu = kern/emu/mm.c;
emu = kern/emu/time.c;
videoinkernel = lib/arg.c;
videoinkernel = term/gfxterm.c;
videoinkernel = commands/extcmd.c;
videoinkernel = font/font.c;
videoinkernel = font/font_cmd.c;
videoinkernel = io/bufio.c;
videoinkernel = video/bitmap.c;
videoinkernel = video/bitmap_scale.c;
videoinkernel = video/fb/fbblit.c;
videoinkernel = video/fb/fbfill.c;
videoinkernel = video/fb/fbutil.c;
videoinkernel = video/fb/video_fb.c;
videoinkernel = video/video.c;
extra_dist = kern/i386/realmode.S;
extra_dist = kern/i386/pc/lzma_decode.S;
extra_dist = kern/mips/cache_flush.S;
@ -306,8 +312,7 @@ module = {
noemu = bus/usb/usbtrans.c;
noemu = bus/usb/usbhub.c;
enable = emu;
enable = i386;
enable = mips_yeeloong;
enable = usb;
emu_condition = COND_GRUB_EMU_USB;
};
@ -315,8 +320,7 @@ module = {
name = usbserial_common;
common = bus/usb/serial/common.c;
enable = emu;
enable = i386_pc;
enable = mips_yeeloong;
enable = usb;
emu_condition = COND_GRUB_EMU_USB;
};
@ -324,8 +328,7 @@ module = {
name = usbserial_pl2303;
common = bus/usb/serial/pl2303.c;
enable = emu;
enable = i386_pc;
enable = mips_yeeloong;
enable = usb;
emu_condition = COND_GRUB_EMU_USB;
};
@ -333,22 +336,20 @@ module = {
name = usbserial_ftdi;
common = bus/usb/serial/ftdi.c;
enable = emu;
enable = i386_pc;
enable = mips_yeeloong;
enable = usb;
emu_condition = COND_GRUB_EMU_USB;
};
module = {
name = uhci;
common = bus/usb/uhci.c;
enable = i386_pc;
enable = x86;
};
module = {
name = ohci;
common = bus/usb/ohci.c;
enable = i386_pc;
enable = mips_yeeloong;
enable = pci;
};
module = {
@ -381,9 +382,8 @@ library = {
module = {
name = cmostest;
i386 = commands/i386/cmostest.c;
enable = i386_pc;
enable = i386_coreboot;
common = commands/i386/cmostest.c;
enable = cmos;
};
module = {
@ -403,7 +403,7 @@ module = {
module = {
name = acpi;
i386 = commands/acpi.c;
x86 = commands/acpi.c;
x86_efi = commands/efi/acpi.c;
i386_pc = commands/i386/pc/acpi.c;
i386_coreboot = commands/i386/pc/acpi.c;
@ -492,6 +492,12 @@ module = {
name = halt;
nopc = commands/halt.c;
i386_pc = commands/i386/pc/halt.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;
ieee1275 = lib/ieee1275/halt.c;
emu = lib/emu/halt.c;
};
module = {
@ -503,7 +509,7 @@ module = {
name = hdparm;
common = commands/hdparm.c;
common = lib/hexdump.c;
enable = i386_pc;
enable = pci;
};
module = {
@ -548,8 +554,7 @@ module = {
name = lspci;
common = commands/lspci.c;
enable = x86;
enable = mips;
enable = pci;
};
module = {
@ -661,8 +666,7 @@ module = {
module = {
name = usbtest;
common = commands/usbtest.c;
enable = i386_pc;
enable = mips_yeeloong;
enable = usb;
enable = emu;
emu_condition = COND_GRUB_EMU_USB;
};
@ -737,15 +741,13 @@ module = {
module = {
name = ata;
common = disk/ata.c;
enable = x86;
enable = mips;
enable = pci;
};
module = {
name = ata_pthru;
common = disk/ata_pthru.c;
enable = x86;
enable = mips_yeeloong;
enable = pci;
};
module = {
@ -757,8 +759,7 @@ module = {
module = {
name = usbms;
common = disk/usbms.c;
enable = i386_pc;
enable = mips_yeeloong;
enable = usb;
enable = emu;
emu_condition = COND_GRUB_EMU_USB;
};
@ -805,10 +806,7 @@ module = {
name = font;
common = font/font.c;
common = font/font_cmd.c;
enable = emu;
enable = x86;
enable = sparc64;
enable = powerpc;
enable = videomodules;
};
module = {
@ -976,10 +974,7 @@ module = {
module = {
name = bufio;
common = io/bufio.c;
enable = emu;
enable = x86;
enable = sparc64;
enable = powerpc;
enable = videomodules;
};
module = {
@ -1022,14 +1017,11 @@ module = {
module = {
name = datetime;
x86_noefi_mips = lib/cmos_datetime.c;
cmos = lib/cmos_datetime.c;
x86_efi = lib/efi/datetime.c;
sparc64_ieee1275 = lib/ieee1275/datetime.c;
powerpc_ieee1275 = lib/ieee1275/datetime.c;
enable = x86;
enable = mips;
enable = sparc64_ieee1275;
enable = powerpc_ieee1275;
enable = noemu;
};
module = {
@ -1128,34 +1120,15 @@ module = {
module = {
name = mmap;
i386_pc = mmap/mmap.c;
i386_pc = mmap/i386/uppermem.c;
i386_pc = mmap/i386/mmap.c;
common = mmap/mmap.c;
x86 = mmap/i386/uppermem.c;
x86 = mmap/i386/mmap.c;
i386_pc = mmap/i386/pc/mmap.c;
i386_pc = mmap/i386/pc/mmap_helper.S;
x86_efi = mmap/mmap.c;
x86_efi = mmap/i386/uppermem.c;
x86_efi = mmap/i386/mmap.c;
x86_efi = mmap/efi/mmap.c;
i386_coreboot = mmap/mmap.c;
i386_coreboot = mmap/i386/uppermem.c;
i386_coreboot = mmap/i386/mmap.c;
i386_multiboot = mmap/mmap.c;
i386_multiboot = mmap/i386/uppermem.c;
i386_multiboot = mmap/i386/mmap.c;
i386_qemu = mmap/mmap.c;
i386_qemu = mmap/i386/uppermem.c;
i386_qemu = mmap/i386/mmap.c;
i386_ieee1275 = mmap/mmap.c;
i386_ieee1275 = mmap/i386/uppermem.c;
i386_ieee1275 = mmap/i386/mmap.c;
mips_yeeloong = mmap/mmap.c;
mips_yeeloong = mmap/mips/yeeloong/uppermem.c;
enable = x86;
@ -1255,10 +1228,7 @@ module = {
module = {
name = gfxterm;
common = term/gfxterm.c;
enable = emu;
enable = x86;
enable = sparc64;
enable = powerpc;
enable = videomodules;
};
module = {
@ -1287,8 +1257,7 @@ module = {
module = {
name = usb_keyboard;
common = term/usb_keyboard.c;
enable = i386_pc;
enable = mips_yeeloong;
enable = usb;
};
module = {
@ -1333,19 +1302,13 @@ module = {
module = {
name = bitmap;
common = video/bitmap.c;
enable = emu;
enable = x86;
enable = sparc64;
enable = powerpc;
enable = videomodules;
};
module = {
name = bitmap_scale;
common = video/bitmap_scale.c;
enable = emu;
enable = x86;
enable = sparc64;
enable = powerpc;
enable = videomodules;
};
module = {
@ -1387,19 +1350,13 @@ module = {
common = video/fb/fbblit.c;
common = video/fb/fbfill.c;
common = video/fb/fbutil.c;
enable = emu;
enable = x86;
enable = sparc64;
enable = powerpc;
enable = videomodules;
};
module = {
name = video;
common = video/video.c;
enable = emu;
enable = x86;
enable = sparc64;
enable = powerpc;
enable = videomodules;
};
module = {

View file

@ -55,12 +55,12 @@ struct grub_ohci_td
grub_uint32_t next_td; /* LittleEndian physical address */
grub_uint32_t buffer_end; /* LittleEndian physical address */
/* next values are not for OHCI HW */
volatile struct grub_ohci_td *link_td; /* pointer to next free/chained TD
* pointer as uint32 */
grub_uint32_t prev_td_phys; /* we need it to find previous TD
* physical address in CPU endian */
grub_uint32_t link_td; /* pointer to next free/chained TD
* pointer as uint32 */
grub_uint32_t tr_index; /* index of TD in transfer */
grub_uint8_t pad[4]; /* padding to 32 bytes */
grub_uint8_t pad[8 - sizeof (volatile struct grub_ohci_td *)]; /* padding to 32 bytes */
} __attribute__((packed));
/* OHCI Endpoint Descriptor. */
@ -334,7 +334,7 @@ grub_ohci_pci_iter (grub_pci_device_t dev,
/* Preset free TDs chain in TDs */
grub_memset ((void*)o->td, 0, sizeof(struct grub_ohci_td) * GRUB_OHCI_TDS);
for (j=0; j < (GRUB_OHCI_TDS-1); j++)
o->td[j].link_td = (grub_uint32_t)&o->td[j+1];
o->td[j].link_td = &o->td[j+1];
grub_dprintf ("ohci", "TDs: chunk=%p, virt=%p, phys=0x%02x\n",
o->td_chunk, o->td, o->td_addr);
@ -561,7 +561,7 @@ static void
grub_ohci_free_td (struct grub_ohci *o, grub_ohci_td_t td)
{
grub_memset ( (void*)td, 0, sizeof(struct grub_ohci_td) );
td->link_td = (grub_uint32_t) o->td_free; /* Cahin new free TD & rest */
td->link_td = o->td_free; /* Cahin new free TD & rest */
o->td_free = td; /* Change address of first free TD */
}
@ -604,8 +604,8 @@ grub_ohci_transaction (grub_ohci_td_t td,
grub_uint32_t buffer;
grub_uint32_t buffer_end;
grub_dprintf ("ohci", "OHCI transaction td=%p type=%d, toggle=%d, size=%d\n",
td, type, toggle, size);
grub_dprintf ("ohci", "OHCI transaction td=%p type=%d, toggle=%d, size=%lu\n",
td, type, toggle, (unsigned long) size);
switch (type)
{
@ -780,11 +780,13 @@ grub_ohci_setup_transfer (grub_usb_controller_t dev,
}
/* Chain TDs */
cdata->td_current_virt->link_td = (grub_uint32_t) td_next_virt;
cdata->td_current_virt->next_td
= grub_cpu_to_le32 (grub_ohci_td_virt2phys (o, td_next_virt));
td_next_virt->prev_td_phys
= grub_ohci_td_virt2phys (o, cdata->td_current_virt);
cdata->td_current_virt->link_td = td_next_virt;
cdata->td_current_virt->next_td = grub_cpu_to_le32 (
grub_ohci_td_virt2phys (o,
td_next_virt) );
td_next_virt->prev_td_phys = grub_ohci_td_virt2phys (o,
cdata->td_current_virt);
cdata->td_current_virt = td_next_virt;
}
@ -1486,6 +1488,8 @@ static struct grub_usb_controller_dev usb_controller =
GRUB_MOD_INIT(ohci)
{
COMPILE_TIME_ASSERT (sizeof (struct grub_ohci_td) == 32);
COMPILE_TIME_ASSERT (sizeof (struct grub_ohci_ed) == 16);
grub_ohci_inithw ();
grub_usb_controller_dev_register (&usb_controller);
grub_loader_register_preboot_hook (grub_ohci_fini_hw, grub_ohci_restore_hw,

View file

@ -244,7 +244,7 @@ grub_uhci_pci_iter (grub_pci_device_t dev,
/* Link all Transfer Descriptors in a list of available Transfer
Descriptors. */
for (i = 0; i < 256; i++)
u->td[i].linkptr = (grub_uint32_t) &u->td[i + 1];
u->td[i].linkptr = (grub_uint32_t) (grub_addr_t) &u->td[i + 1];
u->td[255 - 1].linkptr = 0;
u->tdfree = u->td;
@ -254,20 +254,20 @@ grub_uhci_pci_iter (grub_pci_device_t dev,
/* Setup the frame list pointers. Since no isochronous transfers
are and will be supported, they all point to the (same!) queue
head. */
fp = (grub_uint32_t) u->qh & (~15);
fp = (grub_uint32_t) (grub_addr_t) u->qh & (~15);
/* Mark this as a queue head. */
fp |= 2;
for (i = 0; i < 1024; i++)
u->framelist[i] = fp;
/* Program the framelist address into the UHCI controller. */
grub_uhci_writereg32 (u, GRUB_UHCI_REG_FLBASEADD,
(grub_uint32_t) u->framelist);
(grub_uint32_t) (grub_addr_t) u->framelist);
/* Make the Queue Heads point to each other. */
for (i = 0; i < N_QH; i++)
{
/* Point to the next QH. */
u->qh[i].linkptr = (grub_uint32_t) (&u->qh[i + 1]) & (~15);
u->qh[i].linkptr = (grub_uint32_t) (grub_addr_t) (&u->qh[i + 1]) & (~15);
/* This is a QH. */
u->qh[i].linkptr |= GRUB_UHCI_LINK_QUEUE_HEAD;
@ -334,7 +334,7 @@ grub_alloc_td (struct grub_uhci *u)
return NULL;
ret = u->tdfree;
u->tdfree = (grub_uhci_td_t) u->tdfree->linkptr;
u->tdfree = (grub_uhci_td_t) (grub_addr_t) u->tdfree->linkptr;
return ret;
}
@ -342,7 +342,7 @@ grub_alloc_td (struct grub_uhci *u)
static void
grub_free_td (struct grub_uhci *u, grub_uhci_td_t td)
{
td->linkptr = (grub_uint32_t) u->tdfree;
td->linkptr = (grub_uint32_t) (grub_addr_t) u->tdfree;
u->tdfree = td;
}
@ -369,7 +369,7 @@ grub_free_queue (struct grub_uhci *u, grub_uhci_qh_t qh, grub_uhci_td_t td,
/* Unlink the queue. */
tdprev = td;
td = (grub_uhci_td_t) td->linkptr2;
td = (grub_uhci_td_t) (grub_addr_t) td->linkptr2;
/* Free the TD. */
grub_free_td (u, tdprev);
@ -432,8 +432,8 @@ grub_uhci_transaction (struct grub_uhci *u, unsigned int endp,
}
grub_dprintf ("uhci",
"transaction: endp=%d, type=%d, addr=%d, toggle=%d, size=%d data=0x%x td=%p\n",
endp, type, addr, toggle, size, data, td);
"transaction: endp=%d, type=%d, addr=%d, toggle=%d, size=%lu data=0x%x td=%p\n",
endp, type, addr, toggle, (unsigned long) size, data, td);
/* Don't point to any TD, just terminate. */
td->linkptr = 1;
@ -514,8 +514,8 @@ grub_uhci_setup_transfer (grub_usb_controller_t dev,
cdata->td_first = td;
else
{
td_prev->linkptr2 = (grub_uint32_t) td;
td_prev->linkptr = (grub_uint32_t) td;
td_prev->linkptr2 = (grub_uint32_t) (grub_addr_t) td;
td_prev->linkptr = (grub_uint32_t) (grub_addr_t) td;
td_prev->linkptr |= 4;
}
td_prev = td;
@ -527,7 +527,7 @@ grub_uhci_setup_transfer (grub_usb_controller_t dev,
/* Link it into the queue and terminate. Now the transaction can
take place. */
cdata->qh->elinkptr = (grub_uint32_t) cdata->td_first;
cdata->qh->elinkptr = (grub_uint32_t) (grub_addr_t) cdata->td_first;
grub_dprintf ("uhci", "initiate transaction\n");

View file

@ -87,8 +87,8 @@ grub_usb_control_msg (grub_usb_device_t dev,
grub_memcpy ((char *) data, data_in, size);
grub_dprintf ("usb",
"control: reqtype=0x%02x req=0x%02x val=0x%02x idx=0x%02x size=%d\n",
reqtype, request, value, index, size);
"control: reqtype=0x%02x req=0x%02x val=0x%02x idx=0x%02x size=%lu\n",
reqtype, request, value, index, (unsigned long)size);
/* Create a transfer. */
transfer = grub_malloc (sizeof (*transfer));
@ -210,7 +210,8 @@ grub_usb_bulk_setup_readwrite (grub_usb_device_t dev,
grub_size_t size = size0;
int toggle = dev->toggle[endpoint];
grub_dprintf ("usb", "bulk: size=0x%02x type=%d\n", size, type);
grub_dprintf ("usb", "bulk: size=0x%02lx type=%d\n", (unsigned long) size,
type);
/* FIXME: avoid allocation any kind of buffer in a first place. */
data_chunk = grub_memalign_dma32 (128, size);

View file

@ -21,6 +21,7 @@
#include <grub/misc.h>
#include <grub/extcmd.h>
#include <grub/i18n.h>
#include <grub/machine/int.h>
static const struct grub_arg_option options[] =
{
@ -28,6 +29,69 @@ static const struct grub_arg_option options[] =
{0, 0, 0, 0, 0, 0}
};
static inline void __attribute__ ((noreturn))
stop (void)
{
while (1)
{
asm volatile ("hlt");
}
}
/*
* Halt the system, using APM if possible. If NO_APM is true, don't use
* APM even if it is available.
*/
void
grub_halt (int no_apm)
{
struct grub_bios_int_registers regs;
if (no_apm)
stop ();
/* detect APM */
regs.eax = 0x5300;
regs.ebx = 0;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x15, &regs);
if (regs.flags & GRUB_CPU_INT_FLAGS_CARRY)
stop ();
/* disconnect APM first */
regs.eax = 0x5304;
regs.ebx = 0;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x15, &regs);
/* connect APM */
regs.eax = 0x5301;
regs.ebx = 0;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x15, &regs);
if (regs.flags & GRUB_CPU_INT_FLAGS_CARRY)
stop ();
/* set APM protocol level - 1.1 or bust. (this covers APM 1.2 also) */
regs.eax = 0x530E;
regs.ebx = 0;
regs.ecx = 0x0101;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x15, &regs);
if (regs.flags & GRUB_CPU_INT_FLAGS_CARRY)
stop ();
/* set the power state to off */
regs.eax = 0x5307;
regs.ebx = 1;
regs.ecx = 3;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x15, &regs);
/* shouldn't reach here */
stop ();
}
static grub_err_t
grub_cmd_halt (grub_extcmd_t cmd,
int argc __attribute__ ((unused)),

View file

@ -19,6 +19,7 @@
#include <grub/machine/biosdisk.h>
#include <grub/machine/memory.h>
#include <grub/machine/kernel.h>
#include <grub/machine/int.h>
#include <grub/disk.h>
#include <grub/dl.h>
#include <grub/mm.h>
@ -28,6 +29,219 @@
#include <grub/term.h>
static int cd_drive = 0;
static int grub_biosdisk_rw_int13_extensions (int ah, int drive, void *dap);
static int grub_biosdisk_get_num_floppies (void)
{
struct grub_bios_int_registers regs;
int drive;
/* reset the disk system first */
regs.eax = 0;
regs.edx = 0;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x13, &regs);
for (drive = 0; drive < 2; drive++)
{
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT | GRUB_CPU_INT_FLAGS_CARRY;
regs.edx = drive;
/* call GET DISK TYPE */
regs.eax = 0x1500;
grub_bios_interrupt (0x13, &regs);
if (regs.flags & GRUB_CPU_INT_FLAGS_CARRY)
break;
/* check if this drive exists */
if (!(regs.eax & 0x300))
break;
}
return drive;
}
/*
* Call IBM/MS INT13 Extensions (int 13 %ah=AH) for DRIVE. DAP
* is passed for disk address packet. If an error occurs, return
* non-zero, otherwise zero.
*/
static int
grub_biosdisk_rw_int13_extensions (int ah, int drive, void *dap)
{
struct grub_bios_int_registers regs;
regs.eax = ah << 8;
/* compute the address of disk_address_packet */
regs.ds = (((grub_addr_t) dap) & 0xffff0000) >> 4;
regs.esi = (((grub_addr_t) dap) & 0xffff);
regs.edx = drive;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x13, &regs);
return (regs.eax >> 8) & 0xff;
}
/*
* Call standard and old INT13 (int 13 %ah=AH) for DRIVE. Read/write
* NSEC sectors from COFF/HOFF/SOFF into SEGMENT. If an error occurs,
* return non-zero, otherwise zero.
*/
static int
grub_biosdisk_rw_standard (int ah, int drive, int coff, int hoff,
int soff, int nsec, int segment)
{
int ret, i;
/* Try 3 times. */
for (i = 0; i < 3; i++)
{
struct grub_bios_int_registers regs;
/* set up CHS information */
/* set %ch to low eight bits of cylinder */
regs.ecx = (coff << 8) & 0xff00;
/* set bits 6-7 of %cl to high two bits of cylinder */
regs.ecx |= (coff >> 2) & 0xc0;
/* set bits 0-5 of %cl to sector */
regs.ecx |= soff & 0x3f;
/* set %dh to head and %dl to drive */
regs.edx = (drive & 0xff) | ((hoff << 8) & 0xff00);
/* set %ah to AH */
regs.eax = (ah << 8) & 0xff00;
/* set %al to NSEC */
regs.eax |= nsec & 0xff;
regs.ebx = 0;
regs.es = segment;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x13, &regs);
/* check if successful */
if (!(regs.flags & GRUB_CPU_INT_FLAGS_CARRY))
return 0;
/* save return value */
ret = regs.eax >> 8;
/* if fail, reset the disk system */
regs.eax = 0;
regs.edx = (drive & 0xff);
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x13, &regs);
}
return ret;
}
/*
* Check if LBA is supported for DRIVE. If it is supported, then return
* the major version of extensions, otherwise zero.
*/
static int
grub_biosdisk_check_int13_extensions (int drive)
{
struct grub_bios_int_registers regs;
regs.edx = drive & 0xff;
regs.eax = 0x4100;
regs.ebx = 0x55aa;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x13, &regs);
if (regs.flags & GRUB_CPU_INT_FLAGS_CARRY)
return 0;
if ((regs.ebx & 0xffff) != 0xaa55)
return 0;
/* check if AH=0x42 is supported */
if (!(regs.ecx & 1))
return 0;
return (regs.eax >> 8) & 0xff;
}
/*
* Return the geometry of DRIVE in CYLINDERS, HEADS and SECTORS. If an
* error occurs, then return non-zero, otherwise zero.
*/
static int
grub_biosdisk_get_diskinfo_standard (int drive,
unsigned long *cylinders,
unsigned long *heads,
unsigned long *sectors)
{
struct grub_bios_int_registers regs;
regs.eax = 0x0800;
regs.edx = drive & 0xff;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x13, &regs);
/* Check if unsuccessful. Ignore return value if carry isn't set to
workaround some buggy BIOSes. */
if ((regs.flags & GRUB_CPU_INT_FLAGS_CARRY) && ((regs.eax & 0xff00) != 0))
return (regs.eax & 0xff00) >> 8;
/* bogus BIOSes may not return an error number */
/* 0 sectors means no disk */
if (!(regs.ecx & 0x3f))
/* XXX 0x60 is one of the unused error numbers */
return 0x60;
/* the number of heads is counted from zero */
*heads = ((regs.edx >> 8) & 0xff) + 1;
*cylinders = (((regs.ecx >> 8) & 0xff) | ((regs.ecx << 2) & 0x0300)) + 1;
*sectors = regs.ecx & 0x3f;
return 0;
}
static int
grub_biosdisk_get_diskinfo_real (int drive, void *drp, grub_uint16_t ax)
{
struct grub_bios_int_registers regs;
regs.eax = ax;
/* compute the address of drive parameters */
regs.esi = ((grub_addr_t) drp) & 0xf;
regs.ds = ((grub_addr_t) drp) >> 4;
regs.edx = drive & 0xff;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x13, &regs);
/* Check if unsuccessful. Ignore return value if carry isn't set to
workaround some buggy BIOSes. */
if ((regs.flags & GRUB_CPU_INT_FLAGS_CARRY) && ((regs.eax & 0xff00) != 0))
return (regs.eax & 0xff00) >> 8;
return 0;
}
/*
* Return the cdrom information of DRIVE in CDRP. If an error occurs,
* then return non-zero, otherwise zero.
*/
static int
grub_biosdisk_get_cdinfo_int13_extensions (int drive, void *cdrp)
{
return grub_biosdisk_get_diskinfo_real (drive, cdrp, 0x4b01);
}
/*
* Return the geometry of DRIVE in a drive parameters, DRP. If an error
* occurs, then return non-zero, otherwise zero.
*/
static int
grub_biosdisk_get_diskinfo_int13_extensions (int drive, void *drp)
{
return grub_biosdisk_get_diskinfo_real (drive, drp, 0x4800);
}
static int
grub_biosdisk_get_drive (const char *name)

View file

@ -27,6 +27,7 @@
#include <grub/env.h>
#include <grub/machine/pxe.h>
#include <grub/machine/int.h>
#include <grub/machine/memory.h>
#define SEGMENT(x) ((x) >> 4)
@ -55,6 +56,45 @@ struct grub_pxe_data
char filename[0];
};
static grub_uint32_t pxe_rm_entry = 0;
static struct grub_pxenv *
grub_pxe_scan (void)
{
struct grub_bios_int_registers regs;
struct grub_pxenv *ret;
void *pxe;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
regs.ebx = 0;
regs.ecx = 0;
regs.eax = 0x5650;
grub_bios_interrupt (0x1a, &regs);
if ((regs.eax & 0xffff) != 0x564e)
return NULL;
ret = (struct grub_pxenv *) ((regs.es << 4) + (regs.ebx & 0xffff));
if (grub_memcmp (ret->signature, GRUB_PXE_SIGNATURE, sizeof (ret->signature))
!= 0)
return NULL;
if (ret->version < 0x201)
return NULL;
pxe = (void *) ((((ret->pxe_ptr & 0xffff0000) >> 16) << 4)
+ (ret->pxe_ptr & 0xffff));
if (!pxe)
return NULL;
/* !PXE */
if (*(grub_uint32_t *) pxe != 0x45585021)
return NULL;
pxe_rm_entry = ret->rm_entry;
return ret;
}
static int
grub_pxe_iterate (int (*hook) (const char *name))
{
@ -202,14 +242,14 @@ grub_pxefs_open (struct grub_file *file, const char *name)
if (curr_file != 0)
{
grub_pxe_call (GRUB_PXENV_TFTP_CLOSE, &c.c2);
grub_pxe_call (GRUB_PXENV_TFTP_CLOSE, &c.c2, pxe_rm_entry);
curr_file = 0;
}
c.c1.server_ip = disk_data->server_ip;
c.c1.gateway_ip = disk_data->gateway_ip;
grub_strcpy ((char *)&c.c1.filename[0], name);
grub_pxe_call (GRUB_PXENV_TFTP_GET_FSIZE, &c.c1);
grub_pxe_call (GRUB_PXENV_TFTP_GET_FSIZE, &c.c1, pxe_rm_entry);
if (c.c1.status)
return grub_error (GRUB_ERR_FILE_NOT_FOUND, "file not found");
@ -217,7 +257,7 @@ grub_pxefs_open (struct grub_file *file, const char *name)
c.c2.tftp_port = grub_cpu_to_be16 (GRUB_PXE_TFTP_PORT);
c.c2.packet_size = grub_pxe_blksize;
grub_pxe_call (GRUB_PXENV_TFTP_OPEN, &c.c2);
grub_pxe_call (GRUB_PXENV_TFTP_OPEN, &c.c2, pxe_rm_entry);
if (c.c2.status)
return grub_error (GRUB_ERR_BAD_FS, "open fails");
@ -275,14 +315,14 @@ grub_pxefs_read (grub_file_t file, char *buf, grub_size_t len)
struct grub_pxenv_tftp_open o;
if (curr_file != 0)
grub_pxe_call (GRUB_PXENV_TFTP_CLOSE, &o);
grub_pxe_call (GRUB_PXENV_TFTP_CLOSE, &o, pxe_rm_entry);
o.server_ip = disk_data->server_ip;
o.gateway_ip = disk_data->gateway_ip;
grub_strcpy ((char *)&o.filename[0], data->filename);
o.tftp_port = grub_cpu_to_be16 (GRUB_PXE_TFTP_PORT);
o.packet_size = grub_pxe_blksize;
grub_pxe_call (GRUB_PXENV_TFTP_OPEN, &o);
grub_pxe_call (GRUB_PXENV_TFTP_OPEN, &o, pxe_rm_entry);
if (o.status)
{
grub_error (GRUB_ERR_BAD_FS, "open fails");
@ -297,7 +337,7 @@ grub_pxefs_read (grub_file_t file, char *buf, grub_size_t len)
while (pn >= data->packet_number)
{
c.buffer_size = data->block_size;
grub_pxe_call (GRUB_PXENV_TFTP_READ, &c);
grub_pxe_call (GRUB_PXENV_TFTP_READ, &c, pxe_rm_entry);
if (c.status)
{
grub_error (GRUB_ERR_BAD_FS, "read fails");
@ -318,7 +358,7 @@ grub_pxefs_close (grub_file_t file)
if (curr_file == file)
{
grub_pxe_call (GRUB_PXENV_TFTP_CLOSE, &c);
grub_pxe_call (GRUB_PXENV_TFTP_CLOSE, &c, pxe_rm_entry);
curr_file = 0;
}
@ -454,7 +494,7 @@ grub_pxe_detect (void)
ci.packet_type = GRUB_PXENV_PACKET_TYPE_DHCP_ACK;
ci.buffer = 0;
ci.buffer_size = 0;
grub_pxe_call (GRUB_PXENV_GET_CACHED_INFO, &ci);
grub_pxe_call (GRUB_PXENV_GET_CACHED_INFO, &ci, pxe_rm_entry);
if (ci.status)
return;

View file

@ -174,15 +174,6 @@ grub_reboot (void)
}
#endif
void
grub_halt (void)
{
grub_efi_fini ();
efi_call_4 (grub_efi_system_table->runtime_services->reset_system,
GRUB_EFI_RESET_SHUTDOWN, GRUB_EFI_SUCCESS, 0, NULL);
for (;;) ;
}
grub_err_t
grub_efi_set_virtual_address_map (grub_efi_uintn_t memory_map_size,
grub_efi_uintn_t descriptor_size,

View file

@ -66,16 +66,6 @@ grub_reboot (void)
longjmp (main_env, 1);
}
void
grub_halt (
#ifdef GRUB_MACHINE_PCBIOS
int no_apm __attribute__ ((unused))
#endif
)
{
grub_reboot ();
}
void
grub_machine_init (void)
{

View file

@ -19,7 +19,6 @@
#include <grub/kernel.h>
#include <grub/mm.h>
#include <grub/machine/time.h>
#include <grub/machine/init.h>
#include <grub/machine/memory.h>
#include <grub/machine/console.h>
#include <grub/types.h>
@ -32,13 +31,12 @@
#include <grub/time.h>
#include <grub/symbol.h>
#include <grub/cpu/io.h>
#include <grub/cpu/floppy.h>
#include <grub/cpu/tsc.h>
#ifdef GRUB_MACHINE_QEMU
#include <grub/machine/kernel.h>
#endif
#define GRUB_FLOPPY_REG_DIGITAL_OUTPUT 0x3f2
extern char _start[];
extern char _end[];
@ -48,14 +46,6 @@ grub_get_rtc (void)
grub_fatal ("grub_get_rtc() is not implemented.\n");
}
/* Stop the floppy drive from spinning, so that other software is
jumped to with a known state. */
void
grub_stop_floppy (void)
{
grub_outb (0, GRUB_FLOPPY_REG_DIGITAL_OUTPUT);
}
void
grub_exit (void)
{

View file

@ -23,6 +23,7 @@
#include <grub/machine/memory.h>
#include <grub/machine/console.h>
#include <grub/machine/kernel.h>
#include <grub/machine/int.h>
#include <grub/types.h>
#include <grub/err.h>
#include <grub/dl.h>
@ -139,6 +140,22 @@ compact_mem_regions (void)
}
}
/*
*
* grub_get_conv_memsize(i) : return the conventional memory size in KB.
* BIOS call "INT 12H" to get conventional memory size
* The return value in AX.
*/
static inline grub_uint16_t
grub_get_conv_memsize (void)
{
struct grub_bios_int_registers regs;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x12, &regs);
return regs.eax & 0xffff;
}
void
grub_machine_init (void)
{
@ -148,7 +165,7 @@ grub_machine_init (void)
/* Initialize the console as early as possible. */
grub_console_init ();
grub_lower_mem = grub_get_memsize (0) << 10;
grub_lower_mem = grub_get_conv_memsize () << 10;
/* Sanity check. */
if (grub_lower_mem < GRUB_MEMORY_MACHINE_RESERVED_END)

View file

@ -17,11 +17,98 @@
*/
#include <grub/machine/init.h>
#include <grub/machine/int.h>
#include <grub/machine/memory.h>
#include <grub/err.h>
#include <grub/types.h>
#include <grub/misc.h>
/*
* grub_get_ext_memsize() : return the extended memory size in KB.
* BIOS call "INT 15H, AH=88H" to get extended memory size
* The return value in AX.
*
*/
static inline grub_uint16_t
grub_get_ext_memsize (void)
{
struct grub_bios_int_registers regs;
regs.eax = 0x8800;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x15, &regs);
return regs.eax & 0xffff;
}
/* Get a packed EISA memory map. Lower 16 bits are between 1MB and 16MB
in 1KB parts, and upper 16 bits are above 16MB in 64KB parts. If error, return zero.
BIOS call "INT 15H, AH=E801H" to get EISA memory map,
AX = memory between 1M and 16M in 1K parts.
BX = memory above 16M in 64K parts.
*/
static inline grub_uint32_t
grub_get_eisa_mmap (void)
{
struct grub_bios_int_registers regs;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
regs.eax = 0xe801;
grub_bios_interrupt (0x15, &regs);
if ((regs.eax & 0xff00) == 0x8600)
return 0;
return (regs.eax & 0xffff) | (regs.ebx << 16);
}
/*
*
* grub_get_mmap_entry(addr, cont) : address and old continuation value (zero to
* start), for the Query System Address Map BIOS call.
*
* Sets the first 4-byte int value of "addr" to the size returned by
* the call. If the call fails, sets it to zero.
*
* Returns: new (non-zero) continuation value, 0 if done.
*/
/* Get a memory map entry. Return next continuation value. Zero means
the end. */
static grub_uint32_t
grub_get_mmap_entry (struct grub_machine_mmap_entry *entry,
grub_uint32_t cont)
{
struct grub_bios_int_registers regs;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
/* place address (+4) in ES:DI */
regs.es = ((grub_addr_t) &entry->addr) >> 4;
regs.edi = ((grub_addr_t) &entry->addr) & 0xf;
/* set continuation value */
regs.ebx = cont;
/* set default maximum buffer size */
regs.ecx = sizeof (*entry) - sizeof (entry->size);
/* set EDX to 'SMAP' */
regs.edx = 0x534d4150;
regs.eax = 0xe820;
grub_bios_interrupt (0x15, &regs);
/* write length of buffer (zero if error) into ADDR */
if ((regs.flags & GRUB_CPU_INT_FLAGS_CARRY) || regs.eax != 0x534d4150
|| regs.ecx < 0x14 || regs.ecx > 0x400)
entry->size = 0;
else
entry->size = regs.ecx;
/* return the continuation value */
return regs.ebx;
}
grub_err_t
grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uint64_t, grub_uint32_t))
{
@ -61,7 +148,7 @@ grub_machine_mmap_iterate (int NESTED_FUNC_ATTR (*hook) (grub_uint64_t, grub_uin
hook (0x1000000, eisa_mmap & ~0xFFFF, GRUB_MACHINE_MEMORY_AVAILABLE);
}
else
hook (0x100000, grub_get_memsize (1) << 10, GRUB_MACHINE_MEMORY_AVAILABLE);
hook (0x100000, grub_get_ext_memsize () << 10, GRUB_MACHINE_MEMORY_AVAILABLE);
}
return 0;

File diff suppressed because it is too large Load diff

View file

@ -16,7 +16,6 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/machine/init.h>
#include <grub/machine/memory.h>
#include <grub/machine/boot.h>
#include <grub/types.h>

View file

@ -94,6 +94,9 @@ codestart:
call EXT_C(grub_main)
/* This should never happen. */
jmp EXT_C(grub_stop)
cli
1:
hlt
jmp 1b
#include "../realmode.S"

View file

@ -423,14 +423,3 @@ grub_reboot (void)
for (;;) ;
}
#endif
void
grub_halt (void)
{
/* Not standardized. We try three known commands. */
grub_ieee1275_interpret ("shut-down", 0);
grub_ieee1275_interpret ("power-off", 0);
grub_ieee1275_interpret ("poweroff", 0);
for (;;) ;
}

View file

@ -1,6 +1,7 @@
/* efi.c - generic EFI support */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 1999,2000,2001,2002,2003,2005,2006,2007,2008 Free Software Foundation, Inc.
* Copyright (C) 2006,2007,2008,2009,2010 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -16,14 +17,18 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/symbol.h>
#include <grub/efi/api.h>
#include <grub/efi/efi.h>
#include <grub/misc.h>
#include <grub/mm.h>
#include <grub/kernel.h>
.text
/*
* This call is special... it never returns... in fact it should simply
* hang at this point!
*/
FUNCTION(grub_stop)
cli
1: hlt
jmp 1b
void
grub_halt (void)
{
grub_machine_fini ();
efi_call_4 (grub_efi_system_table->runtime_services->reset_system,
GRUB_EFI_RESET_SHUTDOWN, GRUB_EFI_SUCCESS, 0, NULL);
while (1);
}

View file

@ -1,7 +1,6 @@
/* init.c -- Initialize GRUB on Open Firmware. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2003,2004,2005,2007,2008 Free Software Foundation, Inc.
* Copyright (C) 2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -17,12 +16,10 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#include <grub/types.h>
#include <grub/cache.h>
void grub_stop_floppy (void);
#include <grub/misc.h>
void
grub_stop_floppy (void)
grub_halt (void)
{
grub_reboot ();
}

View file

@ -17,11 +17,24 @@
*/
#include <grub/cpu/io.h>
#include <grub/machine/init.h>
#include <grub/misc.h>
const char bochs_shutdown[] = "Shutdown";
/*
* This call is special... it never returns... in fact it should simply
* hang at this point!
*/
static inline void __attribute__ ((noreturn))
stop (void)
{
asm volatile ("cli");
while (1)
{
asm volatile ("hlt");
}
}
void
grub_halt (void)
{
@ -38,5 +51,5 @@ grub_halt (void)
/* In order to return we'd have to check what the previous status of IF
flag was. But user most likely doesn't want to return anyway ... */
grub_stop ();
stop ();
}

View file

@ -1,6 +1,7 @@
/* openfw.c -- Open firmware support functions. */
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2007 Free Software Foundation, Inc.
* Copyright (C) 2003,2004,2005,2007,2008,2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@ -16,13 +17,17 @@
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_INIT_I386_LINUXBIOS_HEADER
#define GRUB_INIT_I386_LINUXBIOS_HEADER 1
#include <grub/ieee1275/ieee1275.h>
#include <grub/misc.h>
#include <grub/symbol.h>
#include <grub/i386/pc/memory.h>
void
grub_halt (void)
{
/* Not standardized. We try three known commands. */
void EXPORT_FUNC(grub_stop) (void) __attribute__ ((noreturn));
void EXPORT_FUNC(grub_stop_floppy) (void);
grub_ieee1275_interpret ("shut-down", 0);
grub_ieee1275_interpret ("power-off", 0);
grub_ieee1275_interpret ("poweroff", 0);
#endif
while (1);
}

View file

@ -34,6 +34,7 @@
#include <grub/mm.h>
#include <grub/cpu/relocator.h>
#include <grub/video.h>
#include <grub/i386/floppy.h>
#define GRUB_LINUX_CL_OFFSET 0x9000
#define GRUB_LINUX_CL_END_OFFSET 0x90FF
@ -61,6 +62,8 @@ grub_linux16_boot (void)
grub_video_set_mode ("text", 0, 0);
grub_stop_floppy ();
return grub_relocator16_boot (relocator, state);
}

View file

@ -123,7 +123,6 @@ static grub_uint64_t
guessfsb (void)
{
const grub_uint64_t sane_value = 100000000;
#ifndef GRUB_MACHINE_IEEE1275
grub_uint32_t manufacturer[3], max_cpuid, capabilities, msrlow;
grub_uint64_t start_tsc;
grub_uint64_t end_tsc;
@ -209,9 +208,6 @@ guessfsb (void)
return grub_divmod64 (2000 * tsc_ticks_per_ms,
((msrlow >> 7) & 0x3e) + ((msrlow >> 14) & 1), 0);
#else
return sane_value;
#endif
}
struct property_descriptor

View file

@ -28,6 +28,7 @@
#include <grub/misc.h>
#include <grub/mm.h>
#include <grub/video.h>
#include <grub/machine/int.h>
static int vbe_detected = -1;
@ -58,6 +59,200 @@ real2pm (grub_vbe_farptr_t ptr)
+ ((unsigned long) ptr & 0x0000FFFF));
}
/* Call VESA BIOS 0x4f09 to set palette data, return status. */
static grub_vbe_status_t
grub_vbe_bios_set_palette_data (grub_uint32_t color_count,
grub_uint32_t start_index,
struct grub_vbe_palette_data *palette_data)
{
struct grub_bios_int_registers regs;
regs.eax = 0x4f09;
regs.ebx = 0;
regs.ecx = color_count;
regs.edx = start_index;
regs.es = (((grub_addr_t) palette_data) & 0xffff0000) >> 4;
regs.edi = ((grub_addr_t) palette_data) & 0xffff;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x10, &regs);
return regs.eax & 0xffff;
}
/* Call VESA BIOS 0x4f00 to get VBE Controller Information, return status. */
grub_vbe_status_t
grub_vbe_bios_get_controller_info (struct grub_vbe_info_block *ci)
{
struct grub_bios_int_registers regs;
/* Store *controller_info to %es:%di. */
regs.es = (((grub_addr_t) ci) & 0xffff0000) >> 4;
regs.edi = ((grub_addr_t) ci) & 0xffff;
regs.eax = 0x4f00;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x10, &regs);
return regs.eax & 0xffff;
}
/* Call VESA BIOS 0x4f01 to get VBE Mode Information, return status. */
grub_vbe_status_t
grub_vbe_bios_get_mode_info (grub_uint32_t mode,
struct grub_vbe_mode_info_block *mode_info)
{
struct grub_bios_int_registers regs;
regs.eax = 0x4f01;
regs.ecx = mode;
/* Store *mode_info to %es:%di. */
regs.es = ((grub_addr_t) mode_info & 0xffff0000) >> 4;
regs.edi = (grub_addr_t) mode_info & 0x0000ffff;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x10, &regs);
return regs.eax & 0xffff;
}
/* Call VESA BIOS 0x4f02 to set video mode, return status. */
static grub_vbe_status_t
grub_vbe_bios_set_mode (grub_uint32_t mode,
struct grub_vbe_crtc_info_block *crtc_info)
{
struct grub_bios_int_registers regs;
regs.eax = 0x4f02;
regs.ebx = mode;
/* Store *crtc_info to %es:%di. */
regs.es = (((grub_addr_t) crtc_info) & 0xffff0000) >> 4;
regs.edi = ((grub_addr_t) crtc_info) & 0xffff;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x10, &regs);
return regs.eax & 0xffff;
}
/* Call VESA BIOS 0x4f03 to return current VBE Mode, return status. */
grub_vbe_status_t
grub_vbe_bios_get_mode (grub_uint32_t *mode)
{
struct grub_bios_int_registers regs;
regs.eax = 0x4f03;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x10, &regs);
*mode = regs.ebx & 0xffff;
return regs.eax & 0xffff;
}
grub_vbe_status_t
grub_vbe_bios_getset_dac_palette_width (int set, int *dac_mask_size)
{
struct grub_bios_int_registers regs;
regs.eax = 0x4f08;
regs.ebx = (*dac_mask_size & 0xff) >> 8;
regs.ebx = set ? 1 : 0;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x10, &regs);
*dac_mask_size = (regs.ebx >> 8) & 0xff;
return regs.eax & 0xffff;
}
/* Call VESA BIOS 0x4f05 to set memory window, return status. */
grub_vbe_status_t
grub_vbe_bios_set_memory_window (grub_uint32_t window,
grub_uint32_t position)
{
struct grub_bios_int_registers regs;
/* BL = window, BH = 0, Set memory window. */
regs.ebx = window & 0x00ff;
regs.edx = position;
regs.eax = 0x4f05;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x10, &regs);
return regs.eax & 0xffff;
}
/* Call VESA BIOS 0x4f05 to return memory window, return status. */
grub_vbe_status_t
grub_vbe_bios_get_memory_window (grub_uint32_t window,
grub_uint32_t *position)
{
struct grub_bios_int_registers regs;
regs.eax = 0x4f05;
/* BH = 1, Get memory window. BL = window. */
regs.ebx = (window & 0x00ff) | 0x100;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x10, &regs);
*position = regs.edx & 0xffff;
return regs.eax & 0xffff;
}
/* Call VESA BIOS 0x4f06 to set scanline length (in bytes), return status. */
grub_vbe_status_t
grub_vbe_bios_set_scanline_length (grub_uint32_t length)
{
struct grub_bios_int_registers regs;
regs.ecx = length;
regs.eax = 0x4f06;
/* BL = 2, Set Scan Line in Bytes. */
regs.ebx = 0x0002;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x10, &regs);
return regs.eax & 0xffff;
}
/* Call VESA BIOS 0x4f06 to return scanline length (in bytes), return status. */
grub_vbe_status_t
grub_vbe_bios_get_scanline_length (grub_uint32_t *length)
{
struct grub_bios_int_registers regs;
regs.eax = 0x4f06;
regs.ebx = 0x0001;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
/* BL = 1, Get Scan Line Length (in bytes). */
grub_bios_interrupt (0x10, &regs);
*length = regs.ebx & 0xffff;
return regs.eax & 0xffff;
}
/* Call VESA BIOS 0x4f07 to set display start, return status. */
static grub_vbe_status_t
grub_vbe_bios_set_display_start (grub_uint32_t x, grub_uint32_t y)
{
struct grub_bios_int_registers regs;
/* Store x in %ecx. */
regs.ecx = x;
regs.edx = y;
regs.eax = 0x4f07;
/* BL = 80h, Set Display Start during Vertical Retrace. */
regs.ebx = 0x0080;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x10, &regs);
return regs.eax & 0xffff;
}
/* Call VESA BIOS 0x4f07 to get display start, return status. */
grub_vbe_status_t
grub_vbe_bios_get_display_start (grub_uint32_t *x,
grub_uint32_t *y)
{
struct grub_bios_int_registers regs;
regs.eax = 0x4f07;
/* BL = 1, Get Display Start. */
regs.ebx = 0x0001;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x10, &regs);
*x = regs.ecx & 0xffff;
*y = regs.edx & 0xffff;
return regs.eax & 0xffff;
}
grub_err_t
grub_vbe_probe (struct grub_vbe_info_block *info_block)
{

View file

@ -19,6 +19,7 @@
#define grub_video_render_target grub_video_fbrender_target
#include <grub/machine/vga.h>
#include <grub/machine/int.h>
#include <grub/machine/console.h>
#include <grub/cpu/io.h>
#include <grub/mm.h>
@ -46,6 +47,25 @@ static struct
int back_page;
} framebuffer;
static unsigned char
grub_vga_set_mode (unsigned char mode)
{
struct grub_bios_int_registers regs;
unsigned char ret;
/* get current mode */
regs.eax = 0x0f00;
regs.ebx = 0;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x10, &regs);
ret = regs.eax & 0xff;
regs.eax = mode;
regs.flags = GRUB_CPU_INT_FLAGS_DEFAULT;
grub_bios_interrupt (0x10, &regs);
return ret;
}
static inline void
wait_vretrace (void)
{

View file

@ -0,0 +1,36 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2002,2003,2004,2005,2006,2007,2008,2009,2010 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_FLOPPY_CPU_HEADER
#define GRUB_FLOPPY_CPU_HEADER 1
#define GRUB_FLOPPY_REG_DIGITAL_OUTPUT 0x3f2
#ifndef ASM_FILE
#include <grub/cpu/io.h>
/* Stop the floppy drive from spinning, so that other software is
jumped to with a known state. */
static inline void
grub_stop_floppy (void)
{
grub_outb (0, GRUB_FLOPPY_REG_DIGITAL_OUTPUT);
}
#endif
#endif

View file

@ -1 +0,0 @@
#include <grub/i386/coreboot/init.h>

View file

@ -106,21 +106,4 @@ struct grub_biosdisk_dap
grub_uint64_t block;
} __attribute__ ((packed));
int EXPORT_FUNC(grub_biosdisk_rw_int13_extensions) (int ah, int drive, void *dap);
int EXPORT_FUNC(grub_biosdisk_rw_standard) (int ah, int drive, int coff, int hoff,
int soff, int nsec, int segment);
int EXPORT_FUNC(grub_biosdisk_check_int13_extensions) (int drive);
int EXPORT_FUNC(grub_biosdisk_get_diskinfo_int13_extensions) (int drive,
void *drp);
int EXPORT_FUNC(grub_biosdisk_get_cdinfo_int13_extensions) (int drive,
void *cdrp);
int EXPORT_FUNC(grub_biosdisk_get_diskinfo_standard) (int drive,
unsigned long *cylinders,
unsigned long *heads,
unsigned long *sectors);
int EXPORT_FUNC(grub_biosdisk_get_num_floppies) (void);
void grub_biosdisk_init (void);
void grub_biosdisk_fini (void);
#endif /* ! GRUB_BIOSDISK_MACHINE_HEADER */

View file

@ -22,23 +22,9 @@
#include <grub/types.h>
#include <grub/symbol.h>
#include <grub/machine/memory.h>
/* Get the memory size in KB. If EXTENDED is zero, return conventional
memory, otherwise return extended memory. */
grub_uint16_t grub_get_memsize (int extended);
/* Get a packed EISA memory map. Lower 16 bits are between 1MB and 16MB
in 1KB parts, and upper 16 bits are above 16MB in 64KB parts. */
grub_uint32_t grub_get_eisa_mmap (void);
/* Get a memory map entry. Return next continuation value. Zero means
the end. */
grub_uint32_t grub_get_mmap_entry (struct grub_machine_mmap_entry *entry,
grub_uint32_t cont);
#include <grub/cpu/floppy.h>
/* Turn on/off Gate A20. */
void grub_gate_a20 (int on);
void EXPORT_FUNC(grub_stop_floppy) (void);
#endif /* ! GRUB_INIT_MACHINE_HEADER */

View file

@ -0,0 +1,52 @@
/*
* GRUB -- GRand Unified Bootloader
* Copyright (C) 2009 Free Software Foundation, Inc.
*
* GRUB is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* GRUB is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with GRUB. If not, see <http://www.gnu.org/licenses/>.
*/
#ifndef GRUB_INTERRUPT_MACHINE_HEADER
#define GRUB_INTERRUPT_MACHINE_HEADER 1
#include <grub/symbol.h>
struct grub_bios_int_registers
{
grub_uint32_t eax;
grub_uint16_t es;
grub_uint16_t ds;
grub_uint16_t flags;
grub_uint16_t dummy;
grub_uint32_t ebx;
grub_uint32_t ecx;
grub_uint32_t edi;
grub_uint32_t esi;
grub_uint32_t edx;
};
#define GRUB_CPU_INT_FLAGS_CARRY 0x1
#define GRUB_CPU_INT_FLAGS_PARITY 0x4
#define GRUB_CPU_INT_FLAGS_ADJUST 0x10
#define GRUB_CPU_INT_FLAGS_ZERO 0x40
#define GRUB_CPU_INT_FLAGS_SIGN 0x80
#define GRUB_CPU_INT_FLAGS_TRAP 0x100
#define GRUB_CPU_INT_FLAGS_INTERRUPT 0x200
#define GRUB_CPU_INT_FLAGS_DIRECTION 0x400
#define GRUB_CPU_INT_FLAGS_OVERFLOW 0x800
#define GRUB_CPU_INT_FLAGS_DEFAULT GRUB_CPU_INT_FLAGS_INTERRUPT
void EXPORT_FUNC (grub_bios_interrupt) (grub_uint8_t intno,
struct grub_bios_int_registers *regs);
#endif

View file

@ -168,6 +168,8 @@
#ifndef ASM_FILE
#define GRUB_PXE_SIGNATURE "PXENV+"
struct grub_pxenv
{
grub_uint8_t signature[6]; /* 'PXENV+'. */
@ -302,8 +304,7 @@ struct grub_pxenv_unload_stack
grub_uint8_t reserved[10];
} __attribute__ ((packed));
struct grub_pxenv * EXPORT_FUNC(grub_pxe_scan) (void);
int EXPORT_FUNC(grub_pxe_call) (int func, void * data);
int EXPORT_FUNC(grub_pxe_call) (int func, void * data, grub_uint32_t pxe_rm_entry);
extern struct grub_pxenv *grub_pxe_pxenv;

View file

@ -169,56 +169,40 @@ struct grub_vbe_palette_data
grub_uint8_t alignment;
} __attribute__ ((packed));
/* Prototypes for kernel real mode thunks. */
/* Prototypes for helper functions. */
/* Call VESA BIOS 0x4f00 to get VBE Controller Information, return status. */
grub_vbe_status_t EXPORT_FUNC(grub_vbe_bios_get_controller_info) (struct grub_vbe_info_block *controller_info);
grub_vbe_status_t
grub_vbe_bios_get_controller_info (struct grub_vbe_info_block *controller_info);
/* Call VESA BIOS 0x4f01 to get VBE Mode Information, return status. */
grub_vbe_status_t EXPORT_FUNC(grub_vbe_bios_get_mode_info) (grub_uint32_t mode,
struct grub_vbe_mode_info_block *mode_info);
grub_vbe_status_t
grub_vbe_bios_get_mode_info (grub_uint32_t mode,
struct grub_vbe_mode_info_block *mode_info);
/* Call VESA BIOS 0x4f03 to return current VBE Mode, return status. */
grub_vbe_status_t
grub_vbe_bios_get_mode (grub_uint32_t *mode);
/* Call VESA BIOS 0x4f05 to set memory window, return status. */
grub_vbe_status_t
grub_vbe_bios_set_memory_window (grub_uint32_t window, grub_uint32_t position);
/* Call VESA BIOS 0x4f05 to return memory window, return status. */
grub_vbe_status_t
grub_vbe_bios_get_memory_window (grub_uint32_t window,
grub_uint32_t *position);
/* Call VESA BIOS 0x4f06 to set scanline length (in bytes), return status. */
grub_vbe_status_t
grub_vbe_bios_set_scanline_length (grub_uint32_t length);
/* Call VESA BIOS 0x4f06 to return scanline length (in bytes), return status. */
grub_vbe_status_t
grub_vbe_bios_get_scanline_length (grub_uint32_t *length);
/* Call VESA BIOS 0x4f07 to get display start, return status. */
grub_vbe_status_t
grub_vbe_bios_get_display_start (grub_uint32_t *x,
grub_uint32_t *y);
grub_vbe_status_t EXPORT_FUNC(grub_vbe_bios_getset_dac_palette_width) (int set, int *width);
grub_vbe_status_t grub_vbe_bios_getset_dac_palette_width (int set, int *width);
#define grub_vbe_bios_get_dac_palette_width(width) grub_vbe_bios_getset_dac_palette_width(0, (width))
#define grub_vbe_bios_set_dac_palette_width(width) grub_vbe_bios_getset_dac_palette_width(1, (width))
/* Call VESA BIOS 0x4f02 to set video mode, return status. */
grub_vbe_status_t EXPORT_FUNC(grub_vbe_bios_set_mode) (grub_uint32_t mode,
struct grub_vbe_crtc_info_block *crtc_info);
/* Call VESA BIOS 0x4f03 to return current VBE Mode, return status. */
grub_vbe_status_t EXPORT_FUNC(grub_vbe_bios_get_mode) (grub_uint32_t *mode);
/* Call VESA BIOS 0x4f05 to set memory window, return status. */
grub_vbe_status_t EXPORT_FUNC(grub_vbe_bios_set_memory_window) (grub_uint32_t window,
grub_uint32_t position);
/* Call VESA BIOS 0x4f05 to return memory window, return status. */
grub_vbe_status_t EXPORT_FUNC(grub_vbe_bios_get_memory_window) (grub_uint32_t window,
grub_uint32_t *position);
/* Call VESA BIOS 0x4f06 to set scanline length (in bytes), return status. */
grub_vbe_status_t EXPORT_FUNC(grub_vbe_bios_set_scanline_length) (grub_uint32_t length);
/* Call VESA BIOS 0x4f06 to return scanline length (in bytes), return status. */
grub_vbe_status_t EXPORT_FUNC(grub_vbe_bios_get_scanline_length) (grub_uint32_t *length);
/* Call VESA BIOS 0x4f07 to set display start, return status. */
grub_vbe_status_t EXPORT_FUNC(grub_vbe_bios_set_display_start) (grub_uint32_t x,
grub_uint32_t y);
/* Call VESA BIOS 0x4f07 to get display start, return status. */
grub_vbe_status_t EXPORT_FUNC(grub_vbe_bios_get_display_start) (grub_uint32_t *x,
grub_uint32_t *y);
/* Call VESA BIOS 0x4f09 to set palette data, return status. */
grub_vbe_status_t EXPORT_FUNC(grub_vbe_bios_set_palette_data) (grub_uint32_t color_count,
grub_uint32_t start_index,
struct grub_vbe_palette_data *palette_data);
/* Prototypes for helper functions. */
grub_err_t grub_vbe_probe (struct grub_vbe_info_block *info_block);
grub_err_t grub_vbe_set_video_mode (grub_uint32_t mode,
struct grub_vbe_mode_info_block *mode_info);

View file

@ -25,7 +25,4 @@
/* The VGA (at the beginning of upper memory). */
#define GRUB_MEMORY_MACHINE_VGA_ADDR GRUB_MEMORY_MACHINE_UPPER
/* Set the video mode to MODE and return the previous mode. */
unsigned char EXPORT_FUNC(grub_vga_set_mode) (unsigned char mode);
#endif /* ! GRUB_VGA_MACHINE_HEADER */

View file

@ -1 +0,0 @@
#include <grub/i386/coreboot/init.h>

View file

@ -26,8 +26,7 @@ enum
{
OBJ_TYPE_ELF,
OBJ_TYPE_MEMDISK,
OBJ_TYPE_CONFIG,
OBJ_TYPE_FONT
OBJ_TYPE_CONFIG
};
/* The module header. */

View file

@ -23,8 +23,8 @@
#ifndef ASM_FILE
void EXPORT_FUNC (grub_reboot) (void);
void EXPORT_FUNC (grub_halt) (void);
void EXPORT_FUNC (grub_reboot) (void) __attribute__ ((noreturn));
void EXPORT_FUNC (grub_halt) (void) __attribute__ ((noreturn));
#endif

View file

@ -321,9 +321,9 @@ void EXPORT_FUNC (grub_reboot) (void) __attribute__ ((noreturn));
#ifdef GRUB_MACHINE_PCBIOS
/* Halt the system, using APM if possible. If NO_APM is true, don't
* use APM even if it is available. */
void EXPORT_FUNC (grub_halt) (int no_apm) __attribute__ ((noreturn));
void grub_halt (int no_apm) __attribute__ ((noreturn));
#else
void EXPORT_FUNC (grub_halt) (void) __attribute__ ((noreturn));
void grub_halt (void) __attribute__ ((noreturn));
#endif
#ifdef GRUB_MACHINE_EMU

View file

@ -30,7 +30,6 @@ PACKAGE_VERSION=@PACKAGE_VERSION@
target_cpu=@target_cpu@
platform=@platform@
host_os=@host_os@
font=@datadir@/@PACKAGE_TARNAME@/ascii.pf2
pkglibdir=${libdir}/`echo ${PACKAGE_TARNAME}/${target_cpu}-${platform} | sed ${transform}`
localedir=@datadir@/locale
@ -84,11 +83,6 @@ if [ "${target_cpu}-${platform}" = "i386-pc" ] ; then
cat <<EOF
--disk-module=MODULE disk module to use
EOF
fi
if [ "${target_cpu}-${platform}" = "mips-yeeloong" ] ; then
cat <<EOF
--font=FILE font file to use
EOF
fi
cat <<EOF
@ -134,10 +128,11 @@ do
--modules=*)
modules=`echo "$option" | sed 's/--modules=//'` ;;
# Accept and ignore for compatibility
--font)
font=`argument $option "$@"`; shift;;
shift;;
--font=*)
font=`echo "$option" | sed 's/--font=//'` ;;
;;
--root-directory)
rootdir=`argument $option "$@"`; shift;;
@ -415,7 +410,7 @@ if [ "${target_cpu}-${platform}" = "i386-pc" ] || [ "${target_cpu}-${platform}"
$grub_setup ${setup_verbose} ${setup_force} --directory=${grubdir} --device-map=${device_map} \
${install_device} || exit 1
elif [ "${target_cpu}-${platform}" = "mips-yeeloong" ] ; then
$grub_mkimage ${config_opt} -f ${font} -d ${pkglibdir} -O ${mkimage_target} --output=/boot/grub.elf --prefix=${prefix_drive}${relative_grubdir} $modules || exit 1
$grub_mkimage ${config_opt} -d ${pkglibdir} -O ${mkimage_target} --output=/boot/grub.elf --prefix=${prefix_drive}${relative_grubdir} $modules || exit 1
else
$grub_mkimage -O ${mkimage_target} ${config_opt} -d ${pkglibdir} --output=/boot/multiboot.img --prefix=${prefix_drive}${relative_grubdir} $modules || exit 1
fi

View file

@ -507,12 +507,12 @@ struct fixup_block_list
static void
generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
char *memdisk_path, char *font_path, char *config_path,
char *memdisk_path, char *config_path,
struct image_target_desc *image_target, int note)
{
char *kernel_img, *core_img;
size_t kernel_size, total_module_size, core_size, exec_size;
size_t memdisk_size = 0, font_size = 0, config_size = 0, config_size_pure = 0;
size_t memdisk_size = 0, config_size = 0, config_size_pure = 0;
char *kernel_path;
size_t offset;
struct grub_util_path_list *path_list, *p, *next;
@ -536,12 +536,6 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
total_module_size += memdisk_size + sizeof (struct grub_module_header);
}
if (font_path)
{
font_size = ALIGN_ADDR (grub_util_get_image_size (font_path));
total_module_size += font_size + sizeof (struct grub_module_header);
}
if (config_path)
{
config_size_pure = grub_util_get_image_size (config_path) + 1;
@ -625,20 +619,6 @@ generate_image (const char *dir, char *prefix, FILE *out, char *mods[],
offset += memdisk_size;
}
if (font_path)
{
struct grub_module_header *header;
header = (struct grub_module_header *) (kernel_img + offset);
memset (header, 0, sizeof (struct grub_module_header));
header->type = grub_host_to_target32 (OBJ_TYPE_FONT);
header->size = grub_host_to_target32 (font_size + sizeof (*header));
offset += sizeof (*header);
grub_util_load_image (font_path, kernel_img + offset);
offset += font_size;
}
if (config_path)
{
struct grub_module_header *header;
@ -1241,7 +1221,6 @@ Make a bootable image of GRUB.\n\
-d, --directory=DIR use images and modules under DIR [default=%s/@platform@]\n\
-p, --prefix=DIR set grub_prefix directory [default=%s]\n\
-m, --memdisk=FILE embed FILE as a memdisk image\n\
-f, --font=FILE embed FILE as a boot font\n\
-c, --config=FILE embed FILE as boot config\n\
-n, --note add NOTE segment for CHRP Open Firmware\n\
-o, --output=FILE output a generated image to FILE [default=stdout]\n\
@ -1330,13 +1309,6 @@ main (int argc, char *argv[])
prefix = xstrdup ("(memdisk)/boot/grub");
break;
case 'f':
if (font)
free (font);
font = xstrdup (optarg);
break;
case 'c':
if (config)
free (config);
@ -1401,7 +1373,7 @@ main (int argc, char *argv[])
}
generate_image (dir, prefix ? : DEFAULT_DIRECTORY, fp,
argv + optind, memdisk, font, config,
argv + optind, memdisk, config,
image_target, note);
fclose (fp);