From: hollisb Date: Wed, 3 Aug 2005 22:53:51 +0000 (+0000) Subject: 2005-08-03 Hollis Blanchard X-Git-Tag: 1.98~2105 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3be7266d9267b155ad0d11bd504162fac17a90a7;p=thirdparty%2Fgrub.git 2005-08-03 Hollis Blanchard * include/grub/powerpc/ieee1275/ieee1275.h: Move ... * include/grub/ieee1275/ieee1275.h: ... to here. All users updated. Move `abort', `grub_reboot', and `grub_halt' prototypes ... * include/grub/powerpc/ieee1275/kernel.h: ... to here. * commands/ieee1275/halt.c: Include instead of . * commands/ieee1275/reboot.c: Likewise. * boot/powerpc/ieee1275/ieee1275.c: Move ... * kern/ieee1275.c: ... to here. All users updated. Change all parameter structs to use new type `grub_ieee1275_cell_t'. * term/powerpc/ieee1275/ofconsole.c: Move ... * term/ieee1275/ofconsole.c: ... to here. All users updated. * disk/powerpc/ieee1275/ofdisk.c: Move ... * disk/ieee1275/ofdisk.c: ... to here. All users updated. * boot/powerpc/ieee1275/cmain.c: Change `grub_ieee1275_entry_fn' type to return int. * include/grub/i386/pc/console.h: Move to include/grub/console.h. Remove unused prototypes. All users updated. * include/grub/powerpc/ieee1275/console.h: Removed. * include/grub/powerpc/ieee1275/ieee1275.h: Define `grub_ieee1275_cell_t'. * kern/powerpc/ieee1275/openfw.c: Include . Cast comparisons with -1 to the correct type. * loader/powerpc/ieee1275/linux.c (kernel_entry_t): Change parameter type to match `grub_ieee1275_entry_fn'. --- diff --git a/ChangeLog b/ChangeLog index dda583cc3..c0a5b8681 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,31 @@ +2005-08-03 Hollis Blanchard + + * include/grub/powerpc/ieee1275/ieee1275.h: Move ... + * include/grub/ieee1275/ieee1275.h: ... to here. All users updated. + Move `abort', `grub_reboot', and `grub_halt' prototypes ... + * include/grub/powerpc/ieee1275/kernel.h: ... to here. + * commands/ieee1275/halt.c: Include instead + of . + * commands/ieee1275/reboot.c: Likewise. + * boot/powerpc/ieee1275/ieee1275.c: Move ... + * kern/ieee1275.c: ... to here. All users updated. Change all + parameter structs to use new type `grub_ieee1275_cell_t'. + * term/powerpc/ieee1275/ofconsole.c: Move ... + * term/ieee1275/ofconsole.c: ... to here. All users updated. + * disk/powerpc/ieee1275/ofdisk.c: Move ... + * disk/ieee1275/ofdisk.c: ... to here. All users updated. + * boot/powerpc/ieee1275/cmain.c: Change `grub_ieee1275_entry_fn' type + to return int. + * include/grub/i386/pc/console.h: Move to include/grub/console.h. + Remove unused prototypes. All users updated. + * include/grub/powerpc/ieee1275/console.h: Removed. + * include/grub/powerpc/ieee1275/ieee1275.h: Define + `grub_ieee1275_cell_t'. + * kern/powerpc/ieee1275/openfw.c: Include . + Cast comparisons with -1 to the correct type. + * loader/powerpc/ieee1275/linux.c (kernel_entry_t): Change parameter + type to match `grub_ieee1275_entry_fn'. + 2005-08-01 Yoshinori K. Okuji * DISTLIST: Added util/i386/pc/grub-probefs.c. diff --git a/boot/powerpc/ieee1275/cmain.c b/boot/powerpc/ieee1275/cmain.c index ffac11f41..5d74479cd 100644 --- a/boot/powerpc/ieee1275/cmain.c +++ b/boot/powerpc/ieee1275/cmain.c @@ -20,12 +20,12 @@ #include #include - -#include #include +#include +#include /* OpenFirmware entry point passed to us from the real bootloader. */ -intptr_t (*grub_ieee1275_entry_fn) (void *); +int (*grub_ieee1275_entry_fn) (void *); grub_ieee1275_phandle_t grub_ieee1275_chosen; @@ -76,7 +76,7 @@ cmain (uint32_t r3, uint32_t r4 __attribute__((unused)), uint32_t r5) extern char _start; extern char _end; - grub_ieee1275_entry_fn = (intptr_t (*)(void *)) r3; + grub_ieee1275_entry_fn = (int (*)(void *)) r3; grub_ieee1275_set_flag (GRUB_IEEE1275_FLAG_NO_PARTITION_0); @@ -91,7 +91,7 @@ cmain (uint32_t r3, uint32_t r4 __attribute__((unused)), uint32_t r5) else { /* Assume we were entered from Open Firmware. */ - grub_ieee1275_entry_fn = (intptr_t (*)(void *)) r5; + grub_ieee1275_entry_fn = (int (*)(void *)) r5; } grub_ieee1275_finddevice ("/chosen", &grub_ieee1275_chosen); diff --git a/commands/ieee1275/halt.c b/commands/ieee1275/halt.c index b27b60344..004acc16b 100644 --- a/commands/ieee1275/halt.c +++ b/commands/ieee1275/halt.c @@ -21,7 +21,7 @@ #include #include #include -#include +#include static grub_err_t grub_cmd_halt (struct grub_arg_list *state __attribute__ ((unused)), diff --git a/commands/ieee1275/reboot.c b/commands/ieee1275/reboot.c index 1b897aa1c..90447703b 100644 --- a/commands/ieee1275/reboot.c +++ b/commands/ieee1275/reboot.c @@ -21,7 +21,7 @@ #include #include #include -#include +#include static grub_err_t grub_cmd_reboot (struct grub_arg_list *state __attribute__ ((unused)), diff --git a/commands/ieee1275/suspend.c b/commands/ieee1275/suspend.c index 7566b34e0..24f0b4446 100644 --- a/commands/ieee1275/suspend.c +++ b/commands/ieee1275/suspend.c @@ -21,7 +21,7 @@ #include #include #include -#include +#include static grub_err_t grub_cmd_suspend (struct grub_arg_list *state __attribute__ ((unused)), diff --git a/conf/powerpc-ieee1275.mk b/conf/powerpc-ieee1275.mk index 7c8304abb..e86538a17 100644 --- a/conf/powerpc-ieee1275.mk +++ b/conf/powerpc-ieee1275.mk @@ -12,7 +12,8 @@ DEFSYMFILES += kernel_syms.lst grubof_HEADERS = arg.h boot.h device.h disk.h dl.h elf.h env.h err.h \ file.h fs.h kernel.h misc.h mm.h net.h rescue.h symbol.h \ term.h types.h powerpc/libgcc.h loader.h \ - partition.h pc_partition.h machine/time.h machine/ieee1275.h + partition.h pc_partition.h ieee1275/ieee1275.h machine/time.h \ + machine/kernel.h grubof_symlist.c: $(addprefix include/grub/,$(grubof_HEADERS)) gensymlist.sh sh $(srcdir)/gensymlist.sh $(filter %.h,$^) > $@ @@ -488,17 +489,17 @@ grub_emu-util_powerpc_ieee1275_misc.d: util/powerpc/ieee1275/misc.c grub_emu_LDFLAGS = -lncurses grubof_SOURCES = boot/powerpc/ieee1275/crt0.S boot/powerpc/ieee1275/cmain.c \ - boot/powerpc/ieee1275/ieee1275.c kern/main.c kern/device.c \ + kern/ieee1275.c kern/main.c kern/device.c \ kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \ kern/misc.c kern/mm.c kern/loader.c kern/rescue.c kern/term.c \ - kern/powerpc/ieee1275/init.c term/powerpc/ieee1275/ofconsole.c \ - kern/powerpc/ieee1275/openfw.c disk/powerpc/ieee1275/ofdisk.c \ + kern/powerpc/ieee1275/init.c term/ieee1275/ofconsole.c \ + kern/powerpc/ieee1275/openfw.c disk/ieee1275/ofdisk.c \ kern/partition.c kern/env.c kern/powerpc/dl.c grubof_symlist.c \ kern/powerpc/cache.S -CLEANFILES += grubof grubof-boot_powerpc_ieee1275_crt0.o grubof-boot_powerpc_ieee1275_cmain.o grubof-boot_powerpc_ieee1275_ieee1275.o grubof-kern_main.o grubof-kern_device.o grubof-kern_disk.o grubof-kern_dl.o grubof-kern_file.o grubof-kern_fs.o grubof-kern_err.o grubof-kern_misc.o grubof-kern_mm.o grubof-kern_loader.o grubof-kern_rescue.o grubof-kern_term.o grubof-kern_powerpc_ieee1275_init.o grubof-term_powerpc_ieee1275_ofconsole.o grubof-kern_powerpc_ieee1275_openfw.o grubof-disk_powerpc_ieee1275_ofdisk.o grubof-kern_partition.o grubof-kern_env.o grubof-kern_powerpc_dl.o grubof-grubof_symlist.o grubof-kern_powerpc_cache.o -MOSTLYCLEANFILES += grubof-boot_powerpc_ieee1275_crt0.d grubof-boot_powerpc_ieee1275_cmain.d grubof-boot_powerpc_ieee1275_ieee1275.d grubof-kern_main.d grubof-kern_device.d grubof-kern_disk.d grubof-kern_dl.d grubof-kern_file.d grubof-kern_fs.d grubof-kern_err.d grubof-kern_misc.d grubof-kern_mm.d grubof-kern_loader.d grubof-kern_rescue.d grubof-kern_term.d grubof-kern_powerpc_ieee1275_init.d grubof-term_powerpc_ieee1275_ofconsole.d grubof-kern_powerpc_ieee1275_openfw.d grubof-disk_powerpc_ieee1275_ofdisk.d grubof-kern_partition.d grubof-kern_env.d grubof-kern_powerpc_dl.d grubof-grubof_symlist.d grubof-kern_powerpc_cache.d +CLEANFILES += grubof grubof-boot_powerpc_ieee1275_crt0.o grubof-boot_powerpc_ieee1275_cmain.o grubof-kern_ieee1275.o grubof-kern_main.o grubof-kern_device.o grubof-kern_disk.o grubof-kern_dl.o grubof-kern_file.o grubof-kern_fs.o grubof-kern_err.o grubof-kern_misc.o grubof-kern_mm.o grubof-kern_loader.o grubof-kern_rescue.o grubof-kern_term.o grubof-kern_powerpc_ieee1275_init.o grubof-term_ieee1275_ofconsole.o grubof-kern_powerpc_ieee1275_openfw.o grubof-disk_ieee1275_ofdisk.o grubof-kern_partition.o grubof-kern_env.o grubof-kern_powerpc_dl.o grubof-grubof_symlist.o grubof-kern_powerpc_cache.o +MOSTLYCLEANFILES += grubof-boot_powerpc_ieee1275_crt0.d grubof-boot_powerpc_ieee1275_cmain.d grubof-kern_ieee1275.d grubof-kern_main.d grubof-kern_device.d grubof-kern_disk.d grubof-kern_dl.d grubof-kern_file.d grubof-kern_fs.d grubof-kern_err.d grubof-kern_misc.d grubof-kern_mm.d grubof-kern_loader.d grubof-kern_rescue.d grubof-kern_term.d grubof-kern_powerpc_ieee1275_init.d grubof-term_ieee1275_ofconsole.d grubof-kern_powerpc_ieee1275_openfw.d grubof-disk_ieee1275_ofdisk.d grubof-kern_partition.d grubof-kern_env.d grubof-kern_powerpc_dl.d grubof-grubof_symlist.d grubof-kern_powerpc_cache.d -grubof: grubof-boot_powerpc_ieee1275_crt0.o grubof-boot_powerpc_ieee1275_cmain.o grubof-boot_powerpc_ieee1275_ieee1275.o grubof-kern_main.o grubof-kern_device.o grubof-kern_disk.o grubof-kern_dl.o grubof-kern_file.o grubof-kern_fs.o grubof-kern_err.o grubof-kern_misc.o grubof-kern_mm.o grubof-kern_loader.o grubof-kern_rescue.o grubof-kern_term.o grubof-kern_powerpc_ieee1275_init.o grubof-term_powerpc_ieee1275_ofconsole.o grubof-kern_powerpc_ieee1275_openfw.o grubof-disk_powerpc_ieee1275_ofdisk.o grubof-kern_partition.o grubof-kern_env.o grubof-kern_powerpc_dl.o grubof-grubof_symlist.o grubof-kern_powerpc_cache.o +grubof: grubof-boot_powerpc_ieee1275_crt0.o grubof-boot_powerpc_ieee1275_cmain.o grubof-kern_ieee1275.o grubof-kern_main.o grubof-kern_device.o grubof-kern_disk.o grubof-kern_dl.o grubof-kern_file.o grubof-kern_fs.o grubof-kern_err.o grubof-kern_misc.o grubof-kern_mm.o grubof-kern_loader.o grubof-kern_rescue.o grubof-kern_term.o grubof-kern_powerpc_ieee1275_init.o grubof-term_ieee1275_ofconsole.o grubof-kern_powerpc_ieee1275_openfw.o grubof-disk_ieee1275_ofdisk.o grubof-kern_partition.o grubof-kern_env.o grubof-kern_powerpc_dl.o grubof-grubof_symlist.o grubof-kern_powerpc_cache.o $(CC) -o $@ $^ $(LDFLAGS) $(grubof_LDFLAGS) grubof-boot_powerpc_ieee1275_crt0.o: boot/powerpc/ieee1275/crt0.S @@ -517,13 +518,13 @@ grubof-boot_powerpc_ieee1275_cmain.d: boot/powerpc/ieee1275/cmain.c -include grubof-boot_powerpc_ieee1275_cmain.d -grubof-boot_powerpc_ieee1275_ieee1275.o: boot/powerpc/ieee1275/ieee1275.c - $(CC) -Iboot/powerpc/ieee1275 -I$(srcdir)/boot/powerpc/ieee1275 $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -c -o $@ $< +grubof-kern_ieee1275.o: kern/ieee1275.c + $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -c -o $@ $< -grubof-boot_powerpc_ieee1275_ieee1275.d: boot/powerpc/ieee1275/ieee1275.c - set -e; $(CC) -Iboot/powerpc/ieee1275 -I$(srcdir)/boot/powerpc/ieee1275 $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -M $< | sed 's,ieee1275\.o[ :]*,grubof-boot_powerpc_ieee1275_ieee1275.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grubof-kern_ieee1275.d: kern/ieee1275.c + set -e; $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -M $< | sed 's,ieee1275\.o[ :]*,grubof-kern_ieee1275.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include grubof-boot_powerpc_ieee1275_ieee1275.d +-include grubof-kern_ieee1275.d grubof-kern_main.o: kern/main.c $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -c -o $@ $< @@ -629,13 +630,13 @@ grubof-kern_powerpc_ieee1275_init.d: kern/powerpc/ieee1275/init.c -include grubof-kern_powerpc_ieee1275_init.d -grubof-term_powerpc_ieee1275_ofconsole.o: term/powerpc/ieee1275/ofconsole.c - $(CC) -Iterm/powerpc/ieee1275 -I$(srcdir)/term/powerpc/ieee1275 $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -c -o $@ $< +grubof-term_ieee1275_ofconsole.o: term/ieee1275/ofconsole.c + $(CC) -Iterm/ieee1275 -I$(srcdir)/term/ieee1275 $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -c -o $@ $< -grubof-term_powerpc_ieee1275_ofconsole.d: term/powerpc/ieee1275/ofconsole.c - set -e; $(CC) -Iterm/powerpc/ieee1275 -I$(srcdir)/term/powerpc/ieee1275 $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -M $< | sed 's,ofconsole\.o[ :]*,grubof-term_powerpc_ieee1275_ofconsole.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grubof-term_ieee1275_ofconsole.d: term/ieee1275/ofconsole.c + set -e; $(CC) -Iterm/ieee1275 -I$(srcdir)/term/ieee1275 $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -M $< | sed 's,ofconsole\.o[ :]*,grubof-term_ieee1275_ofconsole.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include grubof-term_powerpc_ieee1275_ofconsole.d +-include grubof-term_ieee1275_ofconsole.d grubof-kern_powerpc_ieee1275_openfw.o: kern/powerpc/ieee1275/openfw.c $(CC) -Ikern/powerpc/ieee1275 -I$(srcdir)/kern/powerpc/ieee1275 $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -c -o $@ $< @@ -645,13 +646,13 @@ grubof-kern_powerpc_ieee1275_openfw.d: kern/powerpc/ieee1275/openfw.c -include grubof-kern_powerpc_ieee1275_openfw.d -grubof-disk_powerpc_ieee1275_ofdisk.o: disk/powerpc/ieee1275/ofdisk.c - $(CC) -Idisk/powerpc/ieee1275 -I$(srcdir)/disk/powerpc/ieee1275 $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -c -o $@ $< +grubof-disk_ieee1275_ofdisk.o: disk/ieee1275/ofdisk.c + $(CC) -Idisk/ieee1275 -I$(srcdir)/disk/ieee1275 $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -c -o $@ $< -grubof-disk_powerpc_ieee1275_ofdisk.d: disk/powerpc/ieee1275/ofdisk.c - set -e; $(CC) -Idisk/powerpc/ieee1275 -I$(srcdir)/disk/powerpc/ieee1275 $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -M $< | sed 's,ofdisk\.o[ :]*,grubof-disk_powerpc_ieee1275_ofdisk.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ +grubof-disk_ieee1275_ofdisk.d: disk/ieee1275/ofdisk.c + set -e; $(CC) -Idisk/ieee1275 -I$(srcdir)/disk/ieee1275 $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -M $< | sed 's,ofdisk\.o[ :]*,grubof-disk_ieee1275_ofdisk.o $@ : ,g' > $@; [ -s $@ ] || rm -f $@ --include grubof-disk_powerpc_ieee1275_ofdisk.d +-include grubof-disk_ieee1275_ofdisk.d grubof-kern_partition.o: kern/partition.c $(CC) -Ikern -I$(srcdir)/kern $(CPPFLAGS) $(CFLAGS) $(grubof_CFLAGS) -c -o $@ $< diff --git a/conf/powerpc-ieee1275.rmk b/conf/powerpc-ieee1275.rmk index 228911cba..41fe48ed4 100644 --- a/conf/powerpc-ieee1275.rmk +++ b/conf/powerpc-ieee1275.rmk @@ -12,7 +12,8 @@ DEFSYMFILES += kernel_syms.lst grubof_HEADERS = arg.h boot.h device.h disk.h dl.h elf.h env.h err.h \ file.h fs.h kernel.h misc.h mm.h net.h rescue.h symbol.h \ term.h types.h powerpc/libgcc.h loader.h \ - partition.h pc_partition.h machine/time.h machine/ieee1275.h + partition.h pc_partition.h ieee1275/ieee1275.h machine/time.h \ + machine/kernel.h grubof_symlist.c: $(addprefix include/grub/,$(grubof_HEADERS)) gensymlist.sh sh $(srcdir)/gensymlist.sh $(filter %.h,$^) > $@ @@ -52,11 +53,11 @@ grub_emu_SOURCES = commands/boot.c commands/cat.c commands/cmp.c \ grub_emu_LDFLAGS = -lncurses grubof_SOURCES = boot/powerpc/ieee1275/crt0.S boot/powerpc/ieee1275/cmain.c \ - boot/powerpc/ieee1275/ieee1275.c kern/main.c kern/device.c \ + kern/ieee1275.c kern/main.c kern/device.c \ kern/disk.c kern/dl.c kern/file.c kern/fs.c kern/err.c \ kern/misc.c kern/mm.c kern/loader.c kern/rescue.c kern/term.c \ - kern/powerpc/ieee1275/init.c term/powerpc/ieee1275/ofconsole.c \ - kern/powerpc/ieee1275/openfw.c disk/powerpc/ieee1275/ofdisk.c \ + kern/powerpc/ieee1275/init.c term/ieee1275/ofconsole.c \ + kern/powerpc/ieee1275/openfw.c disk/ieee1275/ofdisk.c \ kern/partition.c kern/env.c kern/powerpc/dl.c grubof_symlist.c \ kern/powerpc/cache.S grubof_HEADERS = grub/powerpc/ieee1275/ieee1275.h diff --git a/disk/powerpc/ieee1275/ofdisk.c b/disk/ieee1275/ofdisk.c similarity index 98% rename from disk/powerpc/ieee1275/ofdisk.c rename to disk/ieee1275/ofdisk.c index 8b47389c5..7f77808ce 100644 --- a/disk/powerpc/ieee1275/ofdisk.c +++ b/disk/ieee1275/ofdisk.c @@ -21,8 +21,8 @@ #include #include #include -#include -#include +#include +#include static int grub_ofdisk_iterate (int (*hook) (const char *name)) diff --git a/include/grub/powerpc/ieee1275/console.h b/include/grub/console.h similarity index 66% rename from include/grub/powerpc/ieee1275/console.h rename to include/grub/console.h index d9256412d..0e968cb0e 100644 --- a/include/grub/powerpc/ieee1275/console.h +++ b/include/grub/console.h @@ -17,8 +17,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef GRUB_CONSOLE_MACHINE_HEADER -#define GRUB_CONSOLE_MACHINE_HEADER 1 +#ifndef GRUB_CONSOLE_HEADER +#define GRUB_CONSOLE_HEADER 1 /* Define scan codes. */ #define GRUB_CONSOLE_KEY_LEFT 0x4B00 @@ -33,27 +33,7 @@ #define GRUB_CONSOLE_KEY_NPAGE 0x4900 #define GRUB_CONSOLE_KEY_PPAGE 0x5100 -#ifndef ASM_FILE - -#include -#include - -/* These are global to share code between C and asm. */ -extern grub_uint8_t grub_console_cur_color; -void grub_console_real_putchar (int c); -int EXPORT_FUNC(grub_console_checkkey) (void); -int EXPORT_FUNC(grub_console_getkey) (void); -grub_uint16_t grub_console_getxy (void); -void grub_console_gotoxy (grub_uint8_t x, grub_uint8_t y); -void grub_console_cls (void); -void grub_console_setcursor (int on); - -/* Initialize the console system. */ void grub_console_init (void); - -/* Finish the console system. */ void grub_console_fini (void); -#endif - -#endif /* ! GRUB_CONSOLE_MACHINE_HEADER */ +#endif /* ! GRUB_CONSOLE_HEADER */ diff --git a/include/grub/i386/pc/console.h b/include/grub/i386/pc/console.h deleted file mode 100644 index 7e71d0537..000000000 --- a/include/grub/i386/pc/console.h +++ /dev/null @@ -1,59 +0,0 @@ -/* - * GRUB -- GRand Unified Bootloader - * Copyright (C) 2002,2005 Free Software Foundation, Inc. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - -#ifndef GRUB_CONSOLE_MACHINE_HEADER -#define GRUB_CONSOLE_MACHINE_HEADER 1 - -/* Define scan codes. */ -#define GRUB_CONSOLE_KEY_LEFT 0x4B00 -#define GRUB_CONSOLE_KEY_RIGHT 0x4D00 -#define GRUB_CONSOLE_KEY_UP 0x4800 -#define GRUB_CONSOLE_KEY_DOWN 0x5000 -#define GRUB_CONSOLE_KEY_IC 0x5200 -#define GRUB_CONSOLE_KEY_DC 0x5300 -#define GRUB_CONSOLE_KEY_BACKSPACE 0x0008 -#define GRUB_CONSOLE_KEY_HOME 0x4700 -#define GRUB_CONSOLE_KEY_END 0x4F00 -#define GRUB_CONSOLE_KEY_NPAGE 0x4900 -#define GRUB_CONSOLE_KEY_PPAGE 0x5100 - -#ifndef ASM_FILE - -#include -#include - -/* These are global to share code between C and asm. */ -extern grub_uint8_t grub_console_cur_color; -void grub_console_real_putchar (int c); -int EXPORT_FUNC(grub_console_checkkey) (void); -int EXPORT_FUNC(grub_console_getkey) (void); -grub_uint16_t grub_console_getxy (void); -void grub_console_gotoxy (grub_uint8_t x, grub_uint8_t y); -void grub_console_cls (void); -void grub_console_setcursor (int on); - -/* Initialize the console system. */ -void grub_console_init (void); - -/* Finish the console system. */ -void grub_console_fini (void); - -#endif - -#endif /* ! GRUB_CONSOLE_MACHINE_HEADER */ diff --git a/include/grub/ieee1275/ieee1275.h b/include/grub/ieee1275/ieee1275.h new file mode 100644 index 000000000..f907233ac --- /dev/null +++ b/include/grub/ieee1275/ieee1275.h @@ -0,0 +1,154 @@ +/* ieee1275.h - Access the Open Firmware client interface. */ +/* + * GRUB -- GRand Unified Bootloader + * Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +#ifndef GRUB_IEEE1275_HEADER +#define GRUB_IEEE1275_HEADER 1 + +#include +#include +#include +#include + +/* Maps a device alias to a pathname. */ +struct grub_ieee1275_devalias +{ + char *name; + char *path; + char *type; +}; + +struct grub_ieee1275_mem_region +{ + unsigned int start; + unsigned int size; +}; + +#ifndef IEEE1275_CALL_ENTRY_FN +#define IEEE1275_CALL_ENTRY_FN(args) (*grub_ieee1275_entry_fn) (args) +#endif + +/* All backcalls to the firmware is done by calling an entry function + which was passed to us from the bootloader. When doing the backcall, + a structure is passed which specifies what the firmware should do. + NAME is the requested service. NR_INS and NR_OUTS is the number of + passed arguments and the expected number of return values, resp. */ +struct grub_ieee1275_common_hdr +{ + grub_ieee1275_cell_t name; + grub_ieee1275_cell_t nr_ins; + grub_ieee1275_cell_t nr_outs; +}; + +#define INIT_IEEE1275_COMMON(p, xname, xins, xouts) \ + (p)->name = (grub_ieee1275_cell_t) xname; \ + (p)->nr_ins = (grub_ieee1275_cell_t) xins; \ + (p)->nr_outs = (grub_ieee1275_cell_t) xouts + +typedef grub_ieee1275_cell_t grub_ieee1275_ihandle_t; +typedef grub_ieee1275_cell_t grub_ieee1275_phandle_t; + +extern grub_ieee1275_phandle_t EXPORT_VAR(grub_ieee1275_chosen); +extern int (* EXPORT_VAR(grub_ieee1275_entry_fn)) (void *); + +enum grub_ieee1275_flag +{ + /* Old World Macintosh firmware fails seek when "dev:0" is opened. */ + GRUB_IEEE1275_FLAG_NO_PARTITION_0, + + /* Apple firmware runs in translated mode and requires use of the "map" + method. Other firmware runs in untranslated mode and doesn't like "map" + calls. */ + GRUB_IEEE1275_FLAG_REAL_MODE, + + /* CHRP specifies partitions are numbered from 1 (partition 0 refers to the + whole disk). However, CodeGen firmware numbers partitions from 0. */ + GRUB_IEEE1275_FLAG_0_BASED_PARTITIONS, +}; + +extern int EXPORT_FUNC(grub_ieee1275_test_flag) (enum grub_ieee1275_flag flag); +extern void EXPORT_FUNC(grub_ieee1275_set_flag) (enum grub_ieee1275_flag flag); + + + + +grub_uint32_t EXPORT_FUNC(grub_ieee1275_decode_int_4) (unsigned char *p); +int EXPORT_FUNC(grub_ieee1275_finddevice) (char *name, + grub_ieee1275_phandle_t *phandlep); +int EXPORT_FUNC(grub_ieee1275_get_property) (grub_ieee1275_phandle_t phandle, + const char *property, void *buf, + grub_size_t size, + grub_ssize_t *actual); +int EXPORT_FUNC(grub_ieee1275_next_property) (grub_ieee1275_phandle_t phandle, + char *prev_prop, char *prop, + grub_ieee1275_cell_t *flags); +int EXPORT_FUNC(grub_ieee1275_get_property_length) + (grub_ieee1275_phandle_t phandle, const char *prop, grub_ssize_t *length); +int EXPORT_FUNC(grub_ieee1275_instance_to_package) + (grub_ieee1275_ihandle_t ihandle, grub_ieee1275_phandle_t *phandlep); +int EXPORT_FUNC(grub_ieee1275_package_to_path) (grub_ieee1275_phandle_t phandle, + char *path, grub_size_t len, + grub_ssize_t *actual); +int EXPORT_FUNC(grub_ieee1275_instance_to_path) + (grub_ieee1275_ihandle_t ihandle, char *path, grub_size_t len, + grub_ssize_t *actual); +int EXPORT_FUNC(grub_ieee1275_write) (grub_ieee1275_ihandle_t ihandle, + void *buffer, grub_size_t len, + grub_ssize_t *actualp); +int EXPORT_FUNC(grub_ieee1275_read) (grub_ieee1275_ihandle_t ihandle, + void *buffer, grub_size_t len, + grub_ssize_t *actualp); +int EXPORT_FUNC(grub_ieee1275_seek) (grub_ieee1275_ihandle_t ihandle, + int pos_hi, int pos_lo, + grub_ssize_t *result); +int EXPORT_FUNC(grub_ieee1275_peer) (grub_ieee1275_phandle_t node, + grub_ieee1275_phandle_t *result); +int EXPORT_FUNC(grub_ieee1275_child) (grub_ieee1275_phandle_t node, + grub_ieee1275_phandle_t *result); +int EXPORT_FUNC(grub_ieee1275_parent) (grub_ieee1275_phandle_t node, + grub_ieee1275_phandle_t *result); +int EXPORT_FUNC(grub_ieee1275_interpret) (const char *command, + grub_ieee1275_cell_t *catch); +int EXPORT_FUNC(grub_ieee1275_enter) (void); +int EXPORT_FUNC(grub_ieee1275_exit) (void) __attribute__ ((noreturn)); +int EXPORT_FUNC(grub_ieee1275_open) (const char *node, + grub_ieee1275_ihandle_t *result); +int EXPORT_FUNC(grub_ieee1275_close) (grub_ieee1275_ihandle_t ihandle); +int EXPORT_FUNC(grub_ieee1275_claim) (grub_addr_t addr, grub_size_t size, + unsigned int align, grub_addr_t *result); +int EXPORT_FUNC(grub_ieee1275_release) (grub_addr_t addr, grub_size_t size); +int EXPORT_FUNC(grub_ieee1275_set_property) (grub_ieee1275_phandle_t phandle, + const char *propname, void *buf, + grub_size_t size, + grub_ssize_t *actual); +int EXPORT_FUNC(grub_ieee1275_set_color) (grub_ieee1275_ihandle_t ihandle, + int index, int r, int g, int b); +int EXPORT_FUNC(grub_ieee1275_milliseconds) (grub_uint32_t *msecs); + + +grub_err_t EXPORT_FUNC(grub_devalias_iterate) + (int (*hook) (struct grub_ieee1275_devalias *alias)); +grub_err_t EXPORT_FUNC(grub_children_iterate) (char *devpath, + int (*hook) (struct grub_ieee1275_devalias *alias)); +int EXPORT_FUNC(grub_claimmap) (grub_addr_t addr, grub_size_t size); + +char *EXPORT_FUNC(grub_ieee1275_encode_devname) (const char *path); +char *EXPORT_FUNC(grub_ieee1275_get_filename) (const char *path); + +#endif /* ! GRUB_IEEE1275_HEADER */ diff --git a/include/grub/powerpc/ieee1275/ofdisk.h b/include/grub/ieee1275/ofdisk.h similarity index 88% rename from include/grub/powerpc/ieee1275/ofdisk.h rename to include/grub/ieee1275/ofdisk.h index 736fab37f..5b3f9faa9 100644 --- a/include/grub/powerpc/ieee1275/ofdisk.h +++ b/include/grub/ieee1275/ofdisk.h @@ -17,10 +17,10 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef GRUB_OFDISK_MACHINE_HEADER -#define GRUB_OFDISK_MACHINE_HEADER 1 +#ifndef GRUB_OFDISK_HEADER +#define GRUB_OFDISK_HEADER 1 extern void grub_ofdisk_init (void); extern void grub_ofdisk_fini (void); -#endif /* ! GRUB_INIT_MACHINE_HEADER */ +#endif /* ! GRUB_INIT_HEADER */ diff --git a/include/grub/powerpc/ieee1275/ieee1275.h b/include/grub/powerpc/ieee1275/ieee1275.h index 97561c0ad..723a3aa64 100644 --- a/include/grub/powerpc/ieee1275/ieee1275.h +++ b/include/grub/powerpc/ieee1275/ieee1275.h @@ -21,134 +21,8 @@ #ifndef GRUB_IEEE1275_MACHINE_HEADER #define GRUB_IEEE1275_MACHINE_HEADER 1 -#include -#include #include -/* Maps a device alias to a pathname. */ -struct grub_ieee1275_devalias -{ - char *name; - char *path; - char *type; -}; - -struct grub_ieee1275_mem_region -{ - unsigned int start; - unsigned int size; -}; - -#ifndef IEEE1275_CALL_ENTRY_FN -#define IEEE1275_CALL_ENTRY_FN(args) (*grub_ieee1275_entry_fn) (args) -#endif - -/* All backcalls to the firmware is done by calling an entry function - which was passed to us from the bootloader. When doing the backcall, - a structure is passed which specifies what the firmware should do. - NAME is the requested service. NR_INS and NR_OUTS is the number of - passed arguments and the expected number of return values, resp. */ -struct grub_ieee1275_common_hdr -{ - char *name; - int nr_ins; - int nr_outs; -}; - -#define INIT_IEEE1275_COMMON(p, xname, xins, xouts) \ - (p)->name = xname; (p)->nr_ins = xins; (p)->nr_outs = xouts - -/* FIXME jrydberg: is this correct cell types? */ -typedef intptr_t grub_ieee1275_ihandle_t; -typedef intptr_t grub_ieee1275_phandle_t; - -extern grub_ieee1275_phandle_t grub_ieee1275_chosen; -extern grub_ieee1275_phandle_t EXPORT_VAR(grub_ieee1275_chosen); -extern intptr_t (*grub_ieee1275_entry_fn) (void *); -extern intptr_t (* EXPORT_VAR(grub_ieee1275_entry_fn)) (void *); - -enum grub_ieee1275_flag -{ - /* Old World firmware fails seek when "dev:0" is opened. */ - GRUB_IEEE1275_FLAG_NO_PARTITION_0, - - /* Apple firmware runs in translated mode and requires use of the "map" - method. Other firmware runs in untranslated mode and doesn't like "map" - calls. */ - GRUB_IEEE1275_FLAG_REAL_MODE, - - /* CHRP specifies partitions are numbered from 1 (partition 0 refers to the - whole disk). However, CodeGen firmware numbers partitions from 0. */ - GRUB_IEEE1275_FLAG_0_BASED_PARTITIONS, -}; - -extern int EXPORT_FUNC(grub_ieee1275_test_flag) (enum grub_ieee1275_flag flag); -extern void EXPORT_FUNC(grub_ieee1275_set_flag) (enum grub_ieee1275_flag flag); - - - -uint32_t EXPORT_FUNC(grub_ieee1275_decode_int_4) (unsigned char *p); -int EXPORT_FUNC(grub_ieee1275_finddevice) (char *name, - grub_ieee1275_phandle_t *phandlep); -int EXPORT_FUNC(grub_ieee1275_get_property) (grub_ieee1275_phandle_t handle, - const char *property, void *buf, - grub_size_t size, - grub_size_t *actual); -int EXPORT_FUNC(grub_ieee1275_next_property) (int handle, char *prev_prop, - char *prop, int *flags); -int EXPORT_FUNC(grub_ieee1275_get_property_length) - (grub_ieee1275_phandle_t handle, const char *prop, grub_size_t *length); -int EXPORT_FUNC(grub_ieee1275_instance_to_package) - (grub_ieee1275_ihandle_t ihandle, grub_ieee1275_phandle_t *phandlep); -int EXPORT_FUNC(grub_ieee1275_package_to_path) (grub_ieee1275_phandle_t phandle, - char *path, grub_size_t len, - grub_size_t *actual); -int EXPORT_FUNC(grub_ieee1275_instance_to_path) - (grub_ieee1275_ihandle_t ihandle, char *path, grub_size_t len, - grub_size_t *actual); -int EXPORT_FUNC(grub_ieee1275_write) (grub_ieee1275_ihandle_t ihandle, - void *buffer, grub_size_t len, - grub_size_t *actualp); -int EXPORT_FUNC(grub_ieee1275_read) (grub_ieee1275_ihandle_t ihandle, - void *buffer, grub_size_t len, - grub_size_t *actualp); -int EXPORT_FUNC(grub_ieee1275_seek) (grub_ieee1275_ihandle_t ihandle, - int pos_hi, int pos_lo, int *result); -int EXPORT_FUNC(grub_ieee1275_peer) (grub_ieee1275_phandle_t node, - grub_ieee1275_phandle_t *result); -int EXPORT_FUNC(grub_ieee1275_child) (grub_ieee1275_phandle_t node, - grub_ieee1275_phandle_t *result); -int EXPORT_FUNC(grub_ieee1275_parent) (grub_ieee1275_phandle_t node, - grub_ieee1275_phandle_t *result); -int EXPORT_FUNC(grub_ieee1275_interpret) (const char *command, int *catch); -int EXPORT_FUNC(grub_ieee1275_enter) (void); -int EXPORT_FUNC(grub_ieee1275_exit) (void); -int EXPORT_FUNC(grub_ieee1275_open) (char *node, - grub_ieee1275_ihandle_t *result); -int EXPORT_FUNC(grub_ieee1275_close) (grub_ieee1275_ihandle_t ihandle); -int EXPORT_FUNC(grub_ieee1275_claim) (grub_addr_t addr, grub_size_t size, - unsigned int align, grub_addr_t *result); -int EXPORT_FUNC(grub_ieee1275_release) (grub_addr_t addr, grub_size_t size); -int EXPORT_FUNC(grub_ieee1275_set_property) (grub_ieee1275_phandle_t phandle, - const char *propname, void *buf, - grub_size_t size, - grub_size_t *actual); -int EXPORT_FUNC(grub_ieee1275_set_color) (grub_ieee1275_ihandle_t ihandle, - int index, int r, int g, int b); -int EXPORT_FUNC(grub_ieee1275_milliseconds) (grub_uint32_t *msecs); - - -grub_err_t EXPORT_FUNC(grub_devalias_iterate) - (int (*hook) (struct grub_ieee1275_devalias *alias)); -grub_err_t EXPORT_FUNC(grub_children_iterate) (char *devpath, - int (*hook) (struct grub_ieee1275_devalias *alias)); -int EXPORT_FUNC(grub_claimmap) (grub_addr_t addr, grub_size_t size); - -void EXPORT_FUNC(abort) (void); -void EXPORT_FUNC (grub_reboot) (void); -void EXPORT_FUNC (grub_halt) (void); - -char *EXPORT_FUNC(grub_ieee1275_encode_devname) (const char *path); -char *EXPORT_FUNC(grub_ieee1275_get_filename) (const char *path); +typedef grub_uint32_t grub_ieee1275_cell_t; #endif /* ! GRUB_IEEE1275_MACHINE_HEADER */ diff --git a/include/grub/powerpc/ieee1275/kernel.h b/include/grub/powerpc/ieee1275/kernel.h index 801b00b9a..813ca11c2 100644 --- a/include/grub/powerpc/ieee1275/kernel.h +++ b/include/grub/powerpc/ieee1275/kernel.h @@ -20,6 +20,12 @@ #ifndef GRUB_KERNEL_MACHINE_HEADER #define GRUB_KERNEL_MACHINE_HEADER 1 +#include + +void EXPORT_FUNC (abort) (void); +void EXPORT_FUNC (grub_reboot) (void); +void EXPORT_FUNC (grub_halt) (void); + /* Where grub-mkimage places the core modules in memory. */ #define GRUB_IEEE1275_MODULE_BASE 0x00300000 diff --git a/boot/powerpc/ieee1275/ieee1275.c b/kern/ieee1275.c similarity index 74% rename from boot/powerpc/ieee1275/ieee1275.c rename to kern/ieee1275.c index 5e2059805..56ad8764c 100644 --- a/boot/powerpc/ieee1275/ieee1275.c +++ b/kern/ieee1275.c @@ -18,13 +18,12 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include - +#include #define IEEE1275_PHANDLE_ROOT ((grub_ieee1275_phandle_t) 0) #define IEEE1275_PHANDLE_INVALID ((grub_ieee1275_phandle_t) -1) -intptr_t (*grub_ieee1275_entry_fn) (void *); + /* FIXME is this function needed? */ grub_uint32_t @@ -36,18 +35,17 @@ grub_ieee1275_decode_int_4 (unsigned char *p) return (val + *p); } - int grub_ieee1275_finddevice (char *name, grub_ieee1275_phandle_t *phandlep) { struct find_device_args { struct grub_ieee1275_common_hdr common; - char *device; + grub_ieee1275_cell_t device; grub_ieee1275_phandle_t phandle; } args; INIT_IEEE1275_COMMON (&args.common, "finddevice", 1, 1); - args.device = name; + args.device = (grub_ieee1275_cell_t) name; if (IEEE1275_CALL_ENTRY_FN (&args) == -1) return -1; @@ -58,49 +56,49 @@ grub_ieee1275_finddevice (char *name, grub_ieee1275_phandle_t *phandlep) int grub_ieee1275_get_property (grub_ieee1275_phandle_t phandle, const char *property, void *buf, - grub_size_t size, grub_size_t *actual) + grub_size_t size, grub_ssize_t *actual) { struct get_property_args { struct grub_ieee1275_common_hdr common; grub_ieee1275_phandle_t phandle; - const char *prop; - void *buf; - int buflen; - int size; + grub_ieee1275_cell_t prop; + grub_ieee1275_cell_t buf; + grub_ieee1275_cell_t buflen; + grub_ieee1275_cell_t size; } args; INIT_IEEE1275_COMMON (&args.common, "getprop", 4, 1); args.phandle = phandle; - args.prop = property; - args.buf = buf; - args.buflen = size; + args.prop = (grub_ieee1275_cell_t) property; + args.buf = (grub_ieee1275_cell_t) buf; + args.buflen = (grub_ieee1275_cell_t) size; if (IEEE1275_CALL_ENTRY_FN (&args) == -1) return -1; if (actual) - *actual = args.size; - if (args.size == -1) + *actual = (grub_ssize_t) args.size; + if (args.size == (grub_ieee1275_cell_t) -1) return -1; return 0; } int grub_ieee1275_next_property (grub_ieee1275_phandle_t phandle, char *prev_prop, - char *prop, int *flags) + char *prop, grub_ieee1275_cell_t *flags) { struct get_property_args { struct grub_ieee1275_common_hdr common; grub_ieee1275_phandle_t phandle; - char *prev_prop; - char *next_prop; - int flags; + grub_ieee1275_cell_t prev_prop; + grub_ieee1275_cell_t next_prop; + grub_ieee1275_cell_t flags; } args; INIT_IEEE1275_COMMON (&args.common, "nextprop", 3, 1); args.phandle = phandle; - args.prev_prop = prev_prop; - args.next_prop = prop; - args.flags = -1; + args.prev_prop = (grub_ieee1275_cell_t) prev_prop; + args.next_prop = (grub_ieee1275_cell_t) prop; + args.flags = (grub_ieee1275_cell_t) -1; if (IEEE1275_CALL_ENTRY_FN (&args) == -1) return -1; @@ -111,19 +109,19 @@ grub_ieee1275_next_property (grub_ieee1275_phandle_t phandle, char *prev_prop, int grub_ieee1275_get_property_length (grub_ieee1275_phandle_t phandle, - const char *prop, grub_size_t *length) + const char *prop, grub_ssize_t *length) { struct get_property_args { struct grub_ieee1275_common_hdr common; grub_ieee1275_phandle_t phandle; - const char *prop; - grub_size_t length; + grub_ieee1275_cell_t prop; + grub_ieee1275_cell_t length; } args; INIT_IEEE1275_COMMON (&args.common, "getproplen", 2, 1); args.phandle = phandle; - args.prop = prop; - args.length = -1; + args.prop = (grub_ieee1275_cell_t) prop; + args.length = (grub_ieee1275_cell_t) -1; if (IEEE1275_CALL_ENTRY_FN (&args) == -1) return -1; @@ -152,20 +150,20 @@ grub_ieee1275_instance_to_package (grub_ieee1275_ihandle_t ihandle, int grub_ieee1275_package_to_path (grub_ieee1275_phandle_t phandle, - char *path, grub_size_t len, grub_size_t *actual) + char *path, grub_size_t len, grub_ssize_t *actual) { struct instance_to_package_args { struct grub_ieee1275_common_hdr common; grub_ieee1275_phandle_t phandle; - char *buf; - int buflen; - int actual; + grub_ieee1275_cell_t buf; + grub_ieee1275_cell_t buflen; + grub_ieee1275_cell_t actual; } args; INIT_IEEE1275_COMMON (&args.common, "package-to-path", 3, 1); args.phandle = phandle; - args.buf = path; - args.buflen = len; + args.buf = (grub_ieee1275_cell_t) path; + args.buflen = (grub_ieee1275_cell_t) len; if (IEEE1275_CALL_ENTRY_FN (&args) == -1) return -1; @@ -177,20 +175,20 @@ grub_ieee1275_package_to_path (grub_ieee1275_phandle_t phandle, int grub_ieee1275_instance_to_path (grub_ieee1275_ihandle_t ihandle, char *path, grub_size_t len, - grub_size_t *actual) + grub_ssize_t *actual) { struct instance_to_package_args { struct grub_ieee1275_common_hdr common; grub_ieee1275_ihandle_t ihandle; - char *buf; - int buflen; - int actual; + grub_ieee1275_cell_t buf; + grub_ieee1275_cell_t buflen; + grub_ieee1275_cell_t actual; } args; INIT_IEEE1275_COMMON (&args.common, "instance-to-path", 3, 1); args.ihandle = ihandle; - args.buf = path; - args.buflen = len; + args.buf = (grub_ieee1275_cell_t) path; + args.buflen = (grub_ieee1275_cell_t) len; if (IEEE1275_CALL_ENTRY_FN (&args) == -1) return -1; @@ -201,20 +199,20 @@ grub_ieee1275_instance_to_path (grub_ieee1275_ihandle_t ihandle, int grub_ieee1275_write (grub_ieee1275_ihandle_t ihandle, void *buffer, - grub_size_t len, grub_size_t *actualp) + grub_size_t len, grub_ssize_t *actualp) { struct write_args { struct grub_ieee1275_common_hdr common; grub_ieee1275_ihandle_t ihandle; - void *buf; - grub_size_t len; - grub_size_t actual; + grub_ieee1275_cell_t buf; + grub_ieee1275_cell_t len; + grub_ieee1275_cell_t actual; } args; INIT_IEEE1275_COMMON (&args.common, "write", 3, 1); args.ihandle = ihandle; - args.buf = buffer; - args.len = len; + args.buf = (grub_ieee1275_cell_t) buffer; + args.len = (grub_ieee1275_cell_t) len; if (IEEE1275_CALL_ENTRY_FN (&args) == -1) return -1; @@ -225,20 +223,20 @@ grub_ieee1275_write (grub_ieee1275_ihandle_t ihandle, void *buffer, int grub_ieee1275_read (grub_ieee1275_ihandle_t ihandle, void *buffer, - grub_size_t len, grub_size_t *actualp) + grub_size_t len, grub_ssize_t *actualp) { struct write_args { struct grub_ieee1275_common_hdr common; grub_ieee1275_ihandle_t ihandle; - void *buf; - grub_size_t len; - grub_size_t actual; + grub_ieee1275_cell_t buf; + grub_ieee1275_cell_t len; + grub_ieee1275_cell_t actual; } args; INIT_IEEE1275_COMMON (&args.common, "read", 3, 1); args.ihandle = ihandle; - args.buf = buffer; - args.len = len; + args.buf = (grub_ieee1275_cell_t) buffer; + args.len = (grub_ieee1275_cell_t) len; if (IEEE1275_CALL_ENTRY_FN (&args) == -1) return -1; @@ -249,20 +247,20 @@ grub_ieee1275_read (grub_ieee1275_ihandle_t ihandle, void *buffer, int grub_ieee1275_seek (grub_ieee1275_ihandle_t ihandle, int pos_hi, - int pos_lo, int *result) + int pos_lo, grub_ssize_t *result) { struct write_args { struct grub_ieee1275_common_hdr common; grub_ieee1275_ihandle_t ihandle; - int pos_hi; - int pos_lo; - int result; + grub_ieee1275_cell_t pos_hi; + grub_ieee1275_cell_t pos_lo; + grub_ieee1275_cell_t result; } args; INIT_IEEE1275_COMMON (&args.common, "seek", 3, 1); args.ihandle = ihandle; - args.pos_hi = pos_hi; - args.pos_lo = pos_lo; + args.pos_hi = (grub_ieee1275_cell_t) pos_hi; + args.pos_lo = (grub_ieee1275_cell_t) pos_lo; if (IEEE1275_CALL_ENTRY_FN (&args) == -1) return -1; @@ -332,16 +330,16 @@ grub_ieee1275_parent (grub_ieee1275_phandle_t node, } int -grub_ieee1275_interpret (const char *command, int *catch) +grub_ieee1275_interpret (const char *command, grub_ieee1275_cell_t *catch) { struct enter_args { struct grub_ieee1275_common_hdr common; - const char *command; - int catch; + grub_ieee1275_cell_t command; + grub_ieee1275_cell_t catch; } args; INIT_IEEE1275_COMMON (&args.common, "interpret", 1, 1); - args.command = command; + args.command = (grub_ieee1275_cell_t) command; if (IEEE1275_CALL_ENTRY_FN (&args) == -1) return -1; @@ -373,22 +371,21 @@ grub_ieee1275_exit (void) INIT_IEEE1275_COMMON (&args.common, "exit", 0, 0); - if (IEEE1275_CALL_ENTRY_FN (&args) == -1) - return -1; - return 0; + IEEE1275_CALL_ENTRY_FN (&args); + for (;;) ; } int -grub_ieee1275_open (char *node, grub_ieee1275_ihandle_t *result) +grub_ieee1275_open (const char *path, grub_ieee1275_ihandle_t *result) { struct open_args { struct grub_ieee1275_common_hdr common; - char *cstr; + grub_ieee1275_cell_t path; grub_ieee1275_ihandle_t result; } args; INIT_IEEE1275_COMMON (&args.common, "open", 1, 1); - args.cstr = node; + args.path = (grub_ieee1275_cell_t) path; if (IEEE1275_CALL_ENTRY_FN (&args) == -1) return -1; @@ -419,16 +416,16 @@ grub_ieee1275_claim (grub_addr_t addr, grub_size_t size, unsigned int align, { struct claim_args { struct grub_ieee1275_common_hdr common; - grub_addr_t addr; - grub_size_t size; - unsigned int align; - grub_addr_t base; + grub_ieee1275_cell_t addr; + grub_ieee1275_cell_t size; + grub_ieee1275_cell_t align; + grub_ieee1275_cell_t base; } args; INIT_IEEE1275_COMMON (&args.common, "claim", 3, 1); - args.addr = addr; - args.size = size; - args.align = align; + args.addr = (grub_ieee1275_cell_t) addr; + args.size = (grub_ieee1275_cell_t) size; + args.align = (grub_ieee1275_cell_t) align; if (IEEE1275_CALL_ENTRY_FN (&args) == -1) return -1; @@ -436,7 +433,7 @@ grub_ieee1275_claim (grub_addr_t addr, grub_size_t size, unsigned int align, if (result) *result = args.base; - if (args.base == (grub_addr_t)-1) + if (args.base == (grub_ieee1275_cell_t)-1) return -1; return 0; @@ -447,8 +444,8 @@ grub_ieee1275_release (grub_addr_t addr, grub_size_t size) { struct release_args { struct grub_ieee1275_common_hdr common; - grub_addr_t addr; - grub_size_t size; + grub_ieee1275_cell_t addr; + grub_ieee1275_cell_t size; } args; INIT_IEEE1275_COMMON (&args.common, "release", 2, 0); @@ -464,22 +461,22 @@ grub_ieee1275_release (grub_addr_t addr, grub_size_t size) int grub_ieee1275_set_property (grub_ieee1275_phandle_t phandle, const char *propname, void *buf, - grub_size_t size, grub_size_t *actual) + grub_size_t size, grub_ssize_t *actual) { struct set_property_args { struct grub_ieee1275_common_hdr common; grub_ieee1275_phandle_t phandle; - const char *propname; - void *buf; - grub_size_t size; - grub_size_t actual; + grub_ieee1275_cell_t propname; + grub_ieee1275_cell_t buf; + grub_ieee1275_cell_t size; + grub_ieee1275_cell_t actual; } args; INIT_IEEE1275_COMMON (&args.common, "setprop", 4, 1); - args.size = size; - args.buf = buf; - args.propname = propname; - args.phandle = phandle; + args.size = (grub_ieee1275_cell_t) size; + args.buf = (grub_ieee1275_cell_t) buf; + args.propname = (grub_ieee1275_cell_t) propname; + args.phandle = (grub_ieee1275_cell_t) phandle; if (IEEE1275_CALL_ENTRY_FN (&args) == -1) return -1; @@ -495,11 +492,11 @@ grub_ieee1275_set_color (grub_ieee1275_ihandle_t ihandle, struct grub_ieee1275_common_hdr common; char *method; grub_ieee1275_ihandle_t ihandle; - int index; - int b; - int g; - int r; - int result; + grub_ieee1275_cell_t index; + grub_ieee1275_cell_t b; + grub_ieee1275_cell_t g; + grub_ieee1275_cell_t r; + grub_ieee1275_cell_t result; } args; INIT_IEEE1275_COMMON (&args.common, "call-method", 6, 1); @@ -521,7 +518,7 @@ grub_ieee1275_milliseconds (grub_uint32_t *msecs) { struct milliseconds_args { struct grub_ieee1275_common_hdr common; - grub_uint32_t msecs; + grub_ieee1275_cell_t msecs; } args; INIT_IEEE1275_COMMON (&args.common, "milliseconds", 0, 1); diff --git a/kern/powerpc/ieee1275/init.c b/kern/powerpc/ieee1275/init.c index a22a97c05..704748190 100644 --- a/kern/powerpc/ieee1275/init.c +++ b/kern/powerpc/ieee1275/init.c @@ -23,16 +23,16 @@ #include #include #include -#include #include #include #include #include #include +#include #include #include -#include -#include +#include +#include /* Apple OF 1.0.5 reserves 0x0 to 0x4000 for the exception handlers. */ static const grub_addr_t grub_heap_start = 0x4000; diff --git a/kern/powerpc/ieee1275/openfw.c b/kern/powerpc/ieee1275/openfw.c index fd7b1cce4..115af9762 100644 --- a/kern/powerpc/ieee1275/openfw.c +++ b/kern/powerpc/ieee1275/openfw.c @@ -21,7 +21,8 @@ #include #include #include -#include +#include +#include enum grub_ieee1275_parse_type { @@ -38,11 +39,11 @@ grub_children_iterate (char *devpath, grub_ieee1275_phandle_t child; grub_ieee1275_finddevice (devpath, &dev); - if (dev == -1) + if (dev == (grub_ieee1275_phandle_t) -1) return grub_error (GRUB_ERR_UNKNOWN_DEVICE, "Unknown device"); grub_ieee1275_child (dev, &child); - if (child == -1) + if (child == (grub_ieee1275_phandle_t) -1) return grub_error (GRUB_ERR_BAD_DEVICE, "Device has no children"); do @@ -125,7 +126,8 @@ grub_devalias_iterate (int (*hook) (struct grub_ieee1275_devalias *alias)) continue; } - if (grub_ieee1275_finddevice (devpath, &dev) || dev == -1) + if (grub_ieee1275_finddevice (devpath, &dev) + || dev == (grub_ieee1275_phandle_t) -1) { grub_free (devpath); continue; diff --git a/loader/powerpc/ieee1275/linux.c b/loader/powerpc/ieee1275/linux.c index 940cd56eb..659bdd4ab 100644 --- a/loader/powerpc/ieee1275/linux.c +++ b/loader/powerpc/ieee1275/linux.c @@ -18,14 +18,14 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include #include #include #include #include #include #include +#include +#include static grub_dl_t my_mod; @@ -40,7 +40,7 @@ static grub_size_t linux_size; static char *linux_args; -typedef void (*kernel_entry_t) (void *, unsigned long, intptr_t (void *), +typedef void (*kernel_entry_t) (void *, unsigned long, int (void *), unsigned long, unsigned long); static grub_err_t diff --git a/term/powerpc/ieee1275/ofconsole.c b/term/ieee1275/ofconsole.c similarity index 98% rename from term/powerpc/ieee1275/ofconsole.c rename to term/ieee1275/ofconsole.c index 557401962..b7515b3b8 100644 --- a/term/powerpc/ieee1275/ofconsole.c +++ b/term/ieee1275/ofconsole.c @@ -18,11 +18,11 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include +#include #include #include #include +#include static grub_ieee1275_ihandle_t stdout_ihandle; static grub_ieee1275_ihandle_t stdin_ihandle; diff --git a/util/console.c b/util/console.c index 4ecce3cf4..030629846 100644 --- a/util/console.c +++ b/util/console.c @@ -19,7 +19,7 @@ */ #include -#include +#include #include #include diff --git a/util/grub-emu.c b/util/grub-emu.c index e57fe3b96..4321c948c 100644 --- a/util/grub-emu.c +++ b/util/grub-emu.c @@ -29,7 +29,7 @@ #include #include #include -#include +#include #include #include #include