diff options
author | Greg Watson <jarrah@users.sourceforge.net> | 2004-03-13 03:09:57 +0000 |
---|---|---|
committer | Greg Watson <jarrah@users.sourceforge.net> | 2004-03-13 03:09:57 +0000 |
commit | b9f5c112ccd0e39b0652ba8496e2ebd0cb0c5fb8 (patch) | |
tree | 1c81c096a253ab9cd1b5d3e6a76ce952d100f164 /src/stream/ide_stream.c | |
parent | fc2ae8ee9f3b90876d30d80ffedaefa3fcb243f2 (diff) |
filesystem support
git-svn-id: svn://svn.coreboot.org/coreboot/trunk@1398 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
Diffstat (limited to 'src/stream/ide_stream.c')
-rw-r--r-- | src/stream/ide_stream.c | 31 |
1 files changed, 5 insertions, 26 deletions
diff --git a/src/stream/ide_stream.c b/src/stream/ide_stream.c index 0db2ac9089..0dd9a91258 100644 --- a/src/stream/ide_stream.c +++ b/src/stream/ide_stream.c @@ -4,10 +4,11 @@ #include <stream/read_bytes.h> #include <delay.h> #include <string.h> +#include <pc80/ide.h> -/* read a sector or a partial sector */ -extern int ide_read(int drive, unsigned long block, void * buffer); -extern int ide_init(void); +#ifndef IDE_BOOT_DRIVE +#define IDE_BOOT_DRIVE 0 +#endif static unsigned long offset; int stream_init(void) @@ -30,7 +31,7 @@ int stream_init(void) #else offset = 0x7e00; #endif - res = ide_init(); + res = ide_probe(IDE_BOOT_DRIVE); delay(1); return res; } @@ -40,27 +41,9 @@ void stream_fini(void) return; } -#ifdef IDE_SWAB -/* from string/swab.c */ -void -swab (const char *from, char *to, int n) -{ - n &= ~1; - while (n > 1) - { - const char b0 = from[--n], b1 = from[--n]; - to[n] = b0; - to[n + 1] = b1; - } -} -#endif - static unsigned char buffer[512]; static unsigned int block_num = 0; static unsigned int first_fill = 1; -#ifndef IDE_BOOT_DRIVE -#define IDE_BOOT_DRIVE 0 -#endif static byte_offset_t stream_ide_read(void *vdest, byte_offset_t offset, byte_offset_t count) { byte_offset_t bytes = 0; @@ -84,11 +67,7 @@ static byte_offset_t stream_ide_read(void *vdest, byte_offset_t offset, byte_off len = (count - bytes); } -#ifdef IDE_SWAB - swab(buffer + byte_offset, dest, len); -#else memcpy(dest, buffer + byte_offset, len); -#endif offset += len; bytes += len; |