[OpenBIOS] [commit] r838 - trunk/openbios-devel/libc

repository service svn at openbios.org
Sat Aug 7 14:49:50 CEST 2010


Author: blueswirl
Date: Sat Aug  7 14:49:50 2010
New Revision: 838
URL: http://tracker.coreboot.org/trac/openbios/changeset/838

Log:
diskio: add debugging

Signed-off-by: Blue Swirl <blauwirbel at gmail.com>

Modified:
   trunk/openbios-devel/libc/diskio.c

Modified: trunk/openbios-devel/libc/diskio.c
==============================================================================
--- trunk/openbios-devel/libc/diskio.c	Sat Aug  7 14:05:02 2010	(r837)
+++ trunk/openbios-devel/libc/diskio.c	Sat Aug  7 14:49:50 2010	(r838)
@@ -18,6 +18,14 @@
 #include "libopenbios/bindings.h"
 #include "libc/diskio.h"
 
+//#define CONFIG_DEBUG_DISKIO
+#ifdef CONFIG_DEBUG_DISKIO
+#define DPRINTF(fmt, args...)                   \
+    do { printk(fmt , ##args); } while (0)
+#else
+#define DPRINTF(fmt, args...)
+#endif
+
 typedef struct {
 	ihandle_t ih;
 	int	do_close;
@@ -73,6 +81,7 @@
 	fdp->do_close = 0;
 
 	file_descriptors[fd]=fdp;
+        DPRINTF("%s(0x%lx) = %d\n", __func__, (unsigned long)ih, fd);
 	return fd;
 }
 
@@ -83,6 +92,7 @@
 	ihandle_t ih = open_dev( spec );
 	priv_fd_t *fdp;
 
+        DPRINTF("%s(%s)\n", __func__, spec);
 	if( !ih )
 		return -1;
 
@@ -110,6 +120,7 @@
 	call_package( fdp->reopen_xt, fdp->ih );
         ret = (POP() == (ucell)-1)? 0 : -1;
 
+        DPRINTF("%s(%d, %s) = %d\n", __func__, fd, filename, ret);
 	return ret;
 }
 
@@ -118,6 +129,7 @@
 {
 	priv_fd_t *fdp = file_descriptors[fd];
 
+        DPRINTF("%s(%d)\n", __func__, fd);
 	if( lookup_xt(fdp->ih, "open-nwrom", &fdp->open_nwrom_xt) )
 		return -1;
 	call_package( fdp->open_nwrom_xt, fdp->ih );
@@ -167,6 +179,7 @@
 	priv_fd_t *fdp;
 	ucell ret;
 
+        DPRINTF("%s(%d, %p, %u)\n", __func__, fd, buf, cnt);
 	if (fd != -1) {
 		fdp = file_descriptors[fd];
 
@@ -189,6 +202,7 @@
 {
 	priv_fd_t *fdp;
 
+        DPRINTF("%s(%d, %lld)\n", __func__, fd, offs);
 	if (fd != -1) {
 		fdp = file_descriptors[fd];
 		
@@ -210,6 +224,7 @@
 		return -1;
 	call_package( fdp->tell_xt, fdp->ih );
 	offs = DPOP();
+        DPRINTF("%s(%d) = %lld\n", __func__, fd, offs);
 	return offs;
 }
 
@@ -218,6 +233,7 @@
 {
 	priv_fd_t *fdp;
 
+        DPRINTF("%s(%d)\n", __func__, fd);
 	if (fd != -1) {
 		fdp = file_descriptors[fd];
 



More information about the OpenBIOS mailing list