[coreboot] r57 - in trunk/filo: . drivers fs i386 include include/grub main main/grub

svn at coreboot.org svn at coreboot.org
Mon Sep 1 16:49:07 CEST 2008


Author: stepan
Date: 2008-09-01 16:49:06 +0200 (Mon, 01 Sep 2008)
New Revision: 57

Added:
   trunk/filo/include/drivers.h
Modified:
   trunk/filo/Makefile
   trunk/filo/build.sh
   trunk/filo/drivers/ide.c
   trunk/filo/drivers/via-sound.c
   trunk/filo/fs/blockdev.c
   trunk/filo/fs/eltorito.c
   trunk/filo/i386/ldscript
   trunk/filo/i386/timer.c
   trunk/filo/include/grub/shared.h
   trunk/filo/include/lib.h
   trunk/filo/include/sound.h
   trunk/filo/main/elfload.c
   trunk/filo/main/filo.c
   trunk/filo/main/grub.c
   trunk/filo/main/grub/builtins.c
   trunk/filo/main/grub/char_io.c
   trunk/filo/main/grub/cmdline.c
   trunk/filo/main/grub/stage2.c
   trunk/filo/main/sound.c
Log:
FILO fixes
* fix mixup issues between grub_printf and printf
* try to unify driver interface
* drop a couple of duplicate endianess functions
* fix serial port init failure
* fix creation of device names from grub interface device names (somewhat)
* fix timer calculation and overflow issues
* Clean up Makefile and build.sh script


Modified: trunk/filo/Makefile
===================================================================
--- trunk/filo/Makefile	2008-08-29 13:43:47 UTC (rev 56)
+++ trunk/filo/Makefile	2008-09-01 14:49:06 UTC (rev 57)
@@ -117,11 +117,11 @@
 
 $(obj)/%.o: $(src)/%.c
 	$(Q)printf "  CC      $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(CC) -m32 $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
+	$(Q)$(CC) $(CFLAGS) $(CPPFLAGS) -c -o $@ $<
 
 $(obj)/%.S.o: $(src)/%.S
 	$(Q)printf "  AS      $(subst $(shell pwd)/,,$(@))\n"
-	$(Q)$(AS) --32 -o $@ $<
+	$(Q)$(AS) -o $@ $<
 
 endif
 

Modified: trunk/filo/build.sh
===================================================================
--- trunk/filo/build.sh	2008-08-29 13:43:47 UTC (rev 56)
+++ trunk/filo/build.sh	2008-09-01 14:49:06 UTC (rev 57)
@@ -12,22 +12,22 @@
 	STRIP=i386-elf-strip	\
 	NM=i386-elf-nm		\
 	HOSTCC=gcc		\
-	-j
+	-j			\
 	"
 fi
 if [ "$OS" == "Linux" ]; then
-MAKEFLAGS='CC="gcc -m32" LD="ld -b elf32-i386" HOSTCC="gcc"'
+MAKEFLAGS='CC="gcc -m32" LD="ld -b elf32-i386" HOSTCC="gcc" AS="as --32"'
 fi
 
 if [ "$ALLCLEAN" != "" -o ! -r libpayload/build/lib/libpayload.a ]; then
   cd libpayload
   make clean
-  make defconfig
-  make $MAKEFLAGS
+  make oldconfig
+  eval make $MAKEFLAGS
   cd ..
 fi
 
 make distclean
 make defconfig
-make $MAKEFLAGS
+eval make $MAKEFLAGS
 

