[coreboot] use FILO boot usb

Wang, Qingpei Qingpei.Wang at amd.com
Fri Mar 28 03:46:10 CET 2008


Hi,all
  I found that while I tried to boot linux from a usb disk by filo. It
failed, the debug message says " dma_to_td can not find td".
Is there any one who can help me ?
thanks
 

Jason Wang
Intern
Electronic Engineering Lab
Peking University 
Beijing Technology Development Center
Advanced Micro Devices(AMD)
E-mail: Qingpei.Wang at amd.com
     wangqingpei at hotmail.com
Phone:13426369984

 
-----Original Message-----
From: coreboot-bounces at coreboot.org
[mailto:coreboot-bounces at coreboot.org] On Behalf Of
coreboot-request at coreboot.org
Sent: Friday, March 28, 2008 7:27 AM
To: coreboot at coreboot.org
Subject: coreboot Digest, Vol 37, Issue 181

Send coreboot mailing list submissions to
	coreboot at coreboot.org

To subscribe or unsubscribe via the World Wide Web, visit
	http://www.coreboot.org/mailman/listinfo/coreboot
or, via email, send a message with subject or body 'help' to
	coreboot-request at coreboot.org

You can reach the person managing the list at
	coreboot-owner at coreboot.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of coreboot digest..."


Today's Topics:

   1. [libpayload] Fix drawing chars (Jordan Crouse)
   2. [libpayload] fix curses drawing problem (Jordan Crouse)
   3. [PATCH] coreinfo: CMOS Dump support and other fixes (Uwe Hermann)
   4. Re: [libpayload] fix curses drawing problem (Uwe Hermann)
   5. Re: [PATCH] libpayload: CMOS / BCD functions (Peter Stuge)
   6. Re: [libpayload] Fix drawing chars (Peter Stuge)
   7. [PATCH][RFC] LAR segfault when adding to a full archive
      (Carl-Daniel Hailfinger)
   8. r3192 - in trunk/payloads/libpayload: . drivers include	libc
      (svn at coreboot.org)


----------------------------------------------------------------------

Message: 1
Date: Thu, 27 Mar 2008 15:33:13 -0600
From: Jordan Crouse <jordan.crouse at amd.com>
Subject: [coreboot] [libpayload] Fix drawing chars
To: coreboot at coreboot.org
Message-ID: <20080327213313.GQ2063 at cosmic.amd.com>
Content-Type: text/plain; charset=us-ascii

Somewhere in the layers of functions we're accidently casting unsigned
character values as signed, and they are getting sign extended, causing
blinking and bold text.  This patch makes sure we only use the 8 bits we
support right now.

This is probably not wchar safe, as the comment says.

-- 
Jordan Crouse
Systems Software Development Engineer 
Advanced Micro Devices, Inc.




------------------------------

Message: 2
Date: Thu, 27 Mar 2008 15:34:50 -0600
From: Jordan Crouse <jordan.crouse at amd.com>
Subject: [coreboot] [libpayload] fix curses drawing problem
To: coreboot at coreboot.org
Message-ID: <20080327213450.GR2063 at cosmic.amd.com>
Content-Type: text/plain; charset="us-ascii"

This fixes a curses drawing problem - characters are getting
accidently sign extended, which is badness for drawing characters
(i.e chars with values >= 128).  This works around the problem so
the right values get sent to VGA.

-- 
Jordan Crouse
Systems Software Development Engineer 
Advanced Micro Devices, Inc.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: fix-tinycurses-drawing-chars.patch
Type: text/x-diff
Size: 891 bytes
Desc: not available
Url :
http://www.coreboot.org/pipermail/coreboot/attachments/20080327/1be17e58
/attachment-0001.bin 

------------------------------

Message: 3
Date: Thu, 27 Mar 2008 23:07:59 +0100
From: Uwe Hermann <uwe at hermann-uwe.de>
Subject: [coreboot] [PATCH] coreinfo: CMOS Dump support and other
	fixes
To: coreboot at coreboot.org
Message-ID: <20080327220759.GB9398 at greenwood>
Content-Type: text/plain; charset="us-ascii"

See patch.


Uwe.
-- 
http://www.hermann-uwe.de  | http://www.holsham-traders.de
http://www.crazy-hacks.org | http://www.unmaintained-free-software.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: coreinfo_cmos_dump.patch
Type: text/x-diff
Size: 6808 bytes
Desc: not available
Url :
http://www.coreboot.org/pipermail/coreboot/attachments/20080327/899e97a4
/attachment-0001.bin 

------------------------------

