qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] PPC fixes for qemu/OpenHackWare
@ 2005-02-08 19:45 Thayne Harbaugh
  2005-02-08 20:46 ` Fabrice Bellard
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Thayne Harbaugh @ 2005-02-08 19:45 UTC (permalink / raw)
  To: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 687 bytes --]

These fixes greatly improve qemu booting on PPC - many Linux
distributions with kernel 2.4 now work.  It's two big patches (one for
qemu, one for OpenHackWare) - let me know if someone prefers them broken
out into smaller pieces.

There's still some work to be done to get PREP in good shape as well as
a Linux 2.6 kernel to work well - expect some more patches in the near
future.

Highlights

* Real serial
* Correct PCI host bridge for PREP (wrong in Pearpc, Qemu and
OpenHackWare)
* -Werror building for OpenHackWare
* proper reboot
* HFS OpenHackWare now correctly traverses the B*tree - greatly improves
probability of booting *all* HFS based filesystems
* Many, MANY other fixes


[-- Attachment #2: qemu-0.6.1-ppc.patch --]
[-- Type: text/x-patch, Size: 7370 bytes --]

Index: qemu-0.6.1/Makefile
===================================================================
--- qemu-0.6.1/Makefile	(.../qemu-0.6.1)	(revision 7)
+++ qemu-0.6.1/Makefile	(.../external/qemu-0.6.1)	(working copy)
@@ -1,6 +1,7 @@
 -include config-host.mak
 
-CFLAGS=-Wall -O2 -g -fno-strict-aliasing 
+VPATH = $(SRC_PATH)
+CFLAGS=-Wall -O2 -g -fno-strict-aliasing -I.
 ifdef CONFIG_DARWIN
 CFLAGS+= -mdynamic-no-pic
 endif
Index: qemu-0.6.1/Makefile.target
===================================================================
--- qemu-0.6.1/Makefile.target	(.../qemu-0.6.1)	(revision 7)
+++ qemu-0.6.1/Makefile.target	(.../external/qemu-0.6.1)	(working copy)
@@ -2,7 +2,7 @@
 
 TARGET_PATH=$(SRC_PATH)/target-$(TARGET_ARCH)
 VPATH=$(SRC_PATH):$(TARGET_PATH):$(SRC_PATH)/hw:$(SRC_PATH)/audio
-DEFINES=-I. -I$(TARGET_PATH) -I$(SRC_PATH)
+DEFINES=-I. -I.. -I$(TARGET_PATH) -I$(SRC_PATH)
 ifdef CONFIG_USER_ONLY
 VPATH+=:$(SRC_PATH)/linux-user
 DEFINES+=-I$(SRC_PATH)/linux-user -I$(SRC_PATH)/linux-user/$(TARGET_ARCH)
Index: qemu-0.6.1/hw/cuda.c
===================================================================
--- qemu-0.6.1/hw/cuda.c	(.../qemu-0.6.1)	(revision 7)
+++ qemu-0.6.1/hw/cuda.c	(.../external/qemu-0.6.1)	(working copy)
@@ -87,6 +87,9 @@
 #define CUDA_TIMER_FREQ (4700000 / 6)
 #define CUDA_ADB_POLL_FREQ 50
 
+/* CUDA returns time_t's offset from Jan 1, 1904, not 1970 */
+#define RTC_OFFSET                      2082844800
+
 typedef struct CUDATimer {
     unsigned int latch;
     uint16_t counter_value; /* counter value at load time */
@@ -503,7 +506,7 @@
         break;
     case CUDA_GET_TIME:
         /* XXX: add time support ? */
-        ti = time(NULL);
+        ti = time(NULL) + RTC_OFFSET;
         obuf[0] = CUDA_PACKET;
         obuf[1] = 0;
         obuf[2] = 0;
@@ -522,6 +525,14 @@
         obuf[1] = 0;
         cuda_send_packet_to_host(s, obuf, 2);
         break;
+    case CUDA_POWERDOWN:
+        obuf[0] = CUDA_PACKET;
+        obuf[1] = 0;
+        cuda_send_packet_to_host(s, obuf, 2);
+	qemu_system_shutdown_request();
+	break;
+    case CUDA_MS_RESET:
+	
     default:
         break;
     }
Index: qemu-0.6.1/hw/openpic.c
===================================================================
--- qemu-0.6.1/hw/openpic.c	(.../qemu-0.6.1)	(revision 7)
+++ qemu-0.6.1/hw/openpic.c	(.../external/qemu-0.6.1)	(working copy)
@@ -345,7 +345,7 @@
     int i;
 
     opp->glbc = 0x80000000;
-    /* Initialise controler registers */
+    /* Initialise controller registers */
     opp->frep = ((EXT_IRQ - 1) << 16) | ((MAX_CPU - 1) << 8) | VID;
     opp->veni = VENI;
     opp->spve = 0x000000FF;
@@ -629,7 +629,7 @@
         break;
     case 0x10: /* TIBC */
 	if ((opp->timers[idx].ticc & 0x80000000) != 0 &&
-	    (val & 0x800000000) == 0 &&
+	    (val & 0x80000000) == 0 &&
             (opp->timers[idx].tibc & 0x80000000) != 0)
 	    opp->timers[idx].ticc &= ~0x80000000;
 	opp->timers[idx].tibc = val;
Index: qemu-0.6.1/hw/ppc_prep.c
===================================================================
--- qemu-0.6.1/hw/ppc_prep.c	(.../qemu-0.6.1)	(revision 7)
+++ qemu-0.6.1/hw/ppc_prep.c	(.../external/qemu-0.6.1)	(working copy)
@@ -478,14 +478,21 @@
     cpu_ppc_tb_init(cpu_single_env, 100UL * 1000UL * 1000UL);
 
     isa_mem_base = 0xc0000000;
-    pci_bus = pci_prep_init();
+
+    if (pci_enabled)
+	pci_bus = pci_prep_init();
+    else
+	pci_bus = NULL;
+
     /* Register 64 KB of ISA IO space */
     PPC_io_memory = cpu_register_io_memory(0, PPC_io_read, PPC_io_write, NULL);
     cpu_register_physical_memory(0x80000000, 0x00010000, PPC_io_memory);
 
     /* init basic PC hardware */
-    vga_initialize(pci_bus, ds, phys_ram_base + ram_size, ram_size, 
-                   vga_ram_size);
+    if (pci_enabled)
+	vga_initialize(pci_bus, ds, phys_ram_base + ram_size, ram_size, 
+		       vga_ram_size);
+
     rtc_init(0x70, 8);
     //    openpic = openpic_init(0x00000000, 0xF0000000, 1);
     //    pic_init(openpic);
@@ -493,17 +500,26 @@
     //    pit = pit_init(0x40, 0);
 
     serial_init(0x3f8, 4, serial_hds[0]);
-    nb_nics1 = nb_nics;
-    if (nb_nics1 > NE2000_NB_MAX)
-        nb_nics1 = NE2000_NB_MAX;
-    for(i = 0; i < nb_nics1; i++) {
-        isa_ne2000_init(ne2000_io[i], ne2000_irq[i], &nd_table[i]);
-    }
 
-    for(i = 0; i < 2; i++) {
-        isa_ide_init(ide_iobase[i], ide_iobase2[i], ide_irq[i],
-                     bs_table[2 * i], bs_table[2 * i + 1]);
-    }
+    if (pci_enabled) {
+        for(i = 0; i < nb_nics; i++) {
+            pci_ne2000_init(pci_bus, &nd_table[i]);
+        }
+        pci_ide_init(pci_bus, bs_table);
+    } else {
+        nb_nics1 = nb_nics;
+        if (nb_nics1 > NE2000_NB_MAX)
+            nb_nics1 = NE2000_NB_MAX;
+        for(i = 0; i < nb_nics1; i++) {
+            isa_ne2000_init(ne2000_io[i], ne2000_irq[i], &nd_table[i]);
+        }
+
+        for(i = 0; i < 2; i++) {
+            isa_ide_init(ide_iobase[i], ide_iobase2[i], ide_irq[i],
+                         bs_table[2 * i], bs_table[2 * i + 1]);
+        }
+     }
+
     kbd_init();
     DMA_init(1);
     //    AUD_init();
Index: qemu-0.6.1/hw/pci.c
===================================================================
--- qemu-0.6.1/hw/pci.c	(.../qemu-0.6.1)	(revision 7)
+++ qemu-0.6.1/hw/pci.c	(.../external/qemu-0.6.1)	(working copy)
@@ -698,10 +698,25 @@
                                            PPC_PCIIO_write, s);
     cpu_register_physical_memory(0x80800000, 0x00400000, PPC_io_memory);
 
-    d = pci_register_device(s, "PREP PCI Bridge", sizeof(PCIDevice), 0,
-                            NULL, NULL);
+    /* PCI host bridge */ 
+    d = pci_register_device(s, "PREP Host Bridge - Motorola Raven", sizeof(PCIDevice), 
+                            0, NULL, NULL);
+    d->config[0x00] = 0x57; // vendor_id : Apple
+    d->config[0x01] = 0x10;
+    d->config[0x02] = 0x01; // device_id
+    d->config[0x03] = 0x48;
+    d->config[0x08] = 0x00; // revision
+    d->config[0x0A] = 0x00; // class_sub = pci host
+    d->config[0x0B] = 0x06; // class_base = PCI_bridge
+    d->config[0x0C] = 0x08; // cache_line_size
+    d->config[0x0D] = 0x10; // latency_timer
+    d->config[0x0E] = 0x00; // header_type
+    d->config[0x34] = 0x00; // capabilities_pointer
 
-    /* XXX: put correct IDs */
+    /* PCI to PCI bridge */
+    d = pci_register_device(s, "PREP PCI Bridge - Digital 21154", sizeof(PCIDevice),
+			    0xa0 << 3, NULL, NULL);
+    /* same values as PearPC - check this */
     d->config[0x00] = 0x11; // vendor_id
     d->config[0x01] = 0x10;
     d->config[0x02] = 0x26; // device_id
@@ -710,6 +725,7 @@
     d->config[0x0a] = 0x04; // class_sub = pci2pci
     d->config[0x0b] = 0x06; // class_base = PCI_bridge
     d->config[0x0e] = 0x01; // header_type
+
     return s;
 }
 
Index: qemu-0.6.1/vl.c
===================================================================
--- qemu-0.6.1/vl.c	(.../qemu-0.6.1)	(revision 7)
+++ qemu-0.6.1/vl.c	(.../external/qemu-0.6.1)	(working copy)
@@ -246,7 +246,7 @@
     for(i = start; i < start + length; i += size) {
         ioport_write_table[bsize][i] = func;
         if (ioport_opaque[i] != NULL && ioport_opaque[i] != opaque)
-            hw_error("register_ioport_read: invalid opaque");
+            hw_error("register_ioport_write: invalid opaque");
         ioport_opaque[i] = opaque;
     }
     return 0;

[-- Attachment #3: OpenHackWare-0.3-ppc.patch --]
[-- Type: text/x-patch, Size: 76619 bytes --]

Index: OpenHackWare/Changelog
===================================================================
--- OpenHackWare/Changelog	(.../OpenHackWare)	(revision 10)
+++ OpenHackWare/Changelog	(.../external/OpenHackWare)	(working copy)
@@ -4,12 +4,56 @@
 #  Changelog for Open Hack'Ware.
 #  
 #  Copyright (C) 2004 Jocelyn Mayer (l_indien@magic.fr)
+#  Copyright (C) 2005 Matthew S. Wood (mwood@realmsys.com)
 #  
 #  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
 #
 
+2005-02-08: version 0.3+tlh:
+* Spelling
+ - OpenFirmawre -> OpenFirmware
+ - controler -> controller
+ - to -> too
+ - recurs -> recurse
+ - catched -> caught
+* HFS - Correctly descend right most nodes instead of giving up
+* General booting
+ - Fix (re)setting of bootpath and boot-device
+ - Strip all leading '/' from the bootname
+ - Add Debian Sarge bootscript checksum
+ - Mark uninitialized variable *rec
+* Building
+ - deal with unused functions
+ - deal with unused variables
+ - turn on -Werror
+* Hardware
+ - Fix IDE/ATA region initialization and OF_parent in ide/ata_config_cb
+ - Detect PREP host bridge (Raven)
+ - Don't probe partitions until after disk controllers are initialized
+ - Correctly exit out of pci_check_host()
+
+2005-01-27: version 0.3+msw:
+* OpenFirmware emulation:
+ - Recognize additional debian forth script.
+ - Deal with a kernel name which is quoted in the forth script.
+ - Boot off of first bootable partition on device (not last).
+ - Change reported machine type from PPC to PowerPC (fix for debian installer)
+ - Add PC Keyboard input support (PREP emulation).
+ - Add initial (broken) ADB keyboard support.
+ - Add serial port input support.
+ - Read input from any console with input available.
+ - Support firmware output to all consoles (VGA and Serial).
+* Partition management:
+ - Make partition search (Apple_bootstrap and the like) case-insensitive.
+* Misc:
+ - Add strncasecmp and tolower.
+ - Update copyrights.
+ - Cleanup code for GCC 3.2 warnings.
+ - Fix typo in BIOS ld script.
+
+
 2004-07-07: version 0.3:
 * OpenFirmware emulation:
  - Fix OF_lds and OF_sts
Index: OpenHackWare/src/main.ld
===================================================================
--- OpenHackWare/src/main.ld	(.../OpenHackWare)	(revision 10)
+++ OpenHackWare/src/main.ld	(.../external/OpenHackWare)	(working copy)
@@ -18,14 +18,14 @@
         . = ALIGN(4) ;
         .text     : { *(.text)    } > bios
         . = ALIGN(4) ;
-        .OpenFirmawre : { *(.OpenFirmware) } > bios
+        .OpenFirmware : { *(.OpenFirmware) } > bios
         . = ALIGN(4) ;
         _data_start = . ;
         .data     : { *(.data)    } > bios
         _data_end = . ;
         . = ALIGN(4) ;
         _OF_vars_start = . ;
-        .OpenFirmawre_vars : { *(.OpenFirmware_vars) } > bios
+        .OpenFirmware_vars : { *(.OpenFirmware_vars) } > bios
         _OF_vars_end = . ;
         . = ALIGN(4) ;
         _sdata_start = . ;
Index: OpenHackWare/src/bios.h
===================================================================
--- OpenHackWare/src/bios.h	(.../OpenHackWare)	(revision 10)
+++ OpenHackWare/src/bios.h	(.../external/OpenHackWare)	(working copy)
@@ -164,6 +164,7 @@
                            void **cmdline, uint32_t *cmdline_size,
                            void **ramdisk, uint32_t *ramdisk_size);
 
+
 /*****************************************************************************/
 /* bloc.c : bloc devices management */
 typedef struct pos_t {
@@ -197,6 +198,9 @@
 void bd_set_boot_part (bloc_device_t *bd, part_t *partition);
 part_t **_bd_parts (bloc_device_t *bd);
 
+void ide_isa_pc_register (int intf,
+			  uint32_t io_cmd, uint32_t io_ctrl,
+			  unused void *OF_private);
 void ide_pci_pc_register (uint32_t io_base0, uint32_t io_base1,
                           uint32_t io_base2, uint32_t io_base3,
                           void *OF_private);
@@ -309,6 +313,7 @@
 extern int vga_fb_bpp;
 extern int vga_fb_depth;
 void vga_prep_init(void);
+void vga_keyboard_init(void);
 void vga_set_address (uint32_t address);
 void vga_set_mode(int width, int height, int depth);
 void vga_set_palette(int i, unsigned int rgba);
@@ -329,6 +334,7 @@
                    unsigned int fgcol, unsigned int bgcol);
 void vga_putchar(int ch);
 void vga_puts(const char *s);
+int vga_getchar(void);
 
 /*****************************************************************************/
 /* bootinfos.c : build structures needed by kernels to boot */
@@ -374,6 +380,8 @@
                      const unsigned char *type);
 int OF_register_serial (const unsigned char *bus, const unsigned char *name,
                         uint32_t io_base, int irq);
+int OF_register_isa_ide (const unsigned char *bus, int intf,
+			 uint32_t io_cmd, uint32_t io_ctrl, unused int irq);
 int OF_register_stdio (const unsigned char *dev_in,
                        const unsigned char *dev_out);
 void OF_vga_register (const unsigned char *name, uint32_t address,
@@ -453,6 +461,8 @@
 unsigned int strlen (const void *buffer);
 int strcmp (const char *str0, const char *str1);
 int strncmp (const char *str0, const char *str1, int maxlen);
+int strncasecmp (const char *str0, const char *str1, int maxlen);
+int tolower (int c);
 char *strcpy (char *dst, const char *src);
 char *strdup (const char *src);
 char *strchr (const char *str, int c);
@@ -525,6 +535,9 @@
 
 /* Console */
 int cs_write (const unsigned char *buf, int len);
+int cs_writeb (uint8_t byte);
+int cs_read (unsigned char *buf, int len);
+int cs_readb (void);
 
 #endif /* !defined (ASSEMBLY_CODE) */
 
Index: OpenHackWare/src/of.c
===================================================================
--- OpenHackWare/src/of.c	(.../OpenHackWare)	(revision 10)
+++ OpenHackWare/src/of.c	(.../external/OpenHackWare)	(working copy)
@@ -98,7 +98,7 @@
         *_d++ = *p;
     }
     *_d = '\0';
-    OF_DPRINTF("Loaded string %s\n", _d);
+    OF_DPRINTF("Loaded string %s\n", dst);
 }
 
 __attribute__ (( section (".OpenFirmware") ))
@@ -490,6 +490,8 @@
             parent->child_last->next = new;
         }
         parent->child_last = new;
+    } else {
+	OF_DPRINTF("WARNING: parent of '%s' is NULL!\n", name);
     }
     new->refcount = 1;
     new->link_count = 1;
@@ -1111,7 +1113,7 @@
     OF_inst_t *new, *parent;
     uint16_t new_id;
 
-    /* TODO: recurs to root... */
+    /* TODO: recurse to root... */
     new = malloc(sizeof(OF_inst_t));
     if (new == NULL)
         return NULL;
@@ -1268,7 +1270,7 @@
     uint32_t address;
     int tmp, nlen;
 
-    /* Recurs until we reach the root node */
+    /* Recurse until we reach the root node */
     OF_DPRINTF("look for [%s]\n", node->prop_name->value);
     if (OF_node_parent(env, node) == NULL) {
         name[0] = '/';
@@ -1283,7 +1285,7 @@
         OF_DPRINTF("Found [%s]\n", prop_name->value);
 #endif
         if ((len - tmp) < 2) {
-            OF_DPRINTF("Buffer to short (%d 2)\n", len - tmp);
+            OF_DPRINTF("Buffer too short (%d 2)\n", len - tmp);
             return 0;
         }
         if (prop_name == NULL) {
@@ -1302,12 +1304,12 @@
         address = *((uint32_t *)prop_address->value);
         if (address != OF_ADDRESS_NONE) {
             if ((len - tmp - nlen) < 10) {
-                OF_DPRINTF("Buffer to short (%d %d)\n", len - tmp, nlen + 10);
+                OF_DPRINTF("Buffer too short (%d %d)\n", len - tmp, nlen + 10);
                 return 0;
             }
         } else {
             if ((len - tmp - nlen) < 1) {
-                OF_DPRINTF("Buffer to short (%d %d)\n", len - tmp, nlen + 1);
+                OF_DPRINTF("Buffer too short (%d %d)\n", len - tmp, nlen + 1);
                 return 0;
             }
         }
@@ -1375,7 +1377,7 @@
     OF_node_root = OF_node_new(OF_env, NULL, "device-tree", OF_ADDRESS_NONE);
     OF_prop_string_new(OF_env, OF_node_root, "device_type", "bootrom");
     OF_prop_string_new(OF_env, OF_node_root,
-                       "model", "PPC Open Hack'Ware " BIOS_VERSION);
+                       "model", "PowerPC Open Hack'Ware " BIOS_VERSION);
     OF_property_new(OF_env, OF_node_root, "compatible",
                     compat_str, sizeof(compat_str));
 #if 0
@@ -2017,6 +2019,44 @@
     return 0;
 }
 
+__attribute__ (( section (".OpenFirmware") ))
+int OF_register_isa_ide (const unsigned char *bus, int intf,
+			 uint32_t io_cmd, uint32_t io_ctrl, unused int irq)
+{
+    unsigned char tmp[OF_NAMELEN_MAX];
+    OF_env_t *OF_env;
+    OF_node_t *busn, *ide, *als;
+    OF_regprop_t regs[2];
+
+    OF_DPRINTF("bus '%s' intf %d io_cmd %08x io_ctrl %08x irq %d\n",
+	       bus, intf, io_cmd, io_ctrl, irq);
+    OF_env = OF_env_main;
+    als = OF_node_get(OF_env, "aliases");
+    busn = OF_node_get(OF_env, bus);
+    sprintf(tmp, "ide%d", intf);
+    tmp[OF_NAMELEN_MAX - 1] = '\0';
+    ide = OF_node_new(OF_env, busn, tmp, io_cmd);
+    OF_prop_string_set(OF_env, ide, "device_type", "block");
+    OF_prop_string_set(OF_env, ide, "compatible", "unknown");
+    OF_prop_string_set(OF_env, ide, "model", "ide");
+    OF_prop_int_new(OF_env, ide, "#address-cells", 1);
+    OF_prop_int_new(OF_env, ide, "#size-cells", 0);
+    regs[0].address = io_cmd;
+    regs[0].size = 8;
+    regs[1].address = io_ctrl;
+    regs[1].size = 1;
+    OF_property_new(OF_env, ide, "reg", regs, 2 * sizeof(OF_regprop_t));
+    regs[0].address = irq;
+    regs[0].size = 1;
+    OF_property_new(OF_env, ide, "interrupts", regs, sizeof(OF_regprop_t));
+    ide_isa_pc_register(intf, io_cmd, io_ctrl, ide);
+    OF_node_put(OF_env, ide);
+    OF_node_put(OF_env, busn);
+    OF_node_put(OF_env, als);
+
+    return 0;
+}
+
 /* We will also need /isa/rtc */
 
 __attribute__ (( section (".OpenFirmware") ))
@@ -2280,7 +2321,7 @@
         OF_node_put(OF_env, scc);
     }
 #endif
-    /* IDE controler */
+    /* IDE controller */
     {
         OF_node_t *ata;
         OF_regprop_t regs[2];
@@ -2489,32 +2530,20 @@
     }
     node = inst->node;
     //    OF_DPRINTF("args: %p str: %p\n", args, str);
-#if 0
-    // Should use new->prop_address
-    OF_property_copy(OF_env, &IO, sizeof(int), node, "IO");
-    outb(IO, c);
-#else
     for (; len != 0; str++, len--) {
-        if (*str == '\n') {
-            outb(0x0F01, '\n');
-        } else {
-            outb(0x0F00, *str);
-        }
+	cs_writeb(*str);
     }
-#endif
     pushd(OF_env, 0);
 }
 
-static const unsigned char in_msg[] =
-"help\r\tinstall-text\rG3\rinstall24\rboot-safe\rlive-safe\r\r";
 static void OF_serial_read (OF_env_t *OF_env)
 {
-    static const unsigned char *pos = in_msg;
     const unsigned char *args;
     char *dest;
     uint32_t len;
     uint32_t ihandle;
     uint16_t phandle;
+    uint32_t key;
 
     OF_CHECK_NBARGS(OF_env, 4);
     ihandle = popd(OF_env);
@@ -2522,14 +2551,12 @@
     phandle = (ihandle >> 16) & 0xFFFF;
     dest = (void *)popd(OF_env);
     len = popd(OF_env);
-    /* read is fake for now */
-    OF_DPRINTF("send '%c'\n", *pos);
-    if (*pos != '\0') {
-        *dest = *pos++;
-        pushd(OF_env, 1);
-    } else {
-        pushd(OF_env, 0);
-    }
+
+    for (key = 0; !key; usleep(100)) 
+	key = cs_readb();
+
+    *dest = (char)key;
+    pushd(OF_env, 1);
 }
 
 typedef struct blockdev_inst_t {
@@ -2904,8 +2931,13 @@
     sprintf(tmp + strlen(tmp), ":%d", partnum);
     /* OpenDarwin 6.02 seems to need this one */
     opts = OF_node_get(OF_env, "options");
-    OF_prop_string_new(OF_env, OF_node_root, "boot-device", tmp);
-    OF_prop_string_new(OF_env, opts, "boot-device", tmp);
+    /* OF_blockdev_set_boot_device() may be called multiple times
+     * as boot overrides take place - set an already existing property
+     * before creating a new one (boot-device, bootpath) */
+    if (! OF_prop_string_set(OF_env, OF_node_root, "boot-device", tmp))
+        OF_prop_string_new(OF_env, OF_node_root, "boot-device", tmp);
+    if (! OF_prop_string_set(OF_env, opts, "boot-device", tmp))
+	OF_prop_string_new(OF_env, opts, "boot-device", tmp);
     OF_DPRINTF("Set boot device to: '%s'\n", tmp);
     OF_node_put(OF_env, opts);
     /* Set the real boot path */
@@ -2917,7 +2949,8 @@
             *pos = '\\';
     }
     chs = OF_node_get(OF_env, "chosen");
-    OF_prop_string_new(OF_env, chs, "bootpath", tmp);
+    if (! OF_prop_string_set(OF_env, chs, "bootpath", tmp))
+	OF_prop_string_new(OF_env, chs, "bootpath", tmp);
     OF_DPRINTF("Set boot path to: '%s'\n", tmp);
     OF_node_put(OF_env, chs);
 }
Index: OpenHackWare/src/vectors.S
===================================================================
--- OpenHackWare/src/vectors.S	(.../OpenHackWare)	(revision 10)
+++ OpenHackWare/src/vectors.S	(.../external/OpenHackWare)	(working copy)
@@ -285,7 +285,7 @@
         mr      r3, r27                                   ;
         lwzu    r4, 4(r28)                                ;
         bl      outstr                                    ;
-        /* Find message corresponding to the catched exception */
+        /* Find message corresponding to the caught exception */
         srwi    r12, r22, 8                               ;
         cmp     0, r12, r30                               ;
         ble     _dump_excp_msg                            ;
@@ -338,7 +338,7 @@
 .section .rodata
 .align 2
 _BUG_message_0:
-        .string "ERROR: BUG catched...\n"
+        .string "ERROR: BUG caught...\n"
 _BUG_message_1:
         .string " exception"
 _BUG_message_2:
@@ -439,7 +439,7 @@
 _dummy_0:
         .long 0x00000000
 
-registers_area: /* To be loaded in register when an exception is catched */
+registers_area: /* To be loaded in register when an exception is caught */
 _serial_IO:      /* r27 */
         .long 0x800003F8
 _messages_start: /* r28 */
@@ -455,4 +455,4 @@
 .align 2
 save_area: /* Area for r11 save when an exception is skipped */
         .long 0x00000000
-       
\ No newline at end of file
+
Index: OpenHackWare/src/part.c
===================================================================
--- OpenHackWare/src/part.c	(.../OpenHackWare)	(revision 10)
+++ OpenHackWare/src/part.c	(.../external/OpenHackWare)	(working copy)
@@ -4,6 +4,8 @@
  * Open Hack'Ware BIOS partitions management
  * 
  * Copyright (c) 2004 Jocelyn Mayer
+ * Bootstrap enhancements Copyright (c) 2005 Matthew S. Wood
+ *                                           [mwood@realmsys.com]
  * 
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -23,7 +25,6 @@
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  * THE SOFTWARE.
  */
-
 #include "bios.h"
 
 /* Bootable partitions detection and management */
@@ -493,9 +494,7 @@
             /* Free space. Skip it */
             DPRINTF("%s Free part (%d)\n", __func__, i);
             part_register(bd, part, 0, -1, -1);
-        } else if (strncmp("Apple_partition_map", type, 32) == 0 ||
-                   strncmp("Apple_Partition_Map", type, 32) == 0 ||
-                   strncmp("Apple_patition_map", type, 32) == 0) {
+        } else if (strncasecmp("apple_partition_map", type, 32) == 0) {
             DPRINTF("%s Partition map\t%d [%s]\n", __func__, i, type);
             /* We are in the partition map descriptor */
             if (i == 1) {
@@ -523,15 +522,15 @@
             /* Patches: don't care for now */
             DPRINTF("%s Patches part\t%d [%s]\n", __func__, i, type);
             //            part_register(bd, part, 0, 2, -1);
-        } else if (strncmp("Apple_HFS", type, 32) == 0 ||
-                   strncmp("Apple_MFS", type, 32) == 0 ||
-                   strncmp("Apple_UFS", type, 32) == 0 ||
-                   strncmp("Apple_PRODOS", type, 32) == 0 ||
-                   strncmp("Apple_UNIX_SVR2", type, 32) == 0 ||
-                   strncmp("Linux", type, 32) == 0 ||
-                   strncmp("NetBSD/macppc", type, 32) == 0 ||
-                   strncmp("Apple_boot", type, 32) == 0 ||
-                   strncmp("Apple_bootstrap", type, 32) == 0) {
+        } else if (strncasecmp("Apple_HFS", type, 32) == 0 ||
+                   strncasecmp("Apple_MFS", type, 32) == 0 ||
+                   strncasecmp("Apple_UFS", type, 32) == 0 ||
+                   strncasecmp("Apple_PRODOS", type, 32) == 0 ||
+                   strncasecmp("Apple_UNIX_SVR2", type, 32) == 0 ||
+                   strncasecmp("Linux", type, 32) == 0 ||
+                   strncasecmp("NetBSD/macppc", type, 32) == 0 ||
+                   strncasecmp("Apple_boot", type, 32) == 0 ||
+                   strncasecmp("Apple_bootstrap", type, 32) == 0) {
             DPRINTF("%s Fs part\t%d [%s]\n", __func__, i, type);
             /* Filesystems / boot partitions */
             flags = partmap->flags;
@@ -544,10 +543,13 @@
                 name = partmap->name;
             }
             if (partmap->boot_size == 0 || partmap->boot_load == 0) {
-                printf("Not a bootable partition\n");
+                printf("Not a bootable partition (boot_size: %d, "
+		       "boot_load: %d)\n", partmap->boot_size,
+		       partmap->boot_load);
                 part_register(bd, part, 1, 0, 0);
                 if (partmap->boot_size != 0) {
                     boot_part = part;
+		    break;
                 }
             } else {
                 part->boot_start.bloc = partmap->boot_start;
@@ -575,6 +577,7 @@
             DPRINTF("                           load %0x entry %0x %0x\n",
                     partmap->boot_load2, partmap->boot_entry2, HFS_BLOCSIZE);
             boot_part = part;
+	    break;
         } else {
             memcpy(tmp, type, 32);
             tmp[32] = '\0';
@@ -585,6 +588,8 @@
  error:
     free(buffer);
 
+    if (!boot_part)
+	DPRINTF("No bootable partition found.\n");
     return boot_part;
 
 }
Index: OpenHackWare/src/fs.c
===================================================================
--- OpenHackWare/src/fs.c	(.../OpenHackWare)	(revision 10)
+++ OpenHackWare/src/fs.c	(.../external/OpenHackWare)	(working copy)
@@ -316,7 +316,7 @@
         FS_DPRINTF("Reached root node '/'\n");
         return strdup("/");
     }
-    FS_DPRINTF("Recurs to root '%s'...\n", inode->name);
+    FS_DPRINTF("Recurse to root '%s'...\n", inode->name);
     pname = fs_inode_get_path(parent);
     FS_DPRINTF("'%s' '%s'\n", pname, inode->name);
     len = strlen(pname);
@@ -473,8 +473,8 @@
     inode_t *inode;
 
     FS_DPRINTF("'%s'\n", name);
-    if (*name == '/')
-        name++;
+    while (*name == '/')
+	name++;
     inode = fs_walk(fs->root, name);
     if (inode != NULL)
         fs_seek(inode, 0, 0);
@@ -656,17 +656,17 @@
 }
 
 /* ext2 filesystem */
-static int fs_ext2_probe (part_t *part, uint32_t *size,
-                          fs_ops_t **fs_ops, unsigned char **name,
-                          void **private)
+static int fs_ext2_probe (unused part_t *part, unused uint32_t *size,
+                          unused fs_ops_t **fs_ops, unused unsigned char **name,
+                          unused void **private)
 {
     return -1;
 }
 
 /* ISOFS filesystem */
-static int fs_isofs_probe (part_t *part, uint32_t *size,
-                           fs_ops_t **fs_ops, unsigned char **name,
-                           void **private)
+static int fs_isofs_probe (unused part_t *part, unused uint32_t *size,
+                           unused fs_ops_t **fs_ops, unused unsigned char **name,
+                           unused void **private)
 {
     return -1;
 }
@@ -1711,6 +1711,7 @@
     return hfs_bnode_get(cur->tree, cur->next);
 }
 
+#ifdef UNUSED_FUNC
 static hfs_rec_t *hfs_rec_prev (hfs_rec_t *cur)
 {
     hfs_bnode_t *curn;
@@ -1727,6 +1728,7 @@
     
     return hfs_rec_get(curn, num - 1);
 }
+#endif /* UNUSED_FUNC */
 
 static int hfs_cat_compare (int type, HFS_cnid_t cnid,
                             const void *more, hfs_rec_t *rec, int rectype);
@@ -1735,7 +1737,7 @@
 static hfs_rec_t *hfs_rec_find (hfs_btree_t *tree,
                                 HFS_cnid_t cnid, const char *name, int rectype)
 {
-    hfs_bnode_t *curn, *prev;
+    hfs_bnode_t *curn, *prev, *next;
     hfs_rec_t *cur;
     unsigned int i;
     int ret;
@@ -1759,10 +1761,12 @@
         }
         HFS_DPRINTF("ret=%d\n", ret);
         if (i == curn->nrecs + 1 && ret > 0) {
-            HFS_DPRINTF("Continue with next node %08x\n", curn->next);
-            curn = hfs_bnode_next(curn);
-            i = 0;
-            continue;
+            next = hfs_bnode_next(curn);
+	    if (next != NULL) {
+		curn = next;
+		HFS_DPRINTF("Continue with next node %08x\n", curn->next);
+		continue;
+	    }
         }
 #if 1
         if (curn->type != RECORD_IDX && curn->type != RECORD_HEAD) {
@@ -1786,7 +1790,7 @@
                 return NULL;
             }
         }
-        HFS_DPRINTF("Recurs to leaf: %d %08x => %08x\n",
+        HFS_DPRINTF("Recurse to leaf: %d %08x => %08x\n",
                     cnid, i, cur->u.idxrec.uid);
         curn = hfs_bnode_get(curn->tree, cur->u.idxrec.uid);
     }
@@ -1839,7 +1843,7 @@
             HFS_ERROR("Cannot get record %d\n", idx);
             return NULL;
         }
-        HFS_DPRINTF("Check record %d '%s' '%s' '%s' '%s'\n",
+        HFS_DPRINTF("Check record %d ('%s' '%s') vs ('%s' '%s')\n",
                    idx, rec->u.catrec.name, rec->u.catrec.finfo, name, info);
         if (rec->type == RECORD_IDX) {
             continue;
@@ -1973,12 +1977,14 @@
     return hfs_btree_open(&volume->cat_file, RECORD_CAT, &hfs_cat_compare);
 }
 
+#ifdef UNUSED_FUNC
 static int hfs_ext_compare (int type, HFS_cnid_t cnid,
                             const void *more, hfs_rec_t *rec)
 {
     /* TODO */
     return -1;
 }
+#endif /* UNUSED_FUNC */
 
 static hfs_btree_t *hfs_ext_open (hfs_vol_t *volume)
 {
@@ -1988,6 +2000,9 @@
 #else
     return NULL;
+
+    /* FIXME - quiet gcc about unused variables */
+    (void)volume;
 #endif
 }
 
 static void hfs_map_boot_file (part_t *part, hfs_vol_t *volume,
@@ -2079,7 +2094,7 @@
                                  uint32_t *boot_size)
 {
     unsigned char *buf, *pos, *end, c;
-    hfs_rec_t *drec, *rec;
+    hfs_rec_t *rec;
     XML_tag_t *tag, *tmp, *first;
     enum {
         STATE_OUT = 0,
@@ -2093,7 +2108,6 @@
         SCRIPT_EMBEDDED,
     };
     int script_type = SCRIPT_IGNORE;
-    HFS_cnid_t cnid;
     uint32_t crc, offset = 0;
 
     buf = malloc(16384);
@@ -2161,6 +2175,10 @@
                         /* Gentoo 2004.1 minimal install CD */
                         /* Gentoo 1.4 live CDROM */
                         /* Knopix PPC beta-pre12 */
+		    case 0x633e4c9c:
+			/* Debian Sarge */
+		    case 0x9ccdf371:
+			/* YADW (yet another Debian Woody) */
                     case 0x75420D8A:
                         /* Debian woody */
                         /* Debian 3.0r1 */
@@ -2216,7 +2234,9 @@
                                 continue;
                             /* Find file name end */
                         redo:
-                            for (end = pos; *end != ' ' && *end != '\n'; end++)
+                            for (end = pos;
+				 *end != ' ' && *end != '\n' && *end != '"';
+				 end++)
                                 continue;
                             if (memcmp(pos, "ofwboot", 7) == 0) {
                                 for (pos = end + 1; *pos == ' '; pos++)
@@ -2229,64 +2249,49 @@
                                     volume->boot_id);
                         /* check if it's a path or just a file */
                         rec = NULL;
-                        if (strchr(pos, '/') != NULL ||
-                            strchr(pos, '\\') != NULL) {
 #if 1
-                            inode_t *inode;
-                            hfs_fork_t *fork;
-                            for (;;) {
+                        inode_t *inode;
+                        hfs_fork_t *fork;
+                        for (;;) {
+                            end = strchr(pos, '\\');
+                            if (end == NULL)
+                                break;
+                            *end = '/';
+                        }
+                        inode = fs_open(part_fs(volume->part), pos);
+                        if (inode == NULL) {
+                            HFS_ERROR("Real boot inode '%s' not found\n",
+                                      pos);
+                            bug();
+                        }
+                        fork = inode->private;
+                        rec = fork->catrec;
+#else
+                        end = pos;
+                        pos = NULL;
+                        for (cnid = HFS_ROOT_FOLDER;;) {
+                            drec = hfs_get_dir(volume->cat_tree,
+                                               cnid, pos);
+                            HFS_DPRINTF("check '%s'\n", pos);
+                            for (; *pos == '\\' || *pos == '/'; pos++)
+                                continue;
+                            HFS_DPRINTF(" => '%s' in %08x\n", pos, cnid);
+                            end = strchr(pos, '/');
+                            if (end == NULL) {
                                 end = strchr(pos, '\\');
-                                if (end == NULL)
-                                    break;
-                                *end = '/';
                             }
-                            inode = fs_open(part_fs(volume->part), pos);
-                            if (inode == NULL) {
-                                HFS_ERROR("Real boot inode '%s' not found\n",
-                                          pos);
-                                bug();
-                            }
-                            fork = inode->private;
-                            rec = fork->catrec;
-#else
-                            end = pos;
-                            pos = NULL;
-                            for (cnid = HFS_ROOT_FOLDER;;) {
-                                drec = hfs_get_dir(volume->cat_tree,
-                                                   cnid, pos);
-                                HFS_DPRINTF("check '%s'\n", pos);
-                                for (; *pos == '\\' || *pos == '/'; pos++)
-                                    continue;
-                                HFS_DPRINTF(" => '%s' in %08x\n", pos, cnid);
-                                end = strchr(pos, '/');
-                                if (end == NULL) {
-                                    end = strchr(pos, '\\');
-                                }
-                                if (end == NULL)
-                                    break;
-                                *end = '\0';
-                                pos = end + 1;
-                                cnid = 0;
-                            }
-                            rec = hfs_get_dirfile(drec, cnid, pos, NULL);
+                            if (end == NULL)
+                                break;
+                            *end = '\0';
+                            pos = end + 1;
+                            cnid = 0;
+                        }
+                        rec = hfs_get_dirfile(drec, cnid, pos, NULL);
 #endif
-                        } else {
-                            if (volume->boot_id != 0x00000000) {
-                                drec = hfs_get_dir(volume->cat_tree,
-                                                   volume->boot_id, NULL);
-                                rec = hfs_get_dirfile(drec, volume->boot_id,
-                                                      pos, NULL);
-                            }
-                            if (rec == NULL) {
-                                drec = hfs_get_dir(volume->cat_tree,
-                                                   HFS_ROOT_FOLDER, NULL);
-                                rec = hfs_get_dirfile(drec, HFS_ROOT_FOLDER,
-                                                      pos, NULL);
-                            }
-                        }
                         if (rec == NULL) {
-                            HFS_ERROR("Real boot file not found !\n");
+                            HFS_ERROR("Real boot file '%s' not found !\n", pos);
                         } else {
+                            HFS_DPRINTF("*** Found boot file.***\n");
                             volume->boot_file = &rec->u.catrec.fork;
                             hfs_map_boot_file(part, volume,
                                               boot_start,
@@ -2469,7 +2474,10 @@
         if (volume->boot_file != NULL) {
             bfile = malloc(sizeof(inode_t));
             fs->bootfile = bfile;
+#ifdef UNINITIALIZED
             bfile->name = strdup(rec->u.catrec.name);
+#endif
+	    HFS_ERROR("UNINITIALIZED *rec pointer\n");
             bfile->private = volume->boot_file;
             bfile->flags = INODE_TYPE_FILE | INODE_FLAG_EXEC | INODE_FLAG_BOOT;
             fs->bootdir = fs->root;
Index: OpenHackWare/src/pci.c
===================================================================
--- OpenHackWare/src/pci.c	(.../OpenHackWare)	(revision 10)
+++ OpenHackWare/src/pci.c	(.../external/OpenHackWare)	(working copy)
@@ -23,6 +23,16 @@
 
 #include "bios.h"
 
+//#define DEBUG_PCI 1
+
+#if defined (DEBUG_PCI)
+#define PCI_DPRINTF(fmt, args...) \
+do { printf("%s: " fmt, __func__ , ##args); } while (0)
+#else
+#define PCI_DPRINTF(fmt, args...) \
+do { } while (0)
+#endif
+
 /* On PMAC, there are four kind of PCI bridges:
  * - uninorth, for all recent machines (all Core99 and more).
  * - chaos : buggy bandit like
@@ -435,6 +445,7 @@
     (*bridge->ops->config_writel)(bridge, bus, devfn, offset, val);
 }
 
+#ifdef UNUSED_FUNC
 static void *get_parent_OF_private (pci_device_t *device)
 {
     const pci_u_t *u;
@@ -446,6 +457,7 @@
     
     return NULL;
 }
+#endif /* UNUSED_FUNC */
 
 /* PCI devices database */
 static pci_subclass_t undef_subclass[] = {
@@ -476,17 +488,19 @@
 
 static int ide_config_cb (pci_device_t *device)
 {
-    printf("Register IDE controler\n");
+    printf("Register IDE controller\n");
     switch (arch) {
     case ARCH_MAC99:
         ide_pci_pmac_register(device->regions[0] & ~0x0000000F,
-                              device->regions[1] & ~0x0000000F, NULL);
+                              device->regions[1] & ~0x0000000F,
+			      device->common.OF_private);
         break;
     default:
         ide_pci_pc_register(device->regions[0] & ~0x0000000F,
+                            device->regions[2] & ~0x0000000F,
                             device->regions[1] & ~0x0000000F,
-                            device->regions[2] & ~0x0000000F,
-                            device->regions[3] & ~0x0000000F, NULL);
+                            device->regions[3] & ~0x0000000F,
+			    device->common.OF_private);
     }
 
     return 0;
@@ -494,17 +508,19 @@
 
 static int ata_config_cb (pci_device_t *device)
 {
-    printf("Register ATA  controler\n");
+    printf("Register ATA  controller\n");
     switch (arch) {
     case ARCH_MAC99:
         ide_pci_pmac_register(device->regions[0] & ~0x0000000F,
-                              device->regions[1] & ~0x0000000F, NULL);
+                              device->regions[1] & ~0x0000000F,
+			      device->common.OF_private);
         break;
     default:
         ide_pci_pc_register(device->regions[0] & ~0x0000000F,
+                            device->regions[2] & ~0x0000000F,
                             device->regions[1] & ~0x0000000F,
-                            device->regions[2] & ~0x0000000F,
-                            device->regions[3] & ~0x0000000F, NULL);
+                            device->regions[3] & ~0x0000000F,
+			    device->common.OF_private);
     }
 
     return 0;
@@ -512,31 +528,31 @@
 
 static pci_subclass_t mass_subclass[] = {
     {
-        0x00, "SCSI bus controler",        NULL,  NULL, NULL,
+        0x00, "SCSI bus controller",        NULL,  NULL, NULL,
         NULL, NULL,
     },
     {
-        0x01, "IDE controler",             "ide", ide_devices, NULL,
+        0x01, "IDE controller",             "ide", ide_devices, NULL,
         &ide_config_cb, NULL,
     },
     {
-        0x02, "Floppy disk controler",     NULL,  NULL, NULL,
+        0x02, "Floppy disk controller",     NULL,  NULL, NULL,
         NULL, NULL,
     },
     {
-        0x03, "IPI bus controler",         NULL,  NULL, NULL,
+        0x03, "IPI bus controller",         NULL,  NULL, NULL,
         NULL, NULL,
     },
     {
-        0x04, "RAID controler",            NULL,  NULL, NULL,
+        0x04, "RAID controller",            NULL,  NULL, NULL,
         NULL, NULL,
     },
     {
-        0x05, "ATA controler",             "ata", NULL, NULL,
+        0x05, "ATA controller",             "ata", NULL, NULL,
         &ata_config_cb, NULL,
     },
     {
-        0x80, "misc mass-storage controler", NULL, NULL, NULL,
+        0x80, "misc mass-storage controller", NULL, NULL, NULL,
         NULL, NULL,
     },
     {
@@ -561,35 +577,35 @@
 
 static pci_subclass_t net_subclass[] = {
     {
-        0x00, "ethernet controler",       NULL, eth_devices, NULL,
+        0x00, "ethernet controller",       NULL, eth_devices, NULL,
         NULL, "ethernet",
     },
     {
-        0x01, "token ring controler",      NULL,  NULL, NULL,
+        0x01, "token ring controller",      NULL,  NULL, NULL,
         NULL, NULL,
     },
     {
-        0x02, "FDDI controler",            NULL,  NULL, NULL,
+        0x02, "FDDI controller",            NULL,  NULL, NULL,
         NULL, NULL,
     },
     {
-        0x03, "ATM controler",             NULL,  NULL, NULL,
+        0x03, "ATM controller",             NULL,  NULL, NULL,
         NULL, NULL,
     },
     {
-        0x04, "ISDN controler",            NULL,  NULL, NULL,
+        0x04, "ISDN controller",            NULL,  NULL, NULL,
         NULL, NULL,
     },
     {
-        0x05, "WordFip controler",         NULL,  NULL, NULL,
+        0x05, "WordFip controller",         NULL,  NULL, NULL,
         NULL, NULL,
     },
     {
-        0x06, "PICMG 2.14 controler",      NULL,  NULL, NULL,
+        0x06, "PICMG 2.14 controller",      NULL,  NULL, NULL,
         NULL, NULL,
     },
     {
-        0x80, "misc network controler",    NULL,  NULL, NULL,
+        0x80, "misc network controller",    NULL,  NULL, NULL,
         NULL, NULL,
     },
     {
@@ -640,11 +656,11 @@
 
 static struct pci_iface_t vga_iface[] = {
     { 
-        0x00, "VGA controler", NULL,
+        0x00, "VGA controller", NULL,
         vga_devices, &vga_config_cb, NULL,
     },
     {
-        0x01, "8514 compatible controler", NULL,
+        0x01, "8514 compatible controller", NULL,
         NULL, NULL, NULL,
     },
     {
@@ -655,19 +671,19 @@
 
 static pci_subclass_t displ_subclass[] = {
     {
-        0x00, "display controler",         NULL,  NULL, vga_iface,
+        0x00, "display controller",         NULL,  NULL, vga_iface,
         NULL, NULL,
     },
     {
-        0x01, "XGA display controler",     NULL,  NULL, NULL,
+        0x01, "XGA display controller",     NULL,  NULL, NULL,
         NULL, NULL,
     },
     {
-        0x02, "3D display controler",      NULL,  NULL, NULL,
+        0x02, "3D display controller",      NULL,  NULL, NULL,
         NULL, NULL,
     },
     {
-        0x80, "misc display controler",    NULL,  NULL, NULL,
+        0x80, "misc display controller",    NULL,  NULL, NULL,
         NULL, NULL,
     },
     {
@@ -701,11 +717,11 @@
 
 static pci_subclass_t mem_subclass[] = {
     {
-        0x00, "RAM controler",             NULL,  NULL, NULL,
+        0x00, "RAM controller",             NULL,  NULL, NULL,
         NULL, NULL,
     },
     {
-        0x01, "flash controler",           NULL,  NULL, NULL,
+        0x01, "flash controller",           NULL,  NULL, NULL,
         NULL, NULL,
     },
     {
@@ -755,8 +771,8 @@
         NULL, &uninorth_fake_bridge,
     },
     {
-        0x1011, 0x0026, NULL,
-        "pci-bridge", NULL, NULL,
+        0x1057, 0x4801, NULL,
+        "pci", "PREP Host PCI Bridge - Motorola Raven", NULL,
         3, 2, 1,
         NULL, &PREP_pci_ops,
     },
@@ -840,31 +856,31 @@
 
 static pci_iface_t serial_iface[] = {
     {
-        0x00, "XT serial controler", NULL,
+        0x00, "XT serial controller", NULL,
         NULL, NULL, NULL,
     },
     {
-        0x01, "16450 serial controler", NULL,
+        0x01, "16450 serial controller", NULL,
         NULL, NULL, NULL,
     },
     {
-        0x02, "16550 serial controler", NULL,
+        0x02, "16550 serial controller", NULL,
         NULL, NULL, NULL,
     },
     {
-        0x03, "16650 serial controler", NULL,
+        0x03, "16650 serial controller", NULL,
         NULL, NULL, NULL,
     },
     {
-        0x04, "16750 serial controler", NULL,
+        0x04, "16750 serial controller", NULL,
         NULL, NULL, NULL,
     },
     {
-        0x05, "16850 serial controler", NULL,
+        0x05, "16850 serial controller", NULL,
         NULL, NULL, NULL,
     },
     {
-        0x06, "16950 serial controler", NULL,
+        0x06, "16950 serial controller", NULL,
         NULL, NULL, NULL,
     },
     {
@@ -887,7 +903,7 @@
         NULL, NULL, NULL,
     },
     {
-        0x03, "IEEE 1284 controler", NULL,
+        0x03, "IEEE 1284 controller", NULL,
         NULL, NULL, NULL,
     },
     {
@@ -929,7 +945,7 @@
 
 static pci_subclass_t comm_subclass[] = {
     {
-        0x00, "serial controler",          NULL, NULL, serial_iface,
+        0x00, "serial controller",          NULL, NULL, serial_iface,
         NULL, NULL,
     },
     {
@@ -937,7 +953,7 @@
         NULL, NULL,
     },
     {
-        0x02, "multiport serial controler", NULL, NULL, NULL,
+        0x02, "multiport serial controller", NULL, NULL, NULL,
         NULL, NULL,
     },
     {
@@ -991,15 +1007,15 @@
 
 static pci_iface_t dma_iface[] = {
     {
-        0x00, "8237 DMA controler", NULL,
+        0x00, "8237 DMA controller", NULL,
         NULL, NULL, NULL,
     },
     {
-        0x01, "ISA DMA controler", NULL,
+        0x01, "ISA DMA controller", NULL,
         NULL, NULL, NULL,
     },
     {
-        0x02, "EISA DMA controler", NULL,
+        0x02, "EISA DMA controller", NULL,
         NULL, NULL, NULL,
     },
     {
@@ -1029,11 +1045,11 @@
 
 static pci_iface_t rtc_iface[] = {
     {
-        0x00, "generic RTC controler", NULL,
+        0x00, "generic RTC controller", NULL,
         NULL, NULL, NULL,
     },
     {
-        0x01, "ISA RTC controler", NULL,
+        0x01, "ISA RTC controller", NULL,
         NULL, NULL, NULL,
     },
     {
@@ -1043,14 +1059,14 @@
 };
 
 static const pci_dev_t sys_devices[] = {
-    /* IBM MPIC controler */
+    /* IBM MPIC controller */
     { 
         0x1014, 0x0002,
         "open-pic", "MPIC", NULL, "chrp,open-pic",
         0, 0, 2,
         NULL, NULL,
     },
-    /* IBM MPIC2 controler */
+    /* IBM MPIC2 controller */
     { 
         0x1014, 0xFFFF,
         "open-pic", "MPIC2", NULL, "chrp,open-pic",
@@ -1071,7 +1087,7 @@
         NULL, NULL,
     },
     {
-        0x01, "DMA controler",             NULL, NULL, dma_iface,
+        0x01, "DMA controller",             NULL, NULL, dma_iface,
         NULL, NULL,
     },
     {
@@ -1079,11 +1095,11 @@
         NULL, NULL,
     },
     {
-        0x03, "RTC controler",             NULL, NULL, rtc_iface,
+        0x03, "RTC controller",             NULL, NULL, rtc_iface,
         NULL, NULL,
     },
     {
-        0x04, "PCI hotplug controler",     NULL, NULL, NULL,
+        0x04, "PCI hotplug controller",     NULL, NULL, NULL,
         NULL, NULL,
     },
     {
@@ -1098,7 +1114,7 @@
 
 static pci_subclass_t inp_subclass[] = {
     {
-        0x00, "keyboard controler",        NULL, NULL, NULL,
+        0x00, "keyboard controller",        NULL, NULL, NULL,
         NULL, NULL,
     },
     {
@@ -1106,15 +1122,15 @@
         NULL, NULL,
     },
     {
-        0x02, "mouse controler",           NULL, NULL, NULL,
+        0x02, "mouse controller",           NULL, NULL, NULL,
         NULL, NULL,
     },
     {
-        0x03, "scanner controler",         NULL, NULL, NULL,
+        0x03, "scanner controller",         NULL, NULL, NULL,
         NULL, NULL,
     },
     {
-        0x04, "gameport controler",        NULL, NULL, NULL,
+        0x04, "gameport controller",        NULL, NULL, NULL,
         NULL, NULL,
     },
     {
@@ -1179,19 +1195,19 @@
 
 static pci_iface_t usb_iface[] = {
     {
-        0x00, "UHCI USB controler", NULL,
+        0x00, "UHCI USB controller", NULL,
         NULL, NULL, NULL,
     },
     {
-        0x10, "OHCI USB controler", NULL,
+        0x10, "OHCI USB controller", NULL,
         NULL, NULL, NULL,
     },
     {
-        0x20, "EHCI USB controler", NULL,
+        0x20, "EHCI USB controller", NULL,
         NULL, NULL, NULL,
     },
     {
-        0x80, "misc USB controler", NULL,
+        0x80, "misc USB controller", NULL,
         NULL, NULL, NULL,
     },
     {
@@ -1225,31 +1241,31 @@
 
 static pci_subclass_t ser_subclass[] = {
     {
-        0x00, "Firewire bus controler",    "ieee1394", NULL, NULL,
+        0x00, "Firewire bus controller",    "ieee1394", NULL, NULL,
         NULL, NULL,
     },
     {
-        0x01, "ACCESS bus controler",      NULL, NULL,  NULL,
+        0x01, "ACCESS bus controller",      NULL, NULL,  NULL,
         NULL, NULL,
     },
     {
-        0x02, "SSA controler",             NULL, NULL,  NULL,
+        0x02, "SSA controller",             NULL, NULL,  NULL,
         NULL, NULL,
     },
     {
-        0x03, "USB controler",             "usb", NULL, usb_iface,
+        0x03, "USB controller",             "usb", NULL, usb_iface,
         NULL, NULL,
     },
     {
-        0x04, "fibre channel controler",   NULL, NULL,  NULL,
+        0x04, "fibre channel controller",   NULL, NULL,  NULL,
         NULL, NULL,
     },
     {
-        0x05, "SMBus controler",           NULL, NULL,  NULL,
+        0x05, "SMBus controller",           NULL, NULL,  NULL,
         NULL, NULL,
     },
     {
-        0x06, "InfiniBand controler",      NULL, NULL,  NULL,
+        0x06, "InfiniBand controller",      NULL, NULL,  NULL,
         NULL, NULL,
     },
     {
@@ -1257,11 +1273,11 @@
         NULL, NULL,
     },
     {
-        0x08, "SERCOS controler",          NULL, NULL,  ipmi_iface,
+        0x08, "SERCOS controller",          NULL, NULL,  ipmi_iface,
         NULL, NULL,
     },
     {
-        0x09, "CANbus controler",          NULL, NULL,  ipmi_iface,
+        0x09, "CANbus controller",          NULL, NULL,  ipmi_iface,
         NULL, NULL,
     },
     {
@@ -1272,27 +1288,27 @@
 
 static pci_subclass_t wrl_subclass[] = {
     {
-        0x00, "IRDA controler",           NULL, NULL,  NULL,
+        0x00, "IRDA controller",           NULL, NULL,  NULL,
         NULL, NULL,
     },
     {
-        0x01, "consumer IR controler",    NULL, NULL,  NULL,
+        0x01, "consumer IR controller",    NULL, NULL,  NULL,
         NULL, NULL,
     },
     {
-        0x10, "RF controler",             NULL, NULL,  NULL,
+        0x10, "RF controller",             NULL, NULL,  NULL,
         NULL, NULL,
     },
     {
-        0x11, "bluetooth controler",      NULL, NULL,  NULL,
+        0x11, "bluetooth controller",      NULL, NULL,  NULL,
         NULL, NULL,
     },
     {
-        0x12, "broadband controler",      NULL, NULL,  NULL,
+        0x12, "broadband controller",      NULL, NULL,  NULL,
         NULL, NULL,
     },
     {
-        0x80, "misc wireless controler",  NULL, NULL,  NULL,
+        0x80, "misc wireless controller",  NULL, NULL,  NULL,
         NULL, NULL,
     },
     {
@@ -1303,19 +1319,19 @@
 
 static pci_subclass_t sat_subclass[] = {
     {
-        0x01, "satellite TV controler",   NULL, NULL,  NULL,
+        0x01, "satellite TV controller",   NULL, NULL,  NULL,
         NULL, NULL,
     },
     {
-        0x02, "satellite audio controler", NULL, NULL, NULL,
+        0x02, "satellite audio controller", NULL, NULL, NULL,
         NULL, NULL,
     },
     {
-        0x03, "satellite voice controler", NULL, NULL, NULL,
+        0x03, "satellite voice controller", NULL, NULL, NULL,
         NULL, NULL,
     },
     {
-        0x04, "satellite data controler", NULL, NULL,  NULL,
+        0x04, "satellite data controller", NULL, NULL,  NULL,
         NULL, NULL,
     },
     {
@@ -1326,15 +1342,15 @@
 
 static pci_subclass_t crypt_subclass[] = {
     {
-        0x00, "cryptographic network controler", NULL, NULL, NULL,
+        0x00, "cryptographic network controller", NULL, NULL, NULL,
         NULL, NULL,
     },
     {
-        0x10, "cryptographic entertainment controler", NULL, NULL, NULL,
+        0x10, "cryptographic entertainment controller", NULL, NULL, NULL,
         NULL, NULL,
     },
     {
-        0x80, "misc cryptographic controler",    NULL, NULL, NULL,
+        0x80, "misc cryptographic controller",    NULL, NULL, NULL,
         NULL, NULL,
     },
     {
@@ -1361,7 +1377,7 @@
         NULL, NULL,
     },
     {
-        0x80, "misc signal processing controler", NULL, NULL, NULL,
+        0x80, "misc signal processing controller", NULL, NULL, NULL,
         NULL, NULL,
     },
     {
@@ -1374,15 +1390,15 @@
     /* 0x00 */
     { "undefined",                         NULL,             undef_subclass, },
     /* 0x01 */
-    { "mass-storage controler",            NULL,              mass_subclass, },
+    { "mass-storage controller",            NULL,              mass_subclass, },
     /* 0x02 */
-    { "network controler",                 "network",          net_subclass, },
+    { "network controller",                 "network",          net_subclass, },
     /* 0x03 */
-    { "display controler",                 "display",        displ_subclass, },
+    { "display controller",                 "display",        displ_subclass, },
     /* 0x04 */
     { "multimedia device",                 NULL,             media_subclass, },
     /* 0x05 */ 
-    { "memory controler",                  "memory-controler", mem_subclass, },
+    { "memory controller",                  "memory-controller", mem_subclass, },
     /* 0x06 */
     { "PCI bridge",                        "pci",            bridg_subclass, },
     /* 0x07 */
@@ -1396,17 +1412,17 @@
     /* 0x0B */
     { "processor",                         NULL,               cpu_subclass, },
     /* 0x0C */
-    { "serial bus controler",              NULL,               ser_subclass, },
+    { "serial bus controller",              NULL,               ser_subclass, },
     /* 0x0D */
-    { "wireless controler",                NULL,               wrl_subclass, },
+    { "wireless controller",                NULL,               wrl_subclass, },
     /* 0x0E */
-    { "intelligent I/O controler",         NULL,               NULL,         },
+    { "intelligent I/O controller",         NULL,               NULL,         },
     /* 0x0F */
-    { "satellite communication controler", NULL,               sat_subclass, },
+    { "satellite communication controller", NULL,               sat_subclass, },
     /* 0x10 */
-    { "cryptographic controler",           NULL,             crypt_subclass, },
+    { "cryptographic controller",           NULL,             crypt_subclass, },
     /* 0x11 */
-    { "signal processing controler",       NULL,               spc_subclass, },
+    { "signal processing controller",       NULL,               spc_subclass, },
 };
 
 static int macio_config_cb (pci_device_t *device)
@@ -1418,7 +1434,7 @@
 }
 
 static const pci_dev_t misc_pci[] = {
-    /* Apple Mac-io controler */
+    /* Apple Mac-io controller */
     { 
         0x106B, 0x0022,
         "mac-io", "mac-io", "AAPL,Keylargo", "Keylargo",
@@ -1827,7 +1845,7 @@
             ret = (pci_u_t *)newb;
 #if 0
             printf("Config addr: 0x%0x data: 0x%0x base: 0x%0x\n",
-                   newb->cfg_addr, newb->cfg_data, newb->base);
+                   newb->cfg_addr, newb->cfg_data, newb->cfg_base);
             printf("newb: %p hb: %p b: %p next: %p\n", newb,
                    host->bridge, bridge, host->bridge->next);
 #endif
@@ -1881,11 +1899,9 @@
                                    rev, ccode, min_grant, max_latency);
     }
  configure_device:
-#if 0
     printf("Config addr: 0x%0x data: 0x%0x base: 0x%0x\n",
-           bridge->cfg_addr, bridge->cfg_data, bridge->base);
+	   bridge->cfg_addr, bridge->cfg_data, bridge->cfg_base);
     printf("ops: %p uni-ops: %p\n", bridge->ops, &uninorth_pci_ops);
-#endif
     io_base = &bridge->io_cur;
     mem_base = &bridge->mem_cur;
     omask = 0x00000000;
@@ -1987,20 +2003,24 @@
     int ret;
 
     fake_host = NULL;
+    fake_bridge = NULL;
     ret = -1;
     switch (arch) {
     case ARCH_PREP:
         dev = pci_find_device(0x06, 0x00, 0xFF, checkv, checkp);
-        if (dev == NULL)
-            return -1;
+        if (dev == NULL) {
+            goto done;
+	}
         fake_host = pci_add_host(hostp, dev,
                                  (0x06 << 24) | (0x00 << 16) | (0xFF << 8));
-        if (fake_host == NULL)
-            return -1;
+        if (fake_host == NULL) {
+            goto done;
+	}
         fake_host->dev.common.type = PCI_FAKE_HOST;
         dev = &PREP_fake_bridge;
-        if (dev == NULL)
-            goto free_fake_host;
+        if (dev == NULL) {
+            goto done;
+	}
         fake_bridge = pci_add_bridge(fake_host, 0, 11, dev,
                                      (0x06 << 24) | (0x00 << 16) | (0xFF << 8),
                                      cfg_base, cfg_len,
@@ -2011,8 +2031,9 @@
                                      rbase, rlen,
                                      0,
                                      &PREP_pci_ops);
-        if (fake_bridge == NULL)
-            goto free_fake_host;
+        if (fake_bridge == NULL) {
+            goto done;
+	}
         fake_bridge->dev.common.type = PCI_FAKE_BRIDGE;
         break;
     case ARCH_CHRP:
@@ -2021,15 +2042,15 @@
     case ARCH_MAC99:
         dev = pci_find_device(0x06, 0x00, 0xFF, checkv, checkp);
         if (dev == NULL)
-            return -1;
+            goto done;
         fake_host = pci_add_host(hostp, dev,
                                  (0x06 << 24) | (0x00 << 16) | (0xFF << 8));
         if (fake_host == NULL)
-            return -1;
+            goto done;
         fake_host->dev.common.type = PCI_FAKE_HOST;
         dev = &uninorth_fake_bridge;
         if (dev == NULL)
-            goto free_fake_host;
+            goto done;
         fake_bridge = pci_add_bridge(fake_host, 0, 11, dev,
                                      (0x06 << 24) | (0x00 << 16) | (0xFF << 8),
                                      cfg_base, cfg_len,
@@ -2041,7 +2062,7 @@
                                      BRIDGE_TYPE_UNINORTH,
                                      &uninorth_pci_ops);
         if (fake_bridge == NULL)
-            goto free_fake_host;
+            goto done;
         fake_bridge->dev.common.type = PCI_FAKE_BRIDGE;
         fake_bridge->flags |= BRIDGE_TYPE_UNINORTH;
         break;
@@ -2065,10 +2086,11 @@
         }
     }
  done:
-    free(fake_host->bridge);
- free_fake_host:
-    free(fake_host);
-    return -1;
+    if (fake_bridge)
+	free(fake_bridge);
+    if (fake_host)
+	free(fake_host);
+    return ret;
 }
 
 static int pci_check_devices (pci_host_t *host)
@@ -2084,7 +2106,7 @@
         }
     }
     /* Now, find all other devices */
-    /* XXX: should recurs thru all host and bridges ! */
+    /* XXX: should recurse thru all host and bridges ! */
     printf("Check PCI devices\n");
     for (bus = 0; bus < 256; bus++) {
         for (devfn = 0; devfn < 256; devfn++) {
@@ -2107,6 +2129,9 @@
     /* We need to discover PCI bridges and devices */
     switch (arch) {
     case ARCH_PREP:
+	/* supposed to have 1 host bridge:
+	 * - the Motorola Raven PCI bridge
+	 */
         cfg_base = 0x80000000;
         cfg_len  = 0x00100000;
         mem_base = 0xF0000000;
@@ -2121,7 +2146,7 @@
         rlen     = 0x00400000; /* ? */
         if (pci_check_host(&pci_main, cfg_base, cfg_len,
                            mem_base, mem_len, io_base, io_len, rbase, rlen,
-                           0x1011, 0x0026) == 0) {
+                           0x1057, 0x4801) == 0) {
             isa_io_base = io_base;
             busnum++;
         }
Index: OpenHackWare/src/vga.c
===================================================================
--- OpenHackWare/src/vga.c	(.../OpenHackWare)	(revision 10)
+++ OpenHackWare/src/vga.c	(.../external/OpenHackWare)	(working copy)
@@ -1,5 +1,6 @@
 /*
  *  Copyright (c) 2004 Fabrice Bellard
+ *  Keyboard code copyright (c) 2005 Matthew Wood [mwood@realmsys.com]
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -46,6 +47,51 @@
   
 #define VBE_DISPI_LFB_PHYSICAL_ADDRESS  0xE0000000
 
+#define PCKBD_IO_BASE                   0x60
+#define PCKBD_COMMAND_OFFSET            0x4
+#define PCKBD_STATUS_OFFSET             0x4
+
+#ifdef BROKEN_ADB
+/* The base of the ADB memory-mapped region */
+//#define ADB_VIA_BASE                    0x50f00000
+#define ADB_VIA_BASE                    0x80416000
+
+/* ADB register offsets, taken from Linux */
+#define RS		0x200		/* skip between registers */
+#define B		0		/* B-side data */
+#define A		RS		/* A-side data */
+#define DIRB		(2*RS)		/* B-side direction (1=output) */
+#define DIRA		(3*RS)		/* A-side direction (1=output) */
+#define T1CL		(4*RS)		/* Timer 1 ctr/latch (low 8 bits) */
+#define T1CH		(5*RS)		/* Timer 1 counter (high 8 bits) */
+#define T1LL		(6*RS)		/* Timer 1 latch (low 8 bits) */
+#define T1LH		(7*RS)		/* Timer 1 latch (high 8 bits) */
+#define T2CL		(8*RS)		/* Timer 2 ctr/latch (low 8 bits) */
+#define T2CH		(9*RS)		/* Timer 2 counter (high 8 bits) */
+#define SR		(10*RS)		/* Shift register */
+#define ACR		(11*RS)		/* Auxiliary control register */
+#define PCR		(12*RS)		/* Peripheral control register */
+#define IFR		(13*RS)		/* Interrupt flag register */
+#define IER		(14*RS)		/* Interrupt enable register */
+#define ANH		(15*RS)		/* A-side data, no handshake */
+
+/* Bits in B data register: all active low */
+#define TREQ		0x08		/* Transfer request (input) */
+#define TACK		0x10		/* Transfer acknowledge (output) */
+#define TIP		0x20		/* Transfer in progress (output) */
+
+/* Bits in ACR */
+#define SR_CTRL		0x1c		/* Shift register control bits */
+#define SR_EXT		0x0c		/* Shift on external clock */
+#define SR_OUT		0x10		/* Shift out if 1 */
+
+/* Bits in IFR and IER */
+#define IER_SET		0x80		/* set bits in IER */
+#define IER_CLR		0		/* clear bits in IER */
+#define SR_INT		0x04		/* Shift register full/empty */
+#endif /* BROKEN_ADB */
+
+
 static void vga_text_init(void);
 
 unsigned long vga_fb_phys_addr;
@@ -56,6 +102,9 @@
 int vga_fb_depth;
 uint8_t rgb_to_index[256];
 
+static int (*getter)(void) = NULL;
+
+
 static void vbe_outw(int index, int val)
 {
     outw(0x1ce, index);
@@ -401,6 +450,9 @@
 
 void vga_putchar(int ch)
 {
+    if (ch == '\r')
+	return;
+
     if (ch == '\n') {
         vga_put_lf();
     } else {
@@ -418,3 +470,291 @@
         s++;
     }
 }
+
+
+/* Indexes for keyboard state */
+#define SHIFT 0x1
+#define ALT   0x2
+#define CTRL  0x4
+
+/* Scan codes */
+#define L_SHIFT  0x2a
+#define R_SHIFT  0x36
+#define L_CTRL   0x1d
+#define L_ALT    0x38
+
+struct keyboard_map 
+{
+    char scan_code;
+    char base;
+    char shift;
+    char ctrl;
+    char ctrl_shift;
+    char alt;
+    char alt_shift;
+    char alt_ctrl;
+    char alt_ctrl_shift;
+};
+
+
+static struct keyboard_map pc_map[] = {
+    { 0, 0, 0, 0, 0, 0, 0, 0, 0 },
+    { 1, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b, 0x1b },
+    { 2, '1', '!', 0, 0, '1', '!', 0, 0, },
+    { 3, '2', '\'', '\'', 0, 0, '2', '\'', '\'', },
+    { 4, '3', '#', 0, 0, '3', '#', 0, 0, },
+    { 5, '4', '$', 0, 0, '4', '$', 0, 0, },
+    { 6, '5', '%', 0, 0, '5', '%', 0, 0, },
+    { 7, '6', '^', 0, 0, '6', '^', 0, 0, },
+    { 8, '7', '&', 0, 0, '7', '&', 0, 0, },
+    { 9, '8', '*', 0, 0, '8', '*', 0, 0, },
+    { 10, '9', '(', 0, 0, '9', '(', 0, 0, },
+    { 11, '0', ')', 0, 0, '0', ')', 0, 0, },
+    { 12, '-', '_', 0, 0, '-', '_', 0, 0, },
+    { 13, '=', '+', 0, 0, '=', '+', 0, 0, },
+    { 14, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, 0x08, },
+    { 15, 0x2a, 0, 0, 0, 0x2a, 0, 0, 0, },
+    { 16, 'q', 'Q', 0, 0, 'q', 'Q', 0, 0, },
+    { 17, 'w', 'W', 0, 0, 'w', 'W', 0, 0, },
+    { 18, 'e', 'E', 0, 0, 'e', 'E', 0, 0, },
+    { 19, 'r', 'R', 0, 0, 'r', 'R', 0, 0, },
+    { 20, 't', 'T', 0, 0, 't', 'T', 0, 0, },
+    { 21, 'y', 'Y', 0, 0, 'y', 'Y', 0, 0, },
+    { 22, 'u', 'U', 0, 0, 'u', 'U', 0, 0, },
+    { 23, 'i', 'I', 0, 0, 'i', 'I', 0, 0, },
+    { 24, 'o', 'O', 0, 0, 'o', 'O', 0, 0, },
+    { 25, 'p', 'P', 0, 0, 'p', 'P', 0, 0, },
+    { 26, '[', '{', 0x1b, 0x1b, '[', '{', 0x1b, 0x1b, },
+    { 27, ']', '}', 0, 0, ']', '}', 0, 0, },
+    { 28, 0x0d, 0x0d, '\r', '\r', 0x0d, 0x0d, '\r', '\r', },
+    { 29, 0, 0, 0, 0, 0, 0, 0, 0, },
+    { 30, 'a', 'A', 0, 0, 'a', 'A', 0, 0, },
+    { 31, 's', 'S', 0, 0, 's', 'S', 0, 0, },
+    { 32, 'd', 'D', 0, 0, 'd', 'D', 0, 0, },
+    { 33, 'f', 'F', 0, 0, 'f', 'F', 0, 0, },
+    { 34, 'g', 'G', 0x07, 0x07, 'g', 'G', 0x07, 0x07, },
+    { 35, 'h', 'H', 0x08, 0x08, 'h', 'H', 0x08, 0x08, },
+    { 36, 'j', 'J', '\r', '\r', 'j', 'J', '\r', '\r', },
+    { 37, 'k', 'K', 0, 0, 'k', 'K', 0, 0 , },
+    { 38, 'l', 'L', 0, 0, 'l', 'L', 0, 0, },
+    { 39, ';', ':', 0, 0, ';', ':', 0, 0, },
+    { 40, '\'', '"', 0, 0, '\'', '"', 0, 0, },
+    { 41, '`', '~', 0, 0, '`', '~', 0, 0, },
+    { 42, 0x2, 0, 0, 0, 0, 0, 0, 0, },
+    { 43, '\\', '|', 0, 0, '\\', '|', 0, 0, },
+    { 44, 'z', 'Z', 0, 0, 'z', 'Z', 0, 0, },
+    { 45, 'x', 'X', 0, 0, 'x', 'X', 0, 0, },
+    { 46, 'c', 'C', 0, 0, 'c', 'C', 0, 0, },
+    { 47, 'v', 'V', 0x16, 0x16, 'v', 'V', 0, 0, },
+    { 48, 'b', 'B', 0, 0, 'b', 'B', 0, 0, },
+    { 49, 'n', 'N', 0, 0, 'n', 'N', 0, 0, },
+    { 50, 'm', 'M', 0x0d, 0x0d, 'm', 'M', 0x0d, 0x0d, },
+    { 51, ',', '<', 0, 0, ',', '<', 0, 0, },
+    { 52, '.', '>', 0, 0, '.', '>', 0, 0, },
+    { 53, '/', '?', 0, 0, '/', '?', 0, 0, },
+    { 54, 0, 0, 0, 0, 0, 0, 0, 0, },
+    { 55, '*', '*', 0, 0, '*', '*', 0, 0, },
+    { 56, 0, 0, 0, 0, 0, 0, 0, 0, },
+    { 57, ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', },
+};
+
+
+static int vga_getchar_pckbd(void)
+{
+    static int shift_pressed = 0;
+    static int ctrl_pressed = 0;
+    static int alt_pressed = 0;
+    int ret = 0;
+    char status = inb(PCKBD_IO_BASE + PCKBD_STATUS_OFFSET);
+
+    /* See if there is data available. */
+    if (status & 0x1) {
+	int index = 0, key;
+
+
+	key = inb(PCKBD_IO_BASE);
+	switch (key) {
+	case 0:
+	    break;
+	case L_ALT:
+	    alt_pressed = 1;
+	    break;
+
+	case (L_ALT | 0x80):
+	    alt_pressed = 0;
+	    break;
+
+	case R_SHIFT:
+	    shift_pressed |= 2;
+	    break;
+
+	case L_SHIFT:
+	    shift_pressed |= 1;
+	    break;
+
+	case (L_SHIFT | 0x80):
+	    shift_pressed &= ~1;
+	    break;
+
+	case (R_SHIFT | 0x80):
+	    shift_pressed &= ~2;
+	    break;
+
+	case L_CTRL:
+	    ctrl_pressed = 1;
+	    break;
+
+	case (L_CTRL | 0x80):
+	    ctrl_pressed = 0;
+	    break;
+
+	default:
+	    if (key & 0x80)
+		/* We don't care about key up events */
+		break;
+
+	    if ((key & 0x7f) > 57)
+		/* We don't understand these keys */
+		break;
+
+	    if (shift_pressed)
+		index += SHIFT;
+	    if (alt_pressed)
+		index += ALT;
+	    if (ctrl_pressed)
+		index += CTRL;
+
+	    /* Figure out which value to return */
+	    switch (index) {
+	    case 0:
+		/* No modifier keys pressed */
+		ret = pc_map[key].base;
+		break;
+
+	    case 1:
+		/* Only shift pressed */
+		ret = pc_map[key].shift;
+		break;
+
+	    case 2:
+		/* Only alt pressed */
+		ret = pc_map[key].alt;
+		break;
+
+	    case 3:
+		/* Shift + alt */
+		ret = pc_map[key].alt_shift;
+		break;
+
+	    case 4:
+		/* Only ctrl pressed */
+		ret = pc_map[key].ctrl;
+		break;
+
+	    case 5:
+		/* Shift + ctrl */
+		ret = pc_map[key].ctrl_shift;
+		break;
+
+	    case 6:
+		/* Alt + ctrl */
+		ret = pc_map[key].alt_ctrl;
+		break;
+
+	    case 7:
+		/* Alt + ctrl + shift */
+		ret = pc_map[key].alt_ctrl_shift;
+		break;
+
+	    default:
+		printf("Keyboard driver bug!\n");
+		bug();
+		break;
+	    }
+	    break;
+	}
+    }
+
+    return ret;
+}
+
+static int vga_getchar_adb(void)
+{
+#if 0
+    volatile unsigned char *via = (void *) ADB_VIA_BASE;
+    int status;
+
+    status = (via[B] & (TIP|TREQ)) | (via[ACR] & SR_OUT);
+    //    DPRINTF("cuda_interrupt: status=0%x\n", status);
+
+#endif
+    return 0;
+}
+
+int vga_getchar(void)
+{
+    return getter();
+}
+
+static void init_pckbd(void)
+{
+}
+
+/* Initialization code based on NetBSD CUDA-VIA code */
+static void init_adb(void)
+{
+#ifdef BROKEN_ADB
+    volatile unsigned char *via = (void *) ADB_VIA_BASE;
+
+    /* register B bits 4 and 5; outputs */
+    via[DIRB] = via[DIRB] | 0x30;
+    via[DIRB] = via[DIRB] & 0xf7; /* register B bit 3: input */
+    via[ACR]  = via[ACR]  & ~SR_OUT; /* make sure SR is set to IN */
+    via[ACR]  = (via[ACR] | 0x0c) & ~0x10;
+    via[IER]  = 0x84; /* Enable interrupts */
+    via[B]    = via[B] | 0x10 | 0x20; /* Make bus idle */
+
+    /* sort of a device reset */
+    (void) via[SR]; /* Clear interrupts */
+    via[IER] = 0x04; /* Disable interrupts */
+    via[B]   = via[B] | 0x10 | 0x20; /* Make bus idle */
+    usleep(150);
+
+    /* Set state as TIP (transfer in progress) */
+    via[B]   = via[B] & (~0x20);
+    usleep(150);
+
+    via[B] = via[B] ^ 0x10;
+    usleep(150);
+
+    /* Clear state TIP */
+    via[B] = via[B] | 0x20;
+    usleep(150);
+
+    via[B]   = via[B] | 0x10 | 0x20; /* Make bus idle */
+    (void) via[SR]; /* Clear interrupt */
+    via[IER] = 0x84; /* Enable interrupts */
+
+    usleep(1000);
+
+    /* Reset ADB bus */
+    //adb_op_sync
+    usleep(200000);
+
+
+    DPRINTF("ADB initialization complete.\n");
+#endif /* BROKEN_ADB */
+}
+
+void vga_keyboard_init(void)
+{
+    if (arch == ARCH_CHRP || arch == ARCH_MAC99) {
+	DPRINTF("init_adb()\n");
+	init_adb();
+	getter = vga_getchar_adb;
+    } else {
+	DPRINTF("init_pckbd()\n");
+	init_pckbd();
+	getter = vga_getchar_pckbd;
+    }
+}
Index: OpenHackWare/src/file.c
===================================================================
--- OpenHackWare/src/file.c	(.../OpenHackWare)	(revision 10)
+++ OpenHackWare/src/file.c	(.../external/OpenHackWare)	(working copy)
@@ -748,13 +748,19 @@
     }
     mhdr = (void *)buffer;
     MACH_O_MAGIC
+#else
+    /* FIXME - quiet gcc about unused variables */
+    (void)file;
+    (void)dest;
+    (void)entry;
+    (void)end;
 #endif
 
     return -2;
 }
 
 /* PREP boot loader */
-static int file_load_prep (file_t *file, void **dest, void **entry, void **end)
+static int file_load_prep (file_t *file, unused void **dest, unused void **entry, unused void **end)
 {
     unsigned char buffer[512];
 
Index: OpenHackWare/src/bloc.c
===================================================================
--- OpenHackWare/src/bloc.c	(.../OpenHackWare)	(revision 10)
+++ OpenHackWare/src/bloc.c	(.../external/OpenHackWare)	(working copy)
@@ -631,8 +631,6 @@
 }
 
 /* IDE disk driver */
-static uint32_t ide_base[2] = { 0x1F0, 0x170, };
-static uint32_t ide_base2[2] = { 0x3F6, 0x376, };
 
 typedef struct ide_ops_t {
     uint8_t (*port_read)(bloc_device_t *bd, int port);
@@ -640,13 +638,16 @@
     uint32_t (*data_readl)(bloc_device_t *bd);
     void (*data_writel)(bloc_device_t *bd, uint32_t val);
     void (*control_write)(bloc_device_t *bd, uint32_t val);
-    uint32_t base[4];
+    uint32_t base[4]; /* cmd0, cmd1, ctrl0, ctrl1 */
 #ifdef USE_OPENFIRMWARE
     void *OF_private[2];
 #endif
 } ide_ops_t;
 
-/* IDE ISA access */
+
+/* IDE ISA access for pc */
+static ide_ops_t *ide_isa_ops;
+
 static uint8_t ide_isa_port_read (bloc_device_t *bd, int port)
 {
     return inb(bd->io_base + port);
@@ -672,50 +673,65 @@
     outb(bd->tmp, val);
 }
 
-static ide_ops_t ide_isa_ops = {
+static ide_ops_t ide_isa_pc_ops = {
     &ide_isa_port_read,
     &ide_isa_port_write,
     &ide_isa_data_readl,
     &ide_isa_data_writel,
     &ide_isa_control_write,
-    { 0, },
+    { 0x1F0, 0x3f6, 0x170, 0x376 },
 #ifdef USE_OPENFIRMWARE
     { NULL, },
 #endif
 };
 
+void ide_isa_pc_register (int intf,
+			  uint32_t io_cmd, uint32_t io_ctrl,
+			  unused void *OF_private)
+{
+    if (ide_isa_ops == NULL) {
+        ide_isa_ops = malloc(sizeof(ide_ops_t));
+        if (ide_isa_ops == NULL)
+            return;
+        memcpy(ide_isa_ops, &ide_isa_pc_ops, sizeof(ide_ops_t));
+    }
+    ide_isa_ops->base[intf] = io_cmd;
+    ide_isa_ops->base[2 + intf] = io_ctrl;
+#ifdef USE_OPENFIRMWARE
+    ide_isa_ops->OF_private[intf] = OF_private;
+#endif
+}
+
+/* IDE PCI access for pc */
 static ide_ops_t *ide_pci_ops;
 
-/* IDE PCI access for pc */
 static uint8_t ide_pci_port_read (bloc_device_t *bd, int port)
 {
     eieio();
-
-    return *(uint8_t *)(bd->io_base + port);
+    return inb(bd->io_base + port);
 }
 
 static void ide_pci_port_write (bloc_device_t *bd, int port, uint8_t value)
 {
-    *(uint8_t *)(bd->io_base + port) = value;
+    outb(bd->io_base + port, value);
     eieio();
 }
 
 static uint32_t ide_pci_data_readl (bloc_device_t *bd)
 {
     eieio();
-
-    return *((uint32_t *)bd->io_base);
+    return inl(bd->io_base);
 }
 
 static void ide_pci_data_writel (bloc_device_t *bd, uint32_t val)
 {
-    *(uint32_t *)(bd->io_base) = val;
+    outl(bd->io_base, val);
     eieio();
 }
 
 static void ide_pci_control_write (bloc_device_t *bd, uint32_t val)
 {
-    *((uint8_t *)bd->tmp) = val;
+    outb(bd->tmp + 2, val);
     eieio();
 }
 
@@ -731,8 +747,8 @@
 #endif
 };
 
-void ide_pci_pc_register (uint32_t io_base0, uint32_t io_base1,
-                          uint32_t io_base2, uint32_t io_base3,
+void ide_pci_pc_register (uint32_t io_cmd0, uint32_t io_cmd1,
+                          uint32_t io_ctrl0, uint32_t io_ctrl1,
                           unused void *OF_private)
 {
     if (ide_pci_ops == NULL) {
@@ -741,18 +757,18 @@
             return;
         memcpy(ide_pci_ops, &ide_pci_pc_ops, sizeof(ide_ops_t));
     }
-    if ((io_base0 != 0 || io_base1 != 0) &&
-        ide_pci_ops->base[0] == 0 && ide_pci_ops->base[1] == 0) {
-        ide_pci_ops->base[0] = io_base0;
-        ide_pci_ops->base[1] = io_base1;
+    if ((io_cmd0 != 0 && io_ctrl0 != 0) &&
+        (ide_pci_ops->base[0] == 0 || ide_pci_ops->base[2] == 0)) {
+        ide_pci_ops->base[0] = io_cmd0;
+        ide_pci_ops->base[2] = io_ctrl0;
 #ifdef USE_OPENFIRMWARE
         ide_pci_ops->OF_private[0] = OF_private;
 #endif
     }
-    if ((io_base2 != 0 || io_base3 != 0) &&
-        ide_pci_ops->base[2] == 0 && ide_pci_ops->base[3] == 0) {
-        ide_pci_ops->base[2] = io_base2;
-        ide_pci_ops->base[3] = io_base3;
+    if ((io_cmd1 != 0 && io_ctrl1 != 0) &&
+        (ide_pci_ops->base[1] == 0 || ide_pci_ops->base[3] == 0)) {
+        ide_pci_ops->base[1] = io_cmd1;
+        ide_pci_ops->base[3] = io_ctrl1;
 #ifdef USE_OPENFIRMWARE
         ide_pci_ops->OF_private[1] = OF_private;
 #endif
@@ -919,22 +935,32 @@
     uint32_t size;
     int status, base, is_cdrom, len, i;
 
-    if (device > 1)
-        base = 1;
-    else
-        base = 0;
+    base = device >> 1;
     if (ide_pci_ops != NULL) {
         bd->private = ide_pci_ops;
         bd->io_base = ide_pci_ops->base[base];
-        bd->tmp = ide_pci_ops->base[2 + base];
+        bd->tmp = ide_pci_ops->base[base + 2];
         if (bd->io_base == 0x00000000 || bd->io_base == 0xFFFFFFFF) {
             ERROR("No IDE drive %c\n", device);
             return -1;
         }
+#ifdef USE_OPENFIRMWARE
+	OF_parent = ide_pci_ops->OF_private[base];
+#endif
+    } else if (ide_isa_ops != NULL) {
+        bd->private = ide_isa_ops;
+        bd->io_base = ide_isa_ops->base[base];
+        bd->tmp = ide_isa_ops->base[base + 2];
+        if (bd->io_base == 0x00000000 || bd->io_base == 0xFFFFFFFF) {
+            ERROR("No IDE drive %c\n", device);
+            return -1;
+        }
+#ifdef USE_OPENFIRMWARE
+	OF_parent = ide_isa_ops->OF_private[base];
+#endif
     } else {
-        bd->private = &ide_isa_ops;
-        bd->io_base = ide_base[base];
-        bd->tmp = ide_base2[base];
+	ERROR("No IDE controllers available\n");
+	return -1;
     }
     bd->drv = device & 1;
     DPRINTF("Init IDE drive %d-%d (%d)\n", base, bd->drv, device);
@@ -965,7 +991,6 @@
         return -1;
 #ifdef USE_OPENFIRMWARE
     /* Register disk into OF tree */
-    OF_parent = ide_pci_ops->OF_private[base];
     if (OF_parent != NULL) {
         bd->OF_private = OF_blockdev_register(OF_parent, bd, devtype,
                                               devname, bd->drv, alias);
Index: OpenHackWare/src/main.c
===================================================================
--- OpenHackWare/src/main.c	(.../OpenHackWare)	(revision 10)
+++ OpenHackWare/src/main.c	(.../external/OpenHackWare)	(working copy)
@@ -2,6 +2,7 @@
  * Open Hack'Ware BIOS main.
  * 
  * Copyright (c) 2004 Jocelyn Mayer
+ * Console enhancements Copyright (c) 2005 Matthew S. Wood [mwood@realmsys.com]
  * 
  * Permission is hereby granted, free of charge, to any person obtaining a copy
  * of this software and associated documentation files (the "Software"), to deal
@@ -253,13 +254,11 @@
     }
     if (console == NULL) {
         console = cs;
+	cs->next = NULL;
     } else {
-        console_t *cur;
-        for (cur = console; cur->next != NULL; cur = cur->next)
-            continue;
-        cur->next = cs;
+	cs->next = console;
+	console = cs;
     }
-    cs->next = NULL;
     DPRINTF("Console: %p cs %p next %p writeb %p\n", console, cs,
             cs->next, cs->writeb);
 
@@ -292,33 +291,71 @@
     return len;
 }
 
-/* Not implemented yet */
-int cs_poll (void)
+int cs_readb (void)
 {
-    return -1;
+    console_t *cur;
+    int ret = 0;
+
+    if (console == NULL)
+        return ret;
+
+    for (cur = console; cur != NULL; cur = cur->next) {
+	/* Find the first console with input. */
+        if (cur->readb != NULL) {
+            ret = (*cur->readb)(cur);
+	    if (ret == 0)
+		continue;
+	    break;
+        }
+    }
+
+    return ret;
 }
 
+int cs_read (unsigned char *buf, int len)
+{
+    int i;
+
+    for (i = 0; i < len; i++)
+        buf[i] = cs_readb();
+
+    return len;
+}
+
 /* Not implemented yet */
-int cs_read (void)
+int cs_poll (void)
 {
     return -1;
 }
 
 /* Bloc devices interface */
 /* Qemu serial port "driver" */
-#define SERIAL_OUT_PORT (0x03F8)
+#define SERIAL_OUT_PORT    (0x03F8)
+#define SERIAL_LSR_OFFSET  (5)
 
 /*
  * Note: the wait is called only not to loose data on the serial port.
  */
 static int serial_writeb (console_t *cs, uint8_t data)
 {
+    char status = inb(cs->io_base + SERIAL_LSR_OFFSET);
+    while (!(status & 0x20))
+	usleep(100);
     outb(cs->io_base, data);
-    usleep(1000);
 
     return 0;
 }
 
+static int serial_readb (console_t *cs)
+{
+    char status = inb(cs->io_base + SERIAL_LSR_OFFSET);
+    int ret = 0;
+    if (status & 1) 
+	ret = inb(cs->io_base);
+
+    return ret;
+}
+
 static int serial_open (console_t *cs, int device)
 {
     if (device != 0)
@@ -326,7 +363,7 @@
     cs->io_base = SERIAL_OUT_PORT;
     cs->writeb = &serial_writeb;
     cs->poll = NULL;
-    cs->readb = NULL;
+    cs->readb = &serial_readb;
 
     return 0;
 }
@@ -338,6 +375,11 @@
     return 0;
 }
 
+static int vga_readb(unused console_t *cs)
+{
+    return vga_getchar();
+}
+
 static int vga_open (console_t *cs, int device)
 {
     if (device != 0)
@@ -345,7 +387,7 @@
     cs->io_base = 0x0000; /* Don't care */
     cs->writeb = &vga_writeb;
     cs->poll = NULL;
-    cs->readb = NULL;
+    cs->readb = &vga_readb;
 
     return 0;
 }
@@ -490,8 +532,10 @@
     return ret;
 }
 
-int strncmp (const char *str0, const char *str1, int maxlen)
+static int strncmp_int (const char *str0, const char *str1, int maxlen,
+			int case_sensitive)
 {
+
     const unsigned char *_buf0 = str0;
     const unsigned char *_buf1 = str1;
     int ret, pos;
@@ -502,9 +546,15 @@
     for (ret = 0;; _buf0++, _buf1++, pos++) {
         if (pos >= maxlen)
             goto out;
-        if (*_buf0 != *_buf1)
-            break;
-        if (*_buf0 == '\0')
+	
+	if (*_buf0 != *_buf1) {
+	    if (case_sensitive)
+		break;
+	    if (tolower(*_buf0) != tolower(*_buf1))
+		break;
+	}
+
+	if (*_buf0 == '\0')
             goto out;
     }
     if (*_buf0 < *_buf1)
@@ -516,6 +566,24 @@
     return ret;
 }
 
+int strncmp (const char *str0, const char *str1, int maxlen)
+{
+    return strncmp_int(str0, str1, maxlen, 1);
+}
+
+int strncasecmp (const char *str0, const char *str1, int maxlen)
+{
+    return strncmp_int(str0, str1, maxlen, 0);
+}
+
+int tolower (int c)
+{
+    if (c > 64 && c < 92)
+	return (c | 32);
+    else
+	return c;
+}
+
 char *strcpy (char *dst, const char *src)
 {
     const unsigned char *_src = src;
@@ -953,14 +1021,36 @@
     OF_init();
 #endif
     pci_main = pci_init();
-#if !defined(DEBUG_BIOS)
     cs_open('v'); 
-#endif
     vga_puts(BIOS_str);
     vga_puts("Build " stringify(BUILD_DATE) " " stringify(BUILD_TIME) "\n");
     vga_puts(copyright);
     vga_puts("\n");
 
+#ifdef USE_OPENFIRMWARE
+    {
+        const unsigned char *cpu_name;
+        uint32_t pvr = mfpvr();
+
+        cpu_name = CPU_get_name(pvr);
+        OF_register_cpu(cpu_name, 0, pvr,
+                        200 * 1000 * 1000, 200 * 1000 * 1000,
+                        100 * 1000 * 1000, 10 * 1000 * 1000,
+                        0x0092);
+    }
+    OF_register_memory(memsize, 512 * 1024 /* TOFIX */);
+    OF_register_bootargs(cmdline);
+    /* Claim memory used by the BIOS */
+    OF_claim_virt(0x05800000, 0x00080000, NULL);
+    OF_register_bus("isa", isa_io_base, "ISA");
+    OF_register_serial("isa", "com1", 0x3F8, 4);
+    if (arch == ARCH_PREP) {
+	OF_register_isa_ide("isa", 0, 0x1f0, 0x3f6, 13);
+	OF_register_isa_ide("isa", 1, 0x170, 0x376, 13);
+    }
+    RTAS_init();
+#endif
+
     /* QEMU is quite incoherent: d is cdrom, not second drive */
     if (boot_device == 'd')
         boot_device = 'e';
@@ -987,24 +1077,8 @@
         return -1;
     }
 #ifdef USE_OPENFIRMWARE
-    {
-        const unsigned char *cpu_name;
-        uint32_t pvr = mfpvr();
-
-        cpu_name = CPU_get_name(pvr);
-        OF_register_cpu(cpu_name, 0, pvr,
-                        200 * 1000 * 1000, 200 * 1000 * 1000,
-                        100 * 1000 * 1000, 10 * 1000 * 1000,
-                        0x0092);
-    }
-    OF_register_memory(memsize, 512 * 1024 /* TOFIX */);
-    /* Claim memory used by the BIOS */
-    OF_claim_virt(0x05800000, 0x00080000, NULL);
-    OF_register_bootargs(cmdline);
-    OF_register_bus("isa", isa_io_base, "ISA");
-    OF_register_serial("isa", "com1", 0x3F8, 4);
+    /* why can't OF_register_stdio() be move up next to OF_register_serial? */
     OF_register_stdio("com1", "com1");
-    RTAS_init();
 #endif
     DPRINTF("Load base: %p - residual data: %p %p\n",
             load_base, res, last_alloc);
@@ -1039,6 +1113,7 @@
     set_check(0);
     prepare_bootinfos(bootinfos, memsize, cmdline, ramdisk, ramdisk_size);
     set_check(1);
+    vga_keyboard_init();
     if (part_flags(boot_part) & PART_PREP) {
         vga_prep_init();
     }
Index: OpenHackWare/Makefile
===================================================================
--- OpenHackWare/Makefile	(.../OpenHackWare)	(revision 10)
+++ OpenHackWare/Makefile	(.../external/OpenHackWare)	(working copy)
@@ -13,9 +13,9 @@
 
 #DEBUG=1
 
-CC:= powerpc-linux-gcc
-LD:= powerpc-linux-ld
-OBJCOPY:= powerpc-linux-objcopy
+CC:= $(CROSS_COMPILE)gcc
+LD:= $(CROSS_COMPILE)ld
+OBJCOPY:= $(CROSS_COMPILE)objcopy
 MKDIR:= mkdir
 CAT:= cat
 TAR:= tar
@@ -34,9 +34,9 @@
 DISTDIR:= .
 SRCDIR:= src
 
-CFLAGS= -Wall -W -O2 -g -fno-builtin -fno-common -nostdinc
+CFLAGS= -Wall -Werror -Os -g -W -fno-builtin -fno-common -nostdinc
 CFLAGS+= -DBUILD_DATE=$(BUILD_DATE) -DBUILD_TIME=$(BUILD_TIME)
-LDFLAGS= -O2 -g -nostdlib
+LDFLAGS= -Os -nostdlib
 
 BIOS_IMAGE_BITS:= 19
 BIOS_IMAGE_SIZE:= $(shell echo $$(( 1 << $(BIOS_IMAGE_BITS) )) )

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2005-02-09 19:13 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-02-08 19:45 [Qemu-devel] PPC fixes for qemu/OpenHackWare Thayne Harbaugh
2005-02-08 20:46 ` Fabrice Bellard
2005-02-08 21:06   ` Thayne Harbaugh
2005-02-08 22:12     ` Hetz Ben Hamo
2005-02-08 22:11 ` [Qemu-devel] " J. Mayer
2005-02-08 22:25   ` Thayne Harbaugh
2005-02-08 23:32     ` J. Mayer
2005-02-09 18:50 ` [Qemu-devel] " Thayne Harbaugh

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).