Modified: trunk/filo/drivers/ide.c
===================================================================
--- trunk/filo/drivers/ide.c	2008-08-29 13:43:47 UTC (rev 56)
+++ trunk/filo/drivers/ide.c	2008-09-01 14:49:06 UTC (rev 57)
@@ -246,7 +246,7 @@
 static unsigned char ide_buffer[IDE_SECTOR_SIZE];
 
 static int await_ide(int (*done)(struct controller *ctrl), 
-	struct controller *ctrl, unsigned long timeout)
+	struct controller *ctrl, u64 timeout)
 {
 	int result;
 	for(;;) {
@@ -839,7 +839,7 @@
  * This is based on a paper on Phoenix website. --ts1 */
 static int ide_bus_floating(struct controller *ctrl)
 {
-	unsigned long timeout;
+	u64 timeout;
 	unsigned char status;
 
 	/* Test 1: if status reads 0xff, probably no device is present
@@ -1007,7 +1007,7 @@
 	uint8_t packet[12];
 	uint8_t buf[8];
 	uint32_t block_len, sectors;
-	unsigned long timeout;
+	u64 timeout;
 	uint8_t asc, ascq;
 	int in_progress;
 
@@ -1308,4 +1308,30 @@
 	return 0;
 }
 
+#if 0
+
+static char my_name="hd";
+static char ide_name(void);
+{
+	return my_name;
+}
+
+static const struct storage_ops ide_ops = {
+	.init = NULL,
+	.open = ide_probe,
+	.close = NULL,
+	.read_sector = NULL // FIXME
+	// This should probably contain drive, too: Should it?
+	// void (*read_sector)(u64 sector, const void *buf, int size);
+	.name = ide_name,
+};
+
+static const struct driver ide_driver __driver = {
+	.type=DRIVER_STORAGE,
+	{
+		.storage_ops=&ide_ops
+	}
+};
+#endif
+
 /* vim:set sts=8 sw=8: */

Modified: trunk/filo/drivers/via-sound.c
===================================================================
--- trunk/filo/drivers/via-sound.c	2008-08-29 13:43:47 UTC (rev 56)
+++ trunk/filo/drivers/via-sound.c	2008-09-01 14:49:06 UTC (rev 57)
@@ -17,6 +17,7 @@
 
 #include <libpayload.h>
 #include <config.h>
+#include <drivers.h>
 #include <sound.h>
 #define DEBUG_THIS CONFIG_DEBUG_VIA_SOUND
 #include <debug.h>
@@ -91,11 +92,17 @@
 	return 0;
 }
 
-static struct sound_ops viasnd_ops = {
+static const struct sound_ops viasnd_ops = {
 	.init = viasnd_init,
 	.stop = viasnd_stop,
 };
 
-const struct sound_driver viasnd_driver[] __sound_driver = {
-	{0x1106, 0x3058, &viasnd_ops},	/* VT82C686 AC97 Audio Controller */
+/* VT82C686 AC97 Audio Controller */
+static const struct driver viasnd_driver __driver = {
+	.type=DRIVER_SOUND,
+	.vendor=0x1106,
+	.device=0x3058,
+	{
+		.sound_ops=&viasnd_ops
+	}
 };

Modified: trunk/filo/fs/blockdev.c
===================================================================
--- trunk/filo/fs/blockdev.c	2008-08-29 13:43:47 UTC (rev 56)
+++ trunk/filo/fs/blockdev.c	2008-09-01 14:49:06 UTC (rev 57)
@@ -82,8 +82,8 @@
 	    printf("Partition %d does not exist\n", part+1);
 	    return 0;
 	}
-	*start_p = get_le32(p->start_sect);
-	*length_p = get_le32(p->nr_sects);
+	*start_p = cpu_to_le32(*(u32 *)(p->start_sect));
+	*length_p = cpu_to_le32(*(u32 *)(p->nr_sects));
 	return 1;
     } else {
 	/* Extended partition */
@@ -102,7 +102,7 @@
 	}
 	debug("Extended partition at %d\n", i+1);
 	/* Visit each logical partition labels */
-	ext_start = get_le32(p[i].start_sect);
+	ext_start = cpu_to_le32(*(u32*)(p[i].start_sect));
 	cur_table = ext_start;
 	cur_part = 4;
 	for (;;) {
@@ -121,8 +121,8 @@
 		    printf("Partition %d is empty\n", part+1);
 		    return 0;
 		}
-		*start_p = cur_table + get_le32(p->start_sect);
-		*length_p = get_le32(p->nr_sects);
+		*start_p = cur_table + cpu_to_le32(*(u32*)(p->start_sect));
+		*length_p = cpu_to_le32(*(u32*)(p->nr_sects));
 		return 1;
 	    }
 	    /* Second entry is link to next partition */
@@ -130,7 +130,7 @@
 		debug("no link\n");
 		break;
 	    }
-	    cur_table = ext_start + get_le32(p[1].start_sect);
+	    cur_table = ext_start + cpu_to_le32(*(u32*)(p[1].start_sect));
 
 	    cur_part++;
 	}
@@ -451,17 +451,3 @@
     return 1;
 }
 