Message: 4
Date: Thu, 27 Mar 2008 23:12:35 +0100
From: Uwe Hermann <uwe at hermann-uwe.de>
Subject: Re: [coreboot] [libpayload] fix curses drawing problem
To: Jordan Crouse <jordan.crouse at amd.com>
Cc: coreboot at coreboot.org
Message-ID: <20080327221234.GC9398 at greenwood>
Content-Type: text/plain; charset=us-ascii

On Thu, Mar 27, 2008 at 03:34:50PM -0600, Jordan Crouse wrote:
> [libpayload] Work around sign-extending issue
> 
> somewhere characters are getting sign-extended, meaning that the
> attributes of the drawing chars ( >= 128) are wrong.  Cast the value 
> before sending it to vga.
> 
> Signed-off-by: Jordan Crouse <jordan.crouse at amd.com>

Acked-by: Uwe Hermann <uwe at hermann-uwe.de>

Tested in QEMU.

 
Uwe.
-- 
http://www.hermann-uwe.de  | http://www.holsham-traders.de
http://www.crazy-hacks.org | http://www.unmaintained-free-software.org



------------------------------

Message: 5
Date: Thu, 27 Mar 2008 23:21:53 +0100
From: Peter Stuge <peter at stuge.se>
Subject: Re: [coreboot] [PATCH] libpayload: CMOS / BCD functions
To: coreboot at coreboot.org
Message-ID: <20080327222153.22930.qmail at stuge.se>
Content-Type: text/plain; charset=us-ascii

On Thu, Mar 27, 2008 at 09:24:08PM +0100, Uwe Hermann wrote:
> I'll follow-up with a coreinfo patch to dump the whole CMOS array.

It would be nice to use NVRAM instead of CMOS. Looks good!


//Peter



------------------------------

Message: 6
Date: Thu, 27 Mar 2008 23:30:56 +0100
From: Peter Stuge <peter at stuge.se>
Subject: Re: [coreboot] [libpayload] Fix drawing chars
To: coreboot at coreboot.org
Message-ID: <20080327223056.24931.qmail at stuge.se>
Content-Type: text/plain; charset=us-ascii

On Thu, Mar 27, 2008 at 03:33:13PM -0600, Jordan Crouse wrote:
> This patch makes sure we only use the 8 bits we support right now.

No patch.


//Peter



------------------------------

Message: 7
Date: Fri, 28 Mar 2008 00:10:16 +0100
From: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006 at gmx.net>
Subject: [coreboot] [PATCH][RFC] LAR segfault when adding to a full
	archive
To: Coreboot <coreboot at coreboot.org>
Cc: Alvar Kusma <alvar at raamat.polva.ee>
Message-ID: <47EC2958.1080705 at gmx.net>
Content-Type: text/plain; charset=UTF-8

Hi,

Alvar Kusma found a bug in util/lar: If you try to add a file to a full
LAR archive, the LAR utility will segfault. This is reproduced easily by
zerofilling the LAR, then adding anything to it.

Looking at the code, the reason is obvious:
lar_empty_offset() can return an error code (-1). None of the callers
check for an error code, they simply assume the return value is valid.

Preliminary patch follows (and raises a few questions).
Signed-off-by: Carl-Daniel Hailfinger
<c-d.hailfinger.devel.2006 at gmx.net>

Index: util/lar/lar.h
===================================================================
--- util/lar/lar.h	(Revision 646)
+++ util/lar/lar.h	(Arbeitskopie)
@@ -58,7 +58,9 @@
 #define BOOTBLOCK_NAME_LEN 16
 
 typedef uint64_t u64;
+typedef int64_t s64;
 typedef uint32_t u32;
+typedef int32_t s32;
 typedef uint8_t  u8;
 
 /* NOTE -- This and the coreboot lar.h may NOT be in sync. Be careful.
*/
Index: util/lar/stream.c
===================================================================
--- util/lar/stream.c	(Revision 646)
+++ util/lar/stream.c	(Arbeitskopie)
@@ -492,7 +492,7 @@
  * @param lar the LAR archive structure
  * @return The offset of the first chunk of empty space
  */
-static int lar_empty_offset(struct lar *lar)
+static s64 lar_empty_offset(struct lar *lar)
 {
 	u32 offset = 0;
 	struct lar_header *header;
@@ -508,10 +508,12 @@
 		offset += get_next_offset(header);
 	}
 
-	if (offset >= get_bootblock_offset(lar->size))
+	if (offset >= get_bootblock_offset(lar->size)) {
+		err("No empty space found!\n");	
 		return -1;
+	}
 
-	return offset;
+	return (s64)offset;
 }
 
 /**
@@ -825,11 +827,16 @@
 int maxsize(struct lar *lar, char *name)
 {
 	int size;
-	u32 offset;
+	s64 offset;
 	int bootblock_size;
 
 	/* Find the beginning of the available space in the LAR */
