coreboot
Threads by month
- ----- 2025 -----
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2012 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2011 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2010 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2009 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2008 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2007 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2006 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2005 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2004 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2003 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2002 -----
- December
- November
- October
- September
- August
September 2008
- 59 participants
- 415 discussions

r57 - in trunk/filo: . drivers fs i386 include include/grub main main/grub
by svn@coreboot.org Sept. 1, 2008
by svn@coreboot.org Sept. 1, 2008
Sept. 1, 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@addr and mem@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;
}
}
1
0
status:
train_DqsRcvrEn: end ctrl 0x0 0
done
Ram4
stage1 returns
run_file returns with 0
Done RAM init code
Yep, we got through ram init code. Is it working? We'll see. It dies
in disable_car(), which I expected.
This is pretty neat .... I think disable_car() will be hard, but we'll
get it. I hope to have serengeti doing something interesting by the
end of the week. We'll see ... it's off vacation and back to work, so
it's back to nights and weekends, but we'll see.
thanks
ron
1
0

Sept. 1, 2008
Author: rminnich
Date: 2008-09-01 04:44:08 +0200 (Mon, 01 Sep 2008)
New Revision: 854
Modified:
coreboot-v3/northbridge/amd/k8/coherent_ht.c
coreboot-v3/northbridge/amd/k8/incoherent_ht.c
coreboot-v3/northbridge/amd/k8/pci.c
coreboot-v3/northbridge/amd/k8/raminit.c
coreboot-v3/southbridge/amd/amd8111/acpi.c
Log:
This finishes the fix to log2. The computed dram size now matches the
size indicated by byte 31 of SPD.
Memory is still not working; hanging in dqs training.
Signed-off-by: Ronald G. Minnich <rminnich(a)gmail.com>
Acked-by: Ronald G. Minnich <rminnich(a)gmail.com>
Modified: coreboot-v3/northbridge/amd/k8/coherent_ht.c
===================================================================
--- coreboot-v3/northbridge/amd/k8/coherent_ht.c 2008-08-31 20:39:48 UTC (rev 853)
+++ coreboot-v3/northbridge/amd/k8/coherent_ht.c 2008-09-01 02:44:08 UTC (rev 854)
@@ -322,7 +322,7 @@
freq_cap2 = read_freq_cap(node2, link2 + PCI_HT_CAP_HOST_FREQ_CAP);
/* Calculate the highest possible frequency */
- freq = log2(freq_cap1 & freq_cap2);
+ freq = log2c(freq_cap1 & freq_cap2);
/* See if I am changing the link freqency */
old_freq = pci_conf1_read_config8(node1, link1 + PCI_HT_CAP_HOST_FREQ);
Modified: coreboot-v3/northbridge/amd/k8/incoherent_ht.c
===================================================================
--- coreboot-v3/northbridge/amd/k8/incoherent_ht.c 2008-08-31 20:39:48 UTC (rev 853)
+++ coreboot-v3/northbridge/amd/k8/incoherent_ht.c 2008-09-01 02:44:08 UTC (rev 854)
@@ -229,7 +229,7 @@
freq_cap2 = ht_read_freq_cap(bdf2, pos2 + LINK_FREQ_CAP(offs2));
/* Calculate the highest possible frequency */
- freq = log2(freq_cap1 & freq_cap2);
+ freq = log2c(freq_cap1 & freq_cap2);
/* See if I am changing the link freqency */
old_freq = pci_conf1_read_config8(bdf1, pos1 + LINK_FREQ(offs1));
Modified: coreboot-v3/northbridge/amd/k8/pci.c
===================================================================
--- coreboot-v3/northbridge/amd/k8/pci.c 2008-08-31 20:39:48 UTC (rev 853)
+++ coreboot-v3/northbridge/amd/k8/pci.c 2008-09-01 02:44:08 UTC (rev 854)
@@ -332,8 +332,8 @@
if (resource) {
resource->base = 0;
resource->size = 0;
- resource->align = log2(HT_IO_HOST_ALIGN);
- resource->gran = log2(HT_IO_HOST_ALIGN);
+ resource->align = log2c(HT_IO_HOST_ALIGN);
+ resource->gran = log2c(HT_IO_HOST_ALIGN);
resource->limit = 0xffffUL;
resource->flags = IORESOURCE_IO;
compute_allocate_resource(&dev->link[link], resource,
@@ -345,8 +345,8 @@
if (resource) {
resource->base = 0;
resource->size = 0;
- resource->align = log2(HT_MEM_HOST_ALIGN);
- resource->gran = log2(HT_MEM_HOST_ALIGN);
+ resource->align = log2c(HT_MEM_HOST_ALIGN);
+ resource->gran = log2c(HT_MEM_HOST_ALIGN);
resource->limit = 0xffffffffffULL;
resource->flags = IORESOURCE_MEM | IORESOURCE_PREFETCH;
compute_allocate_resource(&dev->link[link], resource,
@@ -359,8 +359,8 @@
if (resource) {
resource->base = 0;
resource->size = 0;
- resource->align = log2(HT_MEM_HOST_ALIGN);
- resource->gran = log2(HT_MEM_HOST_ALIGN);
+ resource->align = log2c(HT_MEM_HOST_ALIGN);
+ resource->gran = log2c(HT_MEM_HOST_ALIGN);
resource->limit = 0xffffffffffULL;
resource->flags = IORESOURCE_MEM;
compute_allocate_resource(&dev->link[link], resource,
Modified: coreboot-v3/northbridge/amd/k8/raminit.c
===================================================================
--- coreboot-v3/northbridge/amd/k8/raminit.c 2008-08-31 20:39:48 UTC (rev 853)
+++ coreboot-v3/northbridge/amd/k8/raminit.c 2008-09-01 02:44:08 UTC (rev 854)
@@ -31,7 +31,7 @@
#include <string.h>
#include <mtrr.h>
#include <macros.h>
-#include <spd.h>
+#include <spd_ddr2.h>
#include <cpu.h>
#include <msr.h>
#include <amd/k8/k8.h>
@@ -765,7 +765,7 @@
value = spd_read_byte(device, SPD_BANK_NUM); /* banks */
if (value < 0) goto hw_err;
if ((value & 0xff) == 0) goto val_err;
- sz->bank = log2(value & 0xff); // convert 4 to 2, and 8 to 3
+ sz->bank = log2c(value & 0xff); // convert 4 to 2, and 8 to 3
printk(BIOS_SPEW, "%d SPD banks %d bank\n", value, sz->bank);
sz->per_rank += sz->bank;
printk(BIOS_SPEW, "sz->per_rank is now %d\n", sz->per_rank);
@@ -774,8 +774,9 @@
if (value < 0) goto hw_err;
value &= 0xff;
if ((value != 72) && (value != 64)) goto val_err;
- sz->per_rank += log2(value) - 3; //64 bit So another 3 lines
- printk(BIOS_SPEW, "value %d log2(value) %d sz->per_rank now %d\n", value, log2(value), sz->per_rank);
+ /* why log2f (floor) here? because 72 bits is really 64 bits + parity */
+ sz->per_rank += log2f(value) - 3; //64 bit So another 3 lines
+ printk(BIOS_SPEW, "value %d log2f(value) %d sz->per_rank now %d\n", value, log2f(value), sz->per_rank);
/* How many ranks? */
value = spd_read_byte(device, SPD_MOD_ATTRIB_RANK); /* number of physical banks */
@@ -783,7 +784,7 @@
// value >>= SPD_MOD_ATTRIB_RANK_NUM_SHIFT;
value &= SPD_MOD_ATTRIB_RANK_NUM_MASK;
value += SPD_MOD_ATTRIB_RANK_NUM_BASE; // 0-->1, 1-->2, 3-->4
- printk(BIOS_SPEW, "# banks %d\n", value);
+ printk(BIOS_SPEW, "# ranks %d\n", value);
/*
rank == 1 only one rank or say one side
rank == 2 two side , and two ranks
@@ -802,13 +803,14 @@
if (value < 0) goto hw_err;
value &= 0xff;
printk(BIOS_SPEW, "spd rank size is %d\n", value);
- value = log2(value);
+ value = log2f(value);
if(value <=4 ) value += 8; // add back to 1G to high
value += (27-5); // make 128MB to the real lines
printk(BIOS_SPEW, " computed value is %d\n", value);
if( value != (sz->per_rank)) {
printk(BIOS_ERR, "Bad RANK Size -- value is 0x%x, and it should be 0x%x\n", value, sz->per_rank);
- goto val_err;
+ printk(BIOS_ERR, "This error has been reduced to a warning for now\n");
+// goto val_err;
}
goto out;
@@ -1112,7 +1114,7 @@
/* Chip selects can only be interleaved when there is
* more than one and their is a power of two of them.
*/
- bits = log2(chip_selects);
+ bits = log2c(chip_selects);
if (((1 << bits) != chip_selects) || (bits < 1) || (bits > 3)) { //chip_selects max = 8
return 0;
}
@@ -1643,7 +1645,7 @@
printk(BIOS_DEBUG, "%s: 0x%x\n", "i:", i);
printk(BIOS_DEBUG, "%s: 0x%x\n", "\tlatencies:", latencies);
/* Compute the lowest cas latency supported */
- latency = log2(latencies) - 2;
+ latency = log2f(latencies) - 2;
/* Loop through and find a fast clock with a low latency */
for(index = 0; index < 3; index++, latency++) {
@@ -1716,7 +1718,7 @@
}
/* Compute the lowest cas latency supported */
- latency = log2(latencies) -2;
+ latency = log2f(latencies) -2;
/* Walk through searching for the selected latency */
for(index = 0; index < 3; index++, latency++) {
@@ -1832,7 +1834,7 @@
return -1;
}
- value = 6 - log2(value); //4-->4, 8-->3, 16-->2
+ value = 6 - log2f(value); //4-->4, 8-->3, 16-->2
clocks = meminfo->sz[i].per_rank - 27 + 2 - value;
Modified: coreboot-v3/southbridge/amd/amd8111/acpi.c
===================================================================
--- coreboot-v3/southbridge/amd/amd8111/acpi.c 2008-08-31 20:39:48 UTC (rev 853)
+++ coreboot-v3/southbridge/amd/amd8111/acpi.c 2008-09-01 02:44:08 UTC (rev 854)
@@ -185,8 +185,8 @@
resource = new_resource(dev, 0x58);
resource->base = 0;
resource->size = 256;
- resource->align = log2(256);
- resource->gran = log2(256);
+ resource->align = log2f(256);
+ resource->gran = log2f(256);
resource->limit = 65536;
resource->flags = IORESOURCE_IO;
resource->index = 0x58;
1
0
This patch gets the Epia-CN working without ACPI or APIC.
All devices work, no irq storms. Enjoy.
Signed-off-by: Bari Ari <bari(a)onelabs.com>
2
1

r3556 - in trunk/coreboot-v2: src/mainboard/via/epia-cn src/northbridge/via/cn700 src/southbridge/via/vt8237r targets/via/epia-cn
by svn@coreboot.org Sept. 1, 2008
by svn@coreboot.org Sept. 1, 2008
Sept. 1, 2008
Author: stuge
Date: 2008-09-01 03:48:07 +0200 (Mon, 01 Sep 2008)
New Revision: 3556
Modified:
trunk/coreboot-v2/src/mainboard/via/epia-cn/Config.lb
trunk/coreboot-v2/src/mainboard/via/epia-cn/Options.lb
trunk/coreboot-v2/src/mainboard/via/epia-cn/auto.c
trunk/coreboot-v2/src/northbridge/via/cn700/raminit.c
trunk/coreboot-v2/src/northbridge/via/cn700/vga.c
trunk/coreboot-v2/src/southbridge/via/vt8237r/vt8237r.c
trunk/coreboot-v2/src/southbridge/via/vt8237r/vt8237r_lpc.c
trunk/coreboot-v2/targets/via/epia-cn/Config.lb
Log:
This patch gets the Epia-CN working without ACPI or APIC.
All devices work, no irq storms. Enjoy.
Signed-off-by: Bari Ari <bari(a)onelabs.com>
Acked-by: Peter Stuge <peter(a)stuge.se>
Modified: trunk/coreboot-v2/src/mainboard/via/epia-cn/Config.lb
===================================================================
--- trunk/coreboot-v2/src/mainboard/via/epia-cn/Config.lb 2008-08-31 22:10:35 UTC (rev 3555)
+++ trunk/coreboot-v2/src/mainboard/via/epia-cn/Config.lb 2008-09-01 01:48:07 UTC (rev 3556)
@@ -98,12 +98,14 @@
register "ide0_80pin_cable" = "0"
register "ide1_80pin_cable" = "0"
device pci f.0 on end # IDE
- register "fn_ctrl_lo" = "0x8a"
- register "fn_ctrl_hi" = "0x9d"
- device pci 10.0 on end # USB 1.1
- device pci 10.1 on end # USB 1.1
- device pci 10.2 on end # USB 1.1
- device pci 10.3 on end # USB 1.1
+ register "fn_ctrl_lo" = "0x80"
+ register "fn_ctrl_hi" = "0x1d"
+ device pci 10.0 on end # OHCI
+ device pci 10.1 on end # OHCI
+ device pci 10.2 on end # OHCI
+ device pci 10.3 on end # OHCI
+ device pci 10.4 on end # EHCI
+ device pci 10.5 on end # UDCI
device pci 11.0 on # Southbridge LPC
chip superio/via/vt1211 # Super I/O
device pnp 2e.0 off # Floppy
Modified: trunk/coreboot-v2/src/mainboard/via/epia-cn/Options.lb
===================================================================
--- trunk/coreboot-v2/src/mainboard/via/epia-cn/Options.lb 2008-08-31 22:10:35 UTC (rev 3555)
+++ trunk/coreboot-v2/src/mainboard/via/epia-cn/Options.lb 2008-09-01 01:48:07 UTC (rev 3556)
@@ -94,7 +94,7 @@
default _RAMBASE = 0x00004000
default CONFIG_ROM_PAYLOAD = 1
default CROSS_COMPILE = ""
-default CC = "$(CROSS_COMPILE)gcc -m32"
+default CC = "$(CROSS_COMPILE)gcc -m32 -fno-stack-protector"
default HOSTCC = "gcc"
##
Modified: trunk/coreboot-v2/src/mainboard/via/epia-cn/auto.c
===================================================================
--- trunk/coreboot-v2/src/mainboard/via/epia-cn/auto.c 2008-08-31 22:10:35 UTC (rev 3555)
+++ trunk/coreboot-v2/src/mainboard/via/epia-cn/auto.c 2008-09-01 01:48:07 UTC (rev 3556)
@@ -55,34 +55,27 @@
{
device_t dev;
u8 reg;
+
+ dev = pci_locate_device(PCI_ID(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_VT8237R_LPC), 0);
+ if (dev == PCI_DEV_INVALID)
+ die("Southbridge not found!!!\n");
- /*
- * If I enable SATA, FILO will not find the IDE disk, so I'll disable
- * SATA here. To not conflict with PCI spec, I'll move IDE device
- * from 00:0f.1 to 00:0f.0.
+ /* bit=0 means enable function (per CX700 datasheet)
+ * 5 16.1 USB 2
+ * 4 16.0 USB 1
+ * 3 15.0 SATA and PATA
+ * 2 16.2 USB 3
+ * 1 16.4 USB EHCI
*/
- dev = pci_locate_device(PCI_ID(PCI_VENDOR_ID_VIA,
- PCI_DEVICE_ID_VIA_VT6420_SATA), 0);
- if (dev != PCI_DEV_INVALID) {
- /* Enable PATA. */
- reg = pci_read_config8(dev, 0xd1);
- reg |= 0x08;
- pci_write_config8(dev, 0xd1, reg);
- reg = pci_read_config8(dev, 0x49);
- reg |= 0x80;
- pci_write_config8(dev, 0x49, reg);
- } else {
- print_debug("No SATA device\r\n");
- }
+ pci_write_config8(dev, 0x50, 0x80);
- /* Disable SATA, and PATA device will be 00:0f.0. */
- dev = pci_locate_device(PCI_ID(PCI_VENDOR_ID_VIA,
- PCI_DEVICE_ID_VIA_VT8237R_LPC), 0);
- if (dev == PCI_DEV_INVALID)
- die("Southbridge not found!!!\r\n");
- reg = pci_read_config8(dev, 0x50);
- reg |= 0x08;
- pci_write_config8(dev, 0x50, reg);
+ /* bit=1 means enable internal function (per CX700 datasheet)
+ * 3 Internal RTC
+ * 2 Internal PS2 Mouse
+ * 1 Internal KBC Configuration
+ * 0 Internal Keyboard Controller
+ */
+ pci_write_config8(dev, 0x51, 0x1d);
}
static const struct mem_controller ctrl = {
Modified: trunk/coreboot-v2/src/northbridge/via/cn700/raminit.c
===================================================================
--- trunk/coreboot-v2/src/northbridge/via/cn700/raminit.c 2008-08-31 22:10:35 UTC (rev 3555)
+++ trunk/coreboot-v2/src/northbridge/via/cn700/raminit.c 2008-09-01 01:48:07 UTC (rev 3556)
@@ -366,7 +366,7 @@
/* dram duty control */
pci_write_config8(ctrl->d0f3, 0xed, 0x10);
- /* SMM and APIC deocoding, we donot use SMM */
+ /* SMM and APIC decoding, we do not use SMM */
reg = 0x29;
pci_write_config8(ctrl->d0f3, 0x86, reg);
/* SMM and APIC decoding mirror */
Modified: trunk/coreboot-v2/src/northbridge/via/cn700/vga.c
===================================================================
--- trunk/coreboot-v2/src/northbridge/via/cn700/vga.c 2008-08-31 22:10:35 UTC (rev 3555)
+++ trunk/coreboot-v2/src/northbridge/via/cn700/vga.c 2008-09-01 01:48:07 UTC (rev 3556)
@@ -45,14 +45,12 @@
u8 reg8;
print_debug("Copying BOCHS Bios to 0xf000\n");
-/* Copy the BOCHs BIOS from 0xFFFFFFFF - ROM_SIZE - BOCHs size (64k) to 0xf0000
- This is for compatibility with the VGA ROM's BIOS callbacks */
- memcpy(0xf0000, (0xFFFFFFFF - ROM_SIZE - 0x10000), 0x10000);
+ /* Copy BOCHS BIOS from 4G-ROM_SIZE-64k (in flash) to 0xf0000 (in RAM)
+ * This is for compatibility with the VGA ROM's BIOS callbacks */
+ memcpy(0xf0000, (0xffffffff - ROM_SIZE - 0xffff), 0x10000);
printk_debug("Initializing VGA\n");
- pci_write_config8(dev, 0x3c, 0xb);
-
/* Set memory rate to 200MHz */
outb(0x3d, CRTM_INDEX);
reg8 = inb(CRTM_DATA);
@@ -71,8 +69,6 @@
pci_write_config8(dev, 0x0d, 0x20);
pci_write_config32(dev,0x10, 0xf4000008);
pci_write_config32(dev,0x14, 0xfb000000);
- pci_write_config8(dev, 0x3e, 0x02);
- pci_write_config8(dev, 0x3c, 0x0a);
printk_debug("INSTALL REAL-MODE IDT\n");
Modified: trunk/coreboot-v2/src/southbridge/via/vt8237r/vt8237r.c
===================================================================
--- trunk/coreboot-v2/src/southbridge/via/vt8237r/vt8237r.c 2008-08-31 22:10:35 UTC (rev 3555)
+++ trunk/coreboot-v2/src/southbridge/via/vt8237r/vt8237r.c 2008-09-01 01:48:07 UTC (rev 3556)
@@ -79,8 +79,6 @@
pci_write_config8(dev, 0x51, sb->fn_ctrl_hi);
/* TODO: If SATA is disabled, move IDE to fn0 to conform PCI specs. */
- /* Extend ROM decode to 1MB FFC00000 - FFFFFFFF */
- pci_write_config8(dev, 0x41, 0x7f);
}
struct chip_operations southbridge_via_vt8237r_ops = {
Modified: trunk/coreboot-v2/src/southbridge/via/vt8237r/vt8237r_lpc.c
===================================================================
--- trunk/coreboot-v2/src/southbridge/via/vt8237r/vt8237r_lpc.c 2008-08-31 22:10:35 UTC (rev 3555)
+++ trunk/coreboot-v2/src/southbridge/via/vt8237r/vt8237r_lpc.c 2008-09-01 01:48:07 UTC (rev 3556)
@@ -244,10 +244,20 @@
enables |= 0x80;
pci_write_config8(dev, 0x6C, enables);
- /* FIXME: Map 4MB of flash into the address space,
- * this should be in CAR call.
+ /*
+ * ROM decode
+ * bit range
+ * 7 000E0000h-000EFFFFh
+ * 6 FFF00000h-FFF7FFFFh
+ * 5 FFE80000h-FFEFFFFFh
+ * 4 FFE00000h-FFE7FFFFh
+ * 3 FFD80000h-FFDFFFFFh
+ * 2 FFD00000h-FFD7FFFFh
+ * 1 FFC80000h-FFCFFFFFh
+ * 0 FFC00000h-FFC7FFFFh
+ * So 0x7f here sets ROM decode to FFC00000-FFFFFFFF or 4Mbyte.
*/
- /* pci_write_config8(dev, 0x41, 0x7f); */
+ pci_write_config8(dev, 0x41, 0x7f);
/* Set bit 6 of 0x40 (I/O recovery time).
* IMPORTANT FIX - EISA = ECLR reg at 0x4d0! Decoding must be on so
@@ -271,8 +281,14 @@
/* ROM memory cycles go to LPC. */
pci_write_config8(dev, 0x59, 0x80);
- /* Bypass APIC De-Assert Message, INTE#, INTF#, INTG#, INTH# as PCI. */
- pci_write_config8(dev, 0x5B, 0xb);
+ /*
+ * bit meaning
+ * 3 Bypass APIC De-Assert Message (1=Enable)
+ * 1 possibly "INTE#, INTF#, INTG#, INTH# as PCI"
+ * bit 1=1 works for Aaron at VIA, bit 1=0 works for jakllsch
+ * 0 Dynamic Clock Gating Main Switch (1=Enable)
+ */
+ pci_write_config8(dev, 0x5b, 0x9);
/* Set Read Pass Write Control Enable (force A2 from APIC FSB to low). */
pci_write_config8(dev, 0x48, 0x8c);
Modified: trunk/coreboot-v2/targets/via/epia-cn/Config.lb
===================================================================
--- trunk/coreboot-v2/targets/via/epia-cn/Config.lb 2008-08-31 22:10:35 UTC (rev 3555)
+++ trunk/coreboot-v2/targets/via/epia-cn/Config.lb 2008-09-01 01:48:07 UTC (rev 3556)
@@ -22,6 +22,13 @@
target via_epia_cn
mainboard via/epia-cn
+option MAXIMUM_CONSOLE_LOGLEVEL=8
+option DEFAULT_CONSOLE_LOGLEVEL=8
+option CONFIG_CONSOLE_SERIAL8250=1
+
+# coreboot C code runs at this location in RAM
+option _RAMBASE=0x00004000
+
#
# Generate the final ROM like this:
# cat vgabios bochsbios coreboot.rom > coreboot.rom.final
1
0