-uint32_t get_le32(const unsigned char *p)
-{
-	return ((unsigned int) p[0] << 0)
-		| ((unsigned int) p[1] << 8)
-		| ((unsigned int) p[2] << 16)
-		| ((unsigned int) p[3] << 24);
-}
-
-uint16_t get_le16(const unsigned char *p)
-{
-	return ((unsigned int) p[0] << 0) 
-		| ((unsigned int) p[1] << 8);
-}
-

Modified: trunk/filo/fs/eltorito.c
===================================================================
--- trunk/filo/fs/eltorito.c	2008-08-29 13:43:47 UTC (rev 56)
+++ trunk/filo/fs/eltorito.c	2008-09-01 14:49:06 UTC (rev 57)
@@ -100,7 +100,7 @@
 	return 0;
     }
 
-    cat_offset = get_le32(boot_record.catalog_offset);
+    cat_offset = le32_to_cpu(*(u32*)boot_record.catalog_offset);
     debug("El-Torito boot catalog at sector %u\n", cat_offset);
     if (!devread(cat_offset<<2, 0, 2048, catalog))
 	return 0;
@@ -115,7 +115,7 @@
     /* All words must sum up to zero */
     sum = 0;
     for (i = 0; i < sizeof(*ve); i += 2)
-	sum += get_le16(&catalog[i]);
+	sum += le16_to_cpu(catalog[i]);
     sum &= 0xffff;
     if (sum != 0) {
 	printf("El Torito boot catalog verify failed\n");
@@ -153,7 +153,7 @@
 	printf("Disc uses hard disk emulation - not supported\n");
 	return 0;
     }
-    *offset_p = get_le32(de->start_sector) << 2;
+    *offset_p = le32_to_cpu(*(u32*)(de->start_sector)) << 2;
     debug("offset=%#lx length=%#lx\n", *offset_p, *length_p);
 
     return 1;

Modified: trunk/filo/i386/ldscript
===================================================================
--- trunk/filo/i386/ldscript	2008-08-29 13:43:47 UTC (rev 56)
+++ trunk/filo/i386/ldscript	2008-09-01 14:49:06 UTC (rev 57)
@@ -53,9 +53,9 @@
     .text : { *(.text) *(.text.*) }
     .rodata : {
 	. = ALIGN(4);
-	sound_drivers_start = .;
-	*(.rodata.sound_drivers)
-	sound_drivers_end = .;
+	drivers_start = .;
+	*(.rodata.drivers)
+	drivers_end = .;
 	*(.rodata)
 	*(.rodata.*)
     }

Modified: trunk/filo/i386/timer.c
===================================================================
--- trunk/filo/i386/timer.c	2008-08-29 13:43:47 UTC (rev 56)
+++ trunk/filo/i386/timer.c	2008-09-01 14:49:06 UTC (rev 57)
@@ -19,20 +19,19 @@
 
 #include <libpayload.h>
 #include <arch/rdtsc.h>
+#include <arch/timer.h>
 
-extern unsigned int cpu_khz;
-
 u64 currticks(void)
 {
 	/* Read the Time Stamp Counter */
-	return  rdtsc() / cpu_khz;
+	return  rdtsc();
 }
 
 int getrtsecs (void)
 {
 	u64 t;
 	t=currticks();
-	t=t/1000;
+	t=t/(TICKS_PER_SEC);
 	return (int)t;
 }
 

Added: trunk/filo/include/drivers.h
===================================================================
--- trunk/filo/include/drivers.h	                        (rev 0)
+++ trunk/filo/include/drivers.h	2008-09-01 14:49:06 UTC (rev 57)
@@ -0,0 +1,68 @@
+/*
+ * This file is part of FILO.
+ *
+ * (C) 2008 coresystems GmbH
+ *
+ * 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; version 2 of the License.
+ *
+ * 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., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
+ */
+
+
+#ifndef DRIVERS_H
+#define DRIVERS_H
+
+#include <libpayload.h>
+
+/*
+ * Driver interface
+ */
+
+typedef enum {
+	DRIVER_SOUND = 1,
+	DRIVER_STORAGE = 2
+} drivertype_t;
+
+struct sound_ops {
+	int (*init)(pcidev_t dev);
+	void (*set_rate)(int rate);
+	void (*set_volume)(int volume);
+	int (*write)(const void *buf, int size);
+	int (*is_active)(void);
+	void (*stop)(void);
+};
+
+struct storage_ops {
+	int (*init)(pcidev_t dev);
+	int (*open)(int drive);
+	int (*close)(int drive);
+	void (*read_sector)(u64 sector, const void *buf, int size);
+	char *(*name)(void);
+};
+
+struct driver {
+	drivertype_t type;
+	u16 vendor;
+	u16 device;
+	union {
+		const struct storage_ops *storage_ops;
+		const struct sound_ops *sound_ops;
+	};
+};
+
+#define __driver __attribute__((unused, section(".rodata.drivers")))
+
+/* defined by the linker */
+extern struct driver drivers_start[];
+extern struct driver drivers_end[];
+
+#endif /* DRIVERS_H */