+#warning We should check all chunks of free space in the LAR. Right now
we do not return the maximum size, but the size of the first chunk.
 	offset = lar_empty_offset(lar);
+	if (offset < 0) {
+		err("maxsize is negative\n");
+		return offset;
+	}
 
 	/* Figure out how big our header will be */
 	size = get_bootblock_offset(lar->size) - offset -
header_len(name,NULL) - 1;
@@ -878,7 +885,7 @@
 	int ret, hlen;
 	int pathlen;
 	u32 *walk,  csum;
-	u32 offset;
+	s64 offset;
 
 	/* Find the beginning of the available space in the LAR */
 	offset = lar_empty_offset(lar);
@@ -886,7 +893,8 @@
 	/* Figure out how big our header will be */
 	hlen = header_len(pathname, &pathlen);
 
-	if (offset + hlen + complen >= get_bootblock_offset(lar->size))
{
+	if ((offset < 0) || 
+		(offset + hlen + complen >=
get_bootblock_offset(lar->size))) {
 		err("Not enough room in the LAR to add the file.\n");
 		return -1;
 	}





------------------------------

Message: 8
Date: Fri, 28 Mar 2008 00:26:42 +0100
From: svn at coreboot.org
Subject: [coreboot] r3192 - in trunk/payloads/libpayload: . drivers
	include	libc
To: coreboot at coreboot.org
Message-ID: <mailman.429.1206660409.3267.coreboot at coreboot.org>
Content-Type: text/plain; charset=UTF-8

Author: uwe
Date: 2008-03-28 00:26:40 +0100 (Fri, 28 Mar 2008)
New Revision: 3192

Added:
   trunk/payloads/libpayload/drivers/cmos.c
   trunk/payloads/libpayload/libc/lib.c
Modified:
   trunk/payloads/libpayload/Config.in
   trunk/payloads/libpayload/drivers/Makefile.inc
   trunk/payloads/libpayload/include/libpayload.h
   trunk/payloads/libpayload/libc/Makefile.inc
Log:
Add initial support for some basic CMOS read/write functions and the
bcd2dec()/dec2bcd() functions we'll need for (among other things)
converting some date/time parameters in CMOS.

Signed-off-by: Uwe Hermann <uwe at hermann-uwe.de>
Acked-by: Jordan Crouse <jordan.crouse at amd.com>



Modified: trunk/payloads/libpayload/Config.in
===================================================================
--- trunk/payloads/libpayload/Config.in	2008-03-27 20:46:49 UTC (rev
3191)
+++ trunk/payloads/libpayload/Config.in	2008-03-27 23:26:40 UTC (rev
3192)
@@ -68,6 +68,10 @@
        depends VGA_CONSOLE
        default y
 
+config CMOS
+       bool "Support for reading/writing CMOS bytes"
+       default y
+
 endmenu
 
 menu "Build Options"

Modified: trunk/payloads/libpayload/drivers/Makefile.inc
===================================================================
--- trunk/payloads/libpayload/drivers/Makefile.inc	2008-03-27
20:46:49 UTC (rev 3191)
+++ trunk/payloads/libpayload/drivers/Makefile.inc	2008-03-27
23:26:40 UTC (rev 3192)
@@ -31,3 +31,4 @@
 TARGETS-$(CONFIG_SERIAL_CONSOLE) += drivers/serial.o
 TARGETS-$(CONFIG_VGA_CONSOLE) += drivers/vga.o
 TARGETS-$(CONFIG_PC_KEYBOARD) += drivers/keyboard.o
+TARGETS-$(CONFIG_CMOS) += drivers/cmos.o

Added: trunk/payloads/libpayload/drivers/cmos.c
===================================================================
--- trunk/payloads/libpayload/drivers/cmos.c
(rev 0)
+++ trunk/payloads/libpayload/drivers/cmos.c	2008-03-27 23:26:40 UTC
(rev 3192)
@@ -0,0 +1,69 @@
+/*
+ * This file is part of the libpayload project.
+ *
+ * Copyright (C) 2008 Uwe Hermann <uwe at hermann-uwe.de>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
the
+ *    documentation and/or other materials provided with the
distribution.
+ * 3. The name of the author may not be used to endorse or promote
products
+ *    derived from this software without specific prior written
permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Datasheet:
+ *  - Name: MC146818: Real-time Clock Plus RAM (RTC)
+ *  - PDF:
http://www.freescale.com/files/microcontrollers/doc/data_sheet/MC146818.
pdf
+ *  - Order number: MC146818/D
+ */
+
+/*
+ * See also:
+ * http://bochs.sourceforge.net/techspec/CMOS-reference.txt
+ * http://www.bioscentral.com/misc/cmosmap.htm
+ */
+
+#include <libpayload.h>
+
+#define RTC_PORT 0x70
+
+/**
+ * Read a byte from the specified CMOS address.
+ * 
+ * @param addr The CMOS address to read a byte from.
+ * @return The byte at the given CMOS address.
+ */
+u8 cmos_read(u8 addr)
+{
+	outb(addr, RTC_PORT);
+	return inb(RTC_PORT + 1);
+}
+
+/**
+ * Write a byte to the specified CMOS address.
+ * 
+ * @param val The byte to write to CMOS.
+ * @param addr The CMOS address to write to.
+ */
+void cmos_write(u8 val, u8 addr)
+{
+	outb(addr, RTC_PORT);
+	outb(val, RTC_PORT + 1);
+}

Modified: trunk/payloads/libpayload/include/libpayload.h
===================================================================
--- trunk/payloads/libpayload/include/libpayload.h	2008-03-27
20:46:49 UTC (rev 3191)
+++ trunk/payloads/libpayload/include/libpayload.h	2008-03-27
23:26:40 UTC (rev 3192)
@@ -41,6 +41,18 @@
 #define MAX(a,b) ((a) > (b) ? (a) : (b))
 #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
 
+/* Some CMOS byte definitions */
+#define CMOS_RTC_SECONDS        0
+#define CMOS_RTC_MINUTES        2
+#define CMOS_RTC_HOURS          4
+#define CMOS_RTC_DAY            7
+#define CMOS_RTC_MONTH          8
+#define CMOS_RTC_YEAR           9
+
+/* drivers/cmos.c */
+u8 cmos_read(u8 addr);
+void cmos_write(u8 val, u8 addr);
+
 /* drivers/keyboard.c */
 int keyboard_havechar(void);
 unsigned char keyboard_get_scancode(void);
@@ -87,6 +99,10 @@
 void *calloc(size_t nmemb, size_t size);
 void *realloc(void *ptr, size_t size);
 
+/* libc/lib.c */
+int bcd2dec(int b);
+int dec2bcd(int d);
+
 /* libc/memory.c */
 void *memset(void *s, int c, size_t n);
 void *memcpy(void *dst, const void *src, size_t n);

Modified: trunk/payloads/libpayload/libc/Makefile.inc
===================================================================
--- trunk/payloads/libpayload/libc/Makefile.inc	2008-03-27 20:46:49 UTC
(rev 3191)
+++ trunk/payloads/libpayload/libc/Makefile.inc	2008-03-27 23:26:40 UTC
(rev 3192)
@@ -28,5 +28,4 @@
 ##
 
 TARGETS-y += libc/malloc.o libc/printf.o libc/console.o libc/string.o
-TARGETS-y += libc/memory.o libc/ctype.o
-TARGETS-y += libc/ipchecksum.o
+TARGETS-y += libc/memory.o libc/ctype.o libc/ipchecksum.o libc/lib.o

Added: trunk/payloads/libpayload/libc/lib.c
===================================================================
--- trunk/payloads/libpayload/libc/lib.c
(rev 0)
+++ trunk/payloads/libpayload/libc/lib.c	2008-03-27 23:26:40 UTC
(rev 3192)
@@ -0,0 +1,51 @@
+/*
+ * This file is part of the libpayload project.
+ *
+ * Copyright (C) 2008 Uwe Hermann <uwe at hermann-uwe.de>
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ * 1. Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
+ * 2. Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in
the
+ *    documentation and/or other materials provided with the
distribution.
+ * 3. The name of the author may not be used to endorse or promote
products
+ *    derived from this software without specific prior written
permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS''
AND
+ * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
THE
+ * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE
+ * ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE
LIABLE
+ * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
CONSEQUENTIAL
+ * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS
+ * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION)
+ * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
STRICT
+ * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY
+ * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
OF
+ * SUCH DAMAGE.
+ */
+
+/*
+ * Convert a number in BCD format to decimal.
+ *
+ * @param b The BCD number.
+ * @return The given BCD number in decimal format.
+ */
+int bcd2dec(int b)
+{
+	return ((b >> 4) & 0x0f) * 10 + (b & 0x0f);
+}
+
+/*
+ * Convert a number in decimal format into the BCD format.
+ *
+ * @param d The decimal number.
+ * @return The given decimal number in BCD format.
+ */
+int dec2bcd(int d)
+{
+	return ((d / 10) << 4) | (d % 10);
+}
+




------------------------------

_______________________________________________
coreboot mailing list
coreboot at coreboot.org
http://www.coreboot.org/mailman/listinfo/coreboot

End of coreboot Digest, Vol 37, Issue 181
*****************************************






More information about the coreboot mailing list