Modified: trunk/filo/include/grub/shared.h
===================================================================
--- trunk/filo/include/grub/shared.h	2008-08-29 13:43:47 UTC (rev 56)
+++ trunk/filo/include/grub/shared.h	2008-09-01 14:49:06 UTC (rev 57)
@@ -362,7 +362,7 @@
 //#define memcpy grub_memmove	/* we don't need a separate memcpy */
 //#define memset grub_memset
 //#define isspace grub_isspace
-#define printf grub_printf
+// #define printf grub_printf
 //#define sprintf grub_sprintf
 #undef putchar
 #define putchar grub_putchar

Modified: trunk/filo/include/lib.h
===================================================================
--- trunk/filo/include/lib.h	2008-08-29 13:43:47 UTC (rev 56)
+++ trunk/filo/include/lib.h	2008-09-01 14:49:06 UTC (rev 57)
@@ -28,9 +28,6 @@
 unsigned long long simple_strtoull(const char *cp,char **endp,unsigned int base);
 unsigned long long strtoull_with_suffix(const char *cp,char **endp,unsigned int base);
 
-u32 get_le32(const unsigned char *);
-u16 get_le16(const unsigned char *);
-
 void hexdump(const void *p, unsigned int len);
 
 long long simple_strtoll(const char *cp,char **endp,unsigned int base);

Modified: trunk/filo/include/sound.h
===================================================================
--- trunk/filo/include/sound.h	2008-08-29 13:43:47 UTC (rev 56)
+++ trunk/filo/include/sound.h	2008-09-01 14:49:06 UTC (rev 57)
@@ -32,29 +32,4 @@
 void sound_stop(void);
 int sound_is_active(void);
 
-/*
- * Driver interface
- */
-
-struct sound_ops {
-    int (*init)(pcidev_t);
-    void (*set_rate)(int rate);
-    void (*set_volume)(int volume);
-    int (*write)(const void *buf, int size);
-    int (*is_active)(void);
-    void (*stop)(void);
-};
-
-struct sound_driver {
-    u16 vendor;
-    u16 device;
-    struct sound_ops *ops;
-};
-
-#define __sound_driver __attribute__((unused, section(".rodata.sound_drivers")))
-
-/* defined by the linker */
-extern struct sound_driver sound_drivers_start[];
-extern struct sound_driver sound_drivers_end[];
-
 #endif /* SOUND_H */

Modified: trunk/filo/main/elfload.c
===================================================================
--- trunk/filo/main/elfload.c	2008-08-29 13:43:47 UTC (rev 56)
+++ trunk/filo/main/elfload.c	2008-09-01 14:49:06 UTC (rev 57)
@@ -135,7 +135,7 @@
 	unsigned long checksum_offset)
 {
     unsigned long bytes;
-    unsigned int start_time, time;
+    u64 start_time, time;
     int i;
 
     bytes = 0;

Modified: trunk/filo/main/filo.c
===================================================================
--- trunk/filo/main/filo.c	2008-08-29 13:43:47 UTC (rev 56)
+++ trunk/filo/main/filo.c	2008-09-01 14:49:06 UTC (rev 57)
@@ -108,7 +108,7 @@
 #if CONFIG_AUTOBOOT_DELAY
 static inline int autoboot_delay(void)
 {
-    unsigned int timeout;
+    u64 timeout;
     int sec, tmp;
     char key;
     

Modified: trunk/filo/main/grub/builtins.c
===================================================================
--- trunk/filo/main/grub/builtins.c	2008-08-29 13:43:47 UTC (rev 56)
+++ trunk/filo/main/grub/builtins.c	2008-09-01 14:49:06 UTC (rev 57)
@@ -1,6 +1,9 @@
 /*
  * This file is part of FILO.
  *
+ *  Copyright (C) 1999,2000,2001,2002,2004  Free Software Foundation, Inc.
+ *  Copyright (C) 2005-2008 coresystems GmbH
+ *
  * 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; version 2 of the License.
@@ -18,7 +21,6 @@
 
 #include <libpayload.h>
 #include <config.h>
-#define printf grub_printf
 #include <grub/shared.h>
 #include <grub/term.h>
 #include <grub/terminfo.h>
@@ -58,7 +60,8 @@
 int auth = 0;
 
 /* -------- FILO logic -------- */
-char boot_line[1024]={0};
+#define BOOT_LINE_LENGTH 1024
+char boot_line[BOOT_LINE_LENGTH]={0};
 char root_device[16]={0};
 /* ---------------------------- */
 
@@ -494,23 +497,109 @@
 #endif
 };
 
+/**
+ * @param arg  source pointer with grub device names
+ * @param path destination pointer (will be filled with filo device names)
+ * @param use_rootdev values other than zero mean the root device set by the "root"
+ * command is taken into regard here. This has to be zero when calling from root_func.
+ */
 
+static void copy_path_to_filo_bootline(char *arg, char *path, int use_rootdev)
+{
+	char devicename[16];
+	char drivername[16];
+	int disk, part;
+	int i, len;
+
+
+	/* Clean up */
+	memset(devicename, 0, 16);
+	memset(drivername, 0, 16);
+
+	/* Copy over the driver name: "hd", "ud", "sd" ... */
+	if (arg[0] == '(') {
+		i = 1;
+		/* Read until we encounter a number, a comma or a closing
+		 * bracket
+		 */
+		while ((i <= 16) && (arg[i]) &&
+			(!isdigit(arg[i])) && (arg[i] != ',') && (arg[i] != ')')) {
+			drivername[i-1] = arg[i];
+			i++;
+		}
+	}
+
+	disk = -1;
+	part = -1;
+
+	len = strlen(drivername);
+	if (len) { /* We have a driver. No idea if it exists though */
+		// The driver should decide this:
+		len++; // skip driver name + opening bracket
+
+		// XXX put @ handling in here, too for flash at addr and mem at addr
+
+		if (isdigit(arg[len])) {
+			disk = arg[len] - '0';
+			len++;
+			if (isdigit(arg[len])) { /* More than 9 drives? */
+				/* ok, get one more number. No more than 99 drives */
+				disk *= 10;
+				disk += arg[len] - '0';
+				len++;
+			}
+		}
+		if (arg[len] == ',') {
+			len++;
+			part = arg[len] - '0';
+			len++;
+			if (isdigit(arg[len])) { /* More than 9 partitions? */
+				/* ok, get one more number. No more than 99
+				 * partitions */
+				part *= 10;
+				part += arg[len] - '0';
+				len++;
+			}
+		}
+		if (arg[len] != ')') {
+			grub_printf("Drive Error.\n");
+			// set len = 0 --> just copy the drive name 
+			len = 0;
+		} else {
+			len++; // skip closing bracket
+		}
+	}
+
+	if (disk == -1) {
+		grub_printf("No drive.\n");
+		len = 0; // just copy the drive name
+	} else {
+		if(part == -1) { // No partition
+			sprintf(devicename, "%s%c:", drivername, disk + 'a');
+		} else { // both disk and partition
+			sprintf(devicename, "%s%c%d:", drivername, disk + 'a', part + 1);
+		}
+		strncat(path, devicename, BOOT_LINE_LENGTH);
+		arg += len; // skip original drive name
+	}
+
+	if (use_rootdev && !len) { // No drive was explicitly specified
+		if (strlen(root_device)) { // But someone set a root device
+			strncat(path, root_device, BOOT_LINE_LENGTH);
+		}
+	}
+
+	/* Copy the rest over */
+	strncat(path, arg, BOOT_LINE_LENGTH);
+}
+
 /* initrd */
 static int
 initrd_func (char *arg, int flags)
 {
-	char dummy[16]={0};
-	int disk, part;
-	if(arg[0]=='(' && arg[1]=='h' && arg[2]=='d') {
-		disk=arg[3]-'0';
-		part=arg[5]-'0';
-		arg+=7; // FIXME only 9 disks with 9 partitions for booting
-		sprintf(dummy, "hd%c%c:", disk+'a', part+'1');
-	}
-	strncat(boot_line," initrd=", 1000);
-	if(dummy[0]) strncat(boot_line,dummy, 1000);
-	grub_strncat(boot_line,arg, 1000);
-	
+	strncat(boot_line, " initrd=", BOOT_LINE_LENGTH);
+	copy_path_to_filo_bootline(arg, boot_line, 1);
+
 	return 0;
 }
 
@@ -531,20 +620,14 @@
 static int
 kernel_func (char *arg, int flags)
 {
-	int disk,part;
 	/* Needed to pass grub checks */
 	kernel_type=KERNEL_TYPE_LINUX;
-	if(arg[0]=='(' && arg[1]=='h' && arg[2]=='d') {
-		disk=arg[3]-'0';
-		part=arg[5]-'0';
-		arg+=7; // FIXME only 9 disks with 9 partitions for booting
-		sprintf(boot_line, "hd%c%c:", disk+'a', part+'1');
-	} else if (root_device[0]=='h' && root_device[1]=='d') {
-		strcpy(boot_line, root_device);
-	}
-	
-	strncat(boot_line, arg, 1000);
-	
+
+	/* clear out boot_line. Kernel is the first thing */
+	memset(boot_line, 0, BOOT_LINE_LENGTH);
+
+	copy_path_to_filo_bootline(arg, boot_line, 1);
+
 	return 0;
 }
 
@@ -720,7 +803,7 @@
 static int
 pause_func (char *arg, int flags)
 {
-  printf("%s\n", arg);
+  grub_printf("%s\n", arg);
 
   /* If ESC is returned, then abort this entry.  */
   if (ASCII_CHAR (getkey ()) == 27)
@@ -742,15 +825,10 @@
 static int
 root_func (char *arg, int flags)
 {
-  int disk, part;
+	memset(root_device, 0, 16);
+	copy_path_to_filo_bootline(arg, root_device, 0);
 
-  if(arg[0]!='(') return 1;
-  if(arg[1]!='h') return 1;
-  if(arg[2]!='d') return 1;
-  disk=arg[3]-'0';
-  part=arg[5]-'0';
-  sprintf(root_device, "hd%c%c:", disk+'a', part+'1');
-  return 0;
+  	return 0;
 }
 
 static struct builtin builtin_root =

Modified: trunk/filo/main/grub/char_io.c
===================================================================
--- trunk/filo/main/grub/char_io.c	2008-08-29 13:43:47 UTC (rev 56)
+++ trunk/filo/main/grub/char_io.c	2008-09-01 14:49:06 UTC (rev 57)
@@ -85,10 +85,15 @@
       console_setcursor
     },
 #endif
+#ifdef CONFIG_SERIAL_CONSOLE
     {
       "serial",
       /* A serial device must be initialized.  */
+#if 0
       TERM_NEED_INIT,
+#else
+      0, // Not with FILO..
+#endif
       grub_serial_putchar,
       serial_checkkey,
       serial_getkey,
@@ -99,6 +104,7 @@
       0,
       0
     },
+#endif
     /* This must be the last entry.  */
     { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
   };
@@ -116,10 +122,10 @@
 {
   if (errnum > ERR_NONE && errnum < MAX_ERR_NUM)
 #ifndef STAGE1_5
-    /* printf("\7\n %s\n", err_list[errnum]); */
-    printf ("\nError %u: %s\n", errnum, err_list[errnum]);
+    /* grub_printf("\7\n %s\n", err_list[errnum]); */
+    grub_printf ("\nError %u: %s\n", errnum, err_list[errnum]);
 #else /* STAGE1_5 */
-    printf ("Error %u\n", errnum);
+    grub_printf ("Error %u\n", errnum);
 #endif /* STAGE1_5 */
 }
 

Modified: trunk/filo/main/grub/cmdline.c
===================================================================
--- trunk/filo/main/grub/cmdline.c	2008-08-29 13:43:47 UTC (rev 56)
+++ trunk/filo/main/grub/cmdline.c	2008-09-01 14:49:06 UTC (rev 57)
@@ -42,20 +42,23 @@
 }
 
 /* Print a helpful message for the command-line interface.  */
-void
-print_cmdline_message (int type)
+void print_cmdline_message (int type)
 {
-  printf (" [ Minimal BASH-like line editing is supported.  For the first word, TAB\n"
-	  "   lists possible command completions.  Anywhere else TAB lists the possible\n"
-	  "   completions of a device/filename.");
-  if (type == CMDLINE_NORMAL_MODE)
-    printf("  ESC at any time exits.");
-  if (type == CMDLINE_EDIT_MODE)
-    printf("  ESC at any time cancels.  ENTER \n"
-           "   at any time accepts your changes.");
-  printf("]\n");
+	grub_printf(" [ Minimal BASH-like line editing is supported.  For the first word, TAB\n"
+		    "   lists possible command completions.  Anywhere else TAB lists the possible\n"
+		    "   completions of a device/filename.");
+
+	if (type == CMDLINE_NORMAL_MODE)
+		grub_printf("  ESC at any time exits.");
+
+	if (type == CMDLINE_EDIT_MODE)
+		grub_printf("  ESC at any time cancels.  ENTER \n"
+			    "   at any time accepts your changes.");
+
+	grub_printf("]\n");
+
 #ifndef CONFIG_NEWLINE_BEFORE_EACH_PROMPT
-  printf("\n");
+	grub_printf("\n");
 #endif
 }
 

Modified: trunk/filo/main/grub/stage2.c
===================================================================
--- trunk/filo/main/grub/stage2.c	2008-08-29 13:43:47 UTC (rev 56)
+++ trunk/filo/main/grub/stage2.c	2008-09-01 14:49:06 UTC (rev 57)
@@ -318,19 +318,19 @@
       
       if (! auth && password)
 	{
-	  printf ("\
+	  grub_printf ("\
       Press enter to boot the selected OS or \'p\' to enter a\n\
       password to unlock the next set of features.");
 	}
       else
 	{
 	  if (config_entries)
-	    printf ("\
+	    grub_printf ("\
       Press enter to boot the selected OS, \'e\' to edit the\n\
       commands before booting, \'a\' to modify the kernel arguments\n\
       before booting, or \'c\' for a command-line.");
 	  else
-	    printf ("\
+	    grub_printf ("\
       Press \'b\' to boot, \'e\' to edit the selected command in the\n\
       boot sequence, \'c\' for a command-line, \'o\' to open a new line\n\
       after (\'O\' for before) the selected line, \'d\' to remove the\n\
@@ -397,7 +397,7 @@
 		grub_putchar ('\r');
 	      else
 		gotoxy (3, 22);
-	      printf ("                                                                    ");
+	      grub_printf ("                                                                    ");
 	      grub_timeout = -1;
 	      fallback_entryno = -1;
 	      if (! (current_term->flags & TERM_DUMB))
@@ -819,10 +819,10 @@
   while (1)
     {
       if (config_entries)
-	printf ("  Booting \'%s\'\n\n",
+	grub_printf ("  Booting \'%s\'\n\n",
 		get_entry (menu_entries, first_entry + entryno, 0));
       else
-	printf ("  Booting command-list\n\n");
+	grub_printf ("  Booting command-list\n\n");
 
       if (! cur_entry)
 	cur_entry = get_entry (config_entries, first_entry + entryno, 1);

Modified: trunk/filo/main/grub.c
===================================================================
--- trunk/filo/main/grub.c	2008-08-29 13:43:47 UTC (rev 56)
+++ trunk/filo/main/grub.c	2008-09-01 14:49:06 UTC (rev 57)
@@ -38,7 +38,7 @@
 #if CONFIG_MENULST_TIMEOUT
 static inline int menulst_delay(void)
 {
-    unsigned int timeout;
+    u64 timeout;
     int sec, tmp;
     char key;
     

Modified: trunk/filo/main/sound.c
===================================================================
--- trunk/filo/main/sound.c	2008-08-29 13:43:47 UTC (rev 56)
+++ trunk/filo/main/sound.c	2008-09-01 14:49:06 UTC (rev 57)
@@ -15,21 +15,23 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 USA
  */
 
-
+#include <drivers.h>
 #include <sound.h>
 #include <pci.h>
 
-static struct sound_ops *ops;
+static const struct sound_ops *ops;
 
 int sound_init(void)
 {
-    struct sound_driver *drv;
+    struct driver *drv;
     pcidev_t dev = 0;
 
-    for (drv = sound_drivers_start; drv < sound_drivers_end; drv++) {
+    for (drv = drivers_start; drv < drivers_end; drv++) {
+	if (drv->type != DRIVER_SOUND)
+		continue;
 	if (pci_find_device(drv->vendor, drv->device, &dev)) {
-	    if (drv->ops->init(dev) == 0) {
-		ops = drv->ops;
+	    if (drv->sound_ops->init(dev) == 0) {
+		ops = drv->sound_ops;
 		return 0;
 	    }
 	}





More information about the coreboot mailing list