You can subscribe to this list here.
2001 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(79) |
Aug
(27) |
Sep
(64) |
Oct
(202) |
Nov
(31) |
Dec
(59) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(125) |
Feb
(173) |
Mar
(13) |
Apr
(140) |
May
(75) |
Jun
(1) |
Jul
(37) |
Aug
(14) |
Sep
|
Oct
(20) |
Nov
(9) |
Dec
(2) |
2003 |
Jan
(51) |
Feb
(12) |
Mar
(18) |
Apr
(24) |
May
(1) |
Jun
|
Jul
|
Aug
(72) |
Sep
(12) |
Oct
(18) |
Nov
(60) |
Dec
(26) |
2004 |
Jan
(1) |
Feb
(40) |
Mar
(3) |
Apr
(3) |
May
|
Jun
(1) |
Jul
(4) |
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(1) |
2005 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(1) |
Dec
(5) |
2006 |
Jan
(13) |
Feb
(5) |
Mar
(8) |
Apr
(13) |
May
(7) |
Jun
(6) |
Jul
(10) |
Aug
(6) |
Sep
(6) |
Oct
(35) |
Nov
(20) |
Dec
(10) |
2007 |
Jan
(13) |
Feb
(9) |
Mar
(2) |
Apr
(1) |
May
(1) |
Jun
(2) |
Jul
(2) |
Aug
(3) |
Sep
(1) |
Oct
|
Nov
(1) |
Dec
(1) |
2008 |
Jan
|
Feb
|
Mar
(1) |
Apr
(4) |
May
(1) |
Jun
|
Jul
|
Aug
(2) |
Sep
(1) |
Oct
|
Nov
|
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(54) |
Jun
(78) |
Jul
(35) |
Aug
(21) |
Sep
(21) |
Oct
(29) |
Nov
(10) |
Dec
(5) |
2010 |
Jan
|
Feb
|
Mar
(26) |
Apr
(55) |
May
(73) |
Jun
(63) |
Jul
(38) |
Aug
(39) |
Sep
(19) |
Oct
(2) |
Nov
(1) |
Dec
(1) |
2011 |
Jan
(2) |
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
From: Stefan E. <se...@us...> - 2002-05-09 13:27:08
|
Update of /cvsroot/blob/blob/src/blob In directory usw-pr-cvs1:/tmp/cvs-serv10045 Modified Files: flash.c Log Message: - flash_get_size() added. Returns total flash size. Index: flash.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/flash.c,v retrieving revision 1.17 retrieving revision 1.18 diff -u -d -r1.17 -r1.18 --- flash.c 2 May 2002 04:16:58 -0000 1.17 +++ flash.c 9 May 2002 13:27:05 -0000 1.18 @@ -214,6 +214,20 @@ } +/* get the flash size + * + */ +u32 flash_get_size( void ) +{ + int block; + u32 size = 0L; + + for ( block=0; block<num_flash_blocks; block++ ) { + size += flash_blocks[block].size; + } + + return size; +} /* Write a flash region with a minimum number of erase operations. |
From: Stefan E. <se...@us...> - 2002-05-09 13:26:25
|
Update of /cvsroot/blob/blob/src/blob In directory usw-pr-cvs1:/tmp/cvs-serv9879 Modified Files: load_kernel.c Log Message: - fixed warning Index: load_kernel.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/load_kernel.c,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -r1.8 -r1.9 --- load_kernel.c 2 May 2002 04:16:58 -0000 1.8 +++ load_kernel.c 9 May 2002 13:26:21 -0000 1.9 @@ -87,7 +87,7 @@ part.offset = (char *) KERNEL_FLASH_BASE; part.size = KERNEL_FLASH_LEN; #endif - part.erasesize = flash_get_block_size(part.offset); + part.erasesize = flash_get_block_size((u32)part.offset); for (i = 0; loader[i] && !loader[i]->check_magic(&part); i++) ; |
From: Stefan E. <se...@us...> - 2002-05-09 12:22:24
|
Update of /cvsroot/blob/blob/src/blob In directory usw-pr-cvs1:/tmp/cvs-serv24730 Modified Files: partition.c Log Message: - bugfix for pt_find_by_name() Index: partition.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/partition.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- partition.c 19 Mar 2002 21:08:38 -0000 1.4 +++ partition.c 9 May 2002 12:22:22 -0000 1.5 @@ -324,7 +324,7 @@ return NULL; case BLOB_PART_VALID_MAGIC: - if(strncmp(t->name, s, BLOB_PART_NAMELEN)) + if(strncmp(t->name, s, BLOB_PART_NAMELEN)==0) return t; break; |
From: Stefan E. <se...@us...> - 2002-05-09 11:42:27
|
Update of /cvsroot/blob/blob/src/lib In directory usw-pr-cvs1:/tmp/cvs-serv16006 Modified Files: generic_io.c Log Message: - bounds checking in io_read() and io_write() - RAM pools are board specific. Remove initialization from here. Index: generic_io.c =================================================================== RCS file: /cvsroot/blob/blob/src/lib/generic_io.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- generic_io.c 8 May 2002 14:02:35 -0000 1.3 +++ generic_io.c 9 May 2002 11:42:23 -0000 1.4 @@ -48,7 +48,7 @@ #define IO_MODULE_TEST 1 #define IO_DEBUG 1 -#ifdef IO_DEBUG +#if IO_DEBUG # define DBG( x, args... ) if ( io_dbg>x ) printf( args ) # define DBGIO( x, io ) if ( io_dbg>x ) printf( "%s: " \ "%s(%p)={ c=%p, r=%p, w=%p,\n\tp=%p, sz=%d, ch=%p,\n\tn='%s' }\n", \ @@ -85,6 +85,7 @@ /********************************************************************** * Prototypen */ +static int ram_io_conf( io_driver_t * io, void *conf ); static int ram_io_read( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *io ); static int ram_io_write( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *io ); @@ -154,10 +155,15 @@ if ( !name ) return NULL; +#if IO_DEBUG + for ( i=0; i<IO_MAX_DRIVER;i++) { + DBG( 1, "%s: #%d %p: '%s'\n", __FUNCTION__, + i, drivers[i], drivers[i]?io_get_name( drivers[i] ):"(NULL)" ); + } +#endif + for ( i=0; i<IO_MAX_DRIVER;i++) { if (drivers[i]) { - DBG( 1, "%s: #%d '%s'\n", __FUNCTION__, - i, io_get_name( drivers[i] ) ); if ( strncmp( io_get_name( drivers[i] ), name, IO_NAME_LEN ) == 0 ) return drivers[i]; } @@ -203,7 +209,11 @@ if ( !rd || !rd->read ) return -EINVAL; - /* FIXME: check bounds */ + /* check bounds */ + if ( (io_get_size( rd ) - (size_t)src) < amount ) { + DBG( 1, "%s: out of bounds!\n", __FUNCTION__ ); + return -ERANGE; + } return rd->read( dest, src, amount, rd ); } @@ -218,7 +228,11 @@ if ( !rd|| !rd->write ) return -EINVAL; - /* FIXME: check bounds */ + /* check bounds */ + if ( (io_get_size( rd ) - (size_t)dest) < amount ) { + DBG( 1, "%s: out of bounds!\n", __FUNCTION__ ); + return -ERANGE; + } return rd->write( dest, src, amount, rd ); } @@ -277,36 +291,8 @@ /********************************************************************** * A simple RAM driver + * - io driver for RAM access */ - -void init_ram_default_io( void ) -{ - int ret; - static ram_io_t ram0, ram1; - static io_driver_t io_ram0, io_ram1; - - ram0.start=0xd0000000; - ram0.len=8*1024*1024; - ram0.pos=0; - - ram1.start=0xd0800000; - ram1.len=8*1024*1024; - ram1.pos=0; - - ret = ram_io_init( &io_ram0, &ram0 ); - if ( ret ) return; - - ret = ram_io_init( &io_ram1, &ram1 ); - if ( ret ) return; - - ret = io_register( &io_ram0, "RAM0" ); - if ( ret ) return; - - ret = io_register( &io_ram1, "RAM1" ); - if ( ret ) return; -} -__initlist(init_ram_default_io, INIT_LEVEL_OTHER_STUFF + 2); - int ram_io_init( io_driver_t *io, ram_io_t *ram ) { if ( !io || !ram ) @@ -322,7 +308,7 @@ return 0; } -int ram_io_conf( io_driver_t * io, void *conf ) +static int ram_io_conf( io_driver_t * io, void *conf ) { ram_io_t *ram; |
From: Stefan E. <se...@us...> - 2002-05-08 20:08:21
|
Update of /cvsroot/blob/blob/include/blob In directory usw-pr-cvs1:/tmp/cvs-serv13062 Modified Files: ide.h Log Message: - define for blocksize Index: ide.h =================================================================== RCS file: /cvsroot/blob/blob/include/blob/ide.h,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ide.h 8 May 2002 13:56:02 -0000 1.4 +++ ide.h 8 May 2002 19:14:57 -0000 1.5 @@ -21,6 +21,8 @@ #ifndef BLOB_IDE_H #define BLOB_IDE_H 1 +#define IDE_BLOCK_SIZE (512) + /* HDC Status Register Bit Masks (1F7h) */ #define BUSY 0x80 /* busy.. can't talk now! */ #define READY 0x40 /* Drive Ready */ |
From: Stefan E. <se...@us...> - 2002-05-08 20:08:21
|
Update of /cvsroot/blob/blob/include/blob/arch In directory usw-pr-cvs1:/tmp/cvs-serv12718/arch Modified Files: system3.h Log Message: - defines for blob partitions Index: system3.h =================================================================== RCS file: /cvsroot/blob/blob/include/blob/arch/system3.h,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- system3.h 23 Apr 2002 12:25:16 -0000 1.15 +++ system3.h 8 May 2002 19:14:10 -0000 1.16 @@ -30,14 +30,14 @@ #undef CPU_SPEED_133 /* SYSTEM3 with 64 MB SDRAM, all on bank0 */ -#define CONFIG_SYSTEM3_REV0802 +#undef CONFIG_SYSTEM3_REV0802 +//#define CONFIG_SYSTEM3_REV0802 /* boot CPU speed */ #ifdef CPU_SPEED_133 # define CPU_SPEED (CPU_CORE_SPEED_132mhz) #else -/* 191 MHz */ -# define CPU_SPEED (CPU_CORE_SPEED_221mhz) +# define CPU_SPEED (CPU_CORE_SPEED_206mhz) #endif /* serial port */ @@ -45,7 +45,7 @@ #define TERMINAL_SPEED baud_115200 /* GPIO for the LED */ -#define LED_GPIO (0x00000400) /* GPIO 10 */ +#define LED_GPIO (0x00000000) /* GPIO 10 */ /* the base address were BLOB is loaded by the first stage loader */ @@ -64,11 +64,15 @@ #define BLOB_FLASH_LEN (256 * 1024) #define PARAM_FLASH_BASE (0x00040000) #define PARAM_FLASH_LEN (256 * 1024) +#define CONFIG_FLASH_BASE (0x00040000) +#define CONFIG_FLASH_LEN (256 * 1024) #define KERNEL_FLASH_BASE (0x00080000) #define KERNEL_FLASH_LEN (1024 * 1024) #define LOAD_RAMDISK 1 /* load ramdisk into ram */ #define RAMDISK_FLASH_BASE (0x00180000) -#define RAMDISK_FLASH_LEN (4 * 1024 * 1024) +#define RAMDISK_FLASH_LEN (1536 * 1024) +#define CRAMFS_FLASH_BASE (0x00300000) +#define CRAMFS_FLASH_LEN (13312 * 1024) /* the position of the kernel boot parameters */ |
From: Stefan E. <se...@us...> - 2002-05-08 20:08:16
|
Update of /cvsroot/blob/blob/src/lib In directory usw-pr-cvs1:/tmp/cvs-serv13843 Modified Files: cf.c Log Message: - IDE_BLOCK_SIZE now in ide.h - calculate CF card size for io driver. The docs of my CF card says I've to use words 6+7 of the ID struct. Hope this is for other CF cards too ... Index: cf.c =================================================================== RCS file: /cvsroot/blob/blob/src/lib/cf.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- cf.c 8 May 2002 14:01:18 -0000 1.3 +++ cf.c 8 May 2002 19:18:40 -0000 1.4 @@ -54,8 +54,6 @@ # define DBG( x, args... ) #endif -#define IDE_BLOCK_SIZE 512 - /********************************************************************** * module globals */ @@ -182,8 +180,6 @@ if ( ret ) return -EINVAL; - - ret = 0; DONE: if ( ret != 0 ) { @@ -234,6 +230,8 @@ int cf_io_conf( io_driver_t *io, void *conf ) { + int ret; + DBG( 5, "%s: io=%p, conf=%p\n", __FUNCTION__, io, conf ); @@ -243,9 +241,17 @@ cf_slot = (int)conf; DBG( 5, "%s: cf_slot=%d\n", __FUNCTION__, cf_slot ); + ret = cf_init( cf_slot ); + if ( ret ) + return -EINVAL; + io->private_data = (void *)cf_slot; - return cf_init( cf_slot ); + /* FIXME: is this ok? How to calculate the correct size? */ + io->io_size = (drive.driveid.vendor0 | (drive.driveid.vendor1 << 16)) * IDE_BLOCK_SIZE; + DBG( 1, "%s: io_size=%d\n", __FUNCTION__, io_get_size( io ) ); + + return 0; } static int cf_io_read( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *io ) |
From: Stefan E. <se...@us...> - 2002-05-08 20:08:15
|
Update of /cvsroot/blob/blob/src/lib In directory usw-pr-cvs1:/tmp/cvs-serv13399 Modified Files: ide.c Log Message: - use blocksize define - calculate disk size Index: ide.c =================================================================== RCS file: /cvsroot/blob/blob/src/lib/ide.c,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -r1.5 -r1.6 --- ide.c 8 May 2002 13:55:28 -0000 1.5 +++ ide.c 8 May 2002 19:16:04 -0000 1.6 @@ -22,28 +22,6 @@ * * $Id$ * - * $Log$ - * Revision 1.5 2002/05/08 13:55:28 seletz - * - added ide_setfeature() to set ide features - * - * Revision 1.4 2002/04/27 04:59:59 timriker - * turn on ide and pcmcia again, fix pcmcia compiles (but not features) for non sa1111 systems - * - * Revision 1.3 2002/04/26 09:22:05 seletz - * - added original copyright from Brad Parker - * - corrected EMAIL addr - * - * Revision 1.2 2002/04/24 14:27:08 seletz - * - first round of bugfixing. Now at last one can read 512 byte sectors - * of a CF in true-ide mode. See system3.c::pcmciatest(). - * - * Still WIP. YMMV, and so on.... - * - * Revision 1.1 2002/04/18 19:52:49 seletz - * - Added PCMCIA and IDE framework. Based on Brad Parker's code. - * NOTE NOTE NOTE: - * This is all Work-In-Progress (you have been warned) - * */ /********************************************************************** @@ -222,7 +200,7 @@ struct hd_driveid *id; volatile u8 *port = NULL; volatile u8 *reg = NULL; - static char id_buffer[512]; + static char id_buffer[IDE_BLOCK_SIZE]; if ( !drive || !drive->ide_port ) return -1; @@ -240,6 +218,7 @@ printf("ide: model: '%s'\n", id->model); printf("ide: CHS: %d/%d/%d\n", id->cyls, id->heads, id->sectors); + printf("ide: lba_capacity %d (total %d bytes)\n", id->lba_capacity, id->lba_capacity*IDE_BLOCK_SIZE); if (id->sectors && id->heads) { drive->disk_sectors_per_track = id->sectors; @@ -343,7 +322,7 @@ hd_busy_wait(port); - for (i = 0; i < 512; i++) { + for (i = 0; i < IDE_BLOCK_SIZE; i++) { buffer[i] = port[0]; barrier(); } @@ -451,7 +430,7 @@ hd_busy_wait(port); - for (i = 0; i < 512; i++) { + for (i = 0; i < IDE_BLOCK_SIZE; i++) { barrier(); buffer[i] = port[0]; } |
From: Stefan E. <se...@us...> - 2002-05-08 19:23:19
|
Update of /cvsroot/blob/blob/src/blob In directory usw-pr-cvs1:/tmp/cvs-serv14976 Modified Files: system3.c Log Message: - removed dead code - debuglevel & command to set - added io driver for blob partitions. Now one can do a direct io_copy() from/to blob partitions, see io_cmd(). NOTE: Due to a bug in blob/src/blob/partition.c the partition io driver does not work correctly. I'm debugging partition.c ATM. The partition io driver will not stay in system3.c, once it's tested enough it will go in a separate file. Index: system3.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/system3.c,v retrieving revision 1.16 retrieving revision 1.17 diff -u -d -r1.16 -r1.17 --- system3.c 8 May 2002 16:02:53 -0000 1.16 +++ system3.c 8 May 2002 19:23:16 -0000 1.17 @@ -85,7 +85,14 @@ #define SYSTEM3_DEBUG 1 #if SYSTEM3_DEBUG -# define _DBG( fmt, args... ) printf("%s(): " fmt, __FUNCTION__ , ## args) +# define DBG( x, args... ) if ( sys3_dbg>x ) printf( args ) +# define DBGIO( x, io ) if ( sys3_dbg>x ) printf( "%s: " \ + "%s(%p)={ c=%p, r=%p, w=%p,\n\tp=%p, sz=%d, ch=%p,\n\tn='%s' }\n", \ + __FUNCTION__, #io, io, io->conf, io->read, io->write, \ + io->private_data, io->io_size, io->child_io, io->name ); +#else +# define DBG( x, args... ) +# define DBGIO( x, io ) #endif @@ -99,6 +106,12 @@ * module globals */ +#if SYSTEM3_DEBUG +static int sys3_dbg = 1; +#else +static int sys3_dbg = 0; +#endif + /* flash descriptor for System3 flash. */ /* System 3 uses 2xINTEL e28F640 Chips */ static const flash_descriptor_t system3_flash_descriptors[] = @@ -128,6 +141,12 @@ 0x00300000 CRAMFS 13312k 0x01000000 +Note: + - system3 partitions are named like the files they're flashed + with. This is to keep updating easy: Just loop through all + files that are on our update media and flash them on the partition + named like the file. + */ static const blob_partition_t system3_default_partition_table[] = { { @@ -262,6 +281,39 @@ /* FIXME: need to think if this is the correct init level, we might * want to have this before the param list stuff starts running */ +/********************************************************************** + * init system3 ram pools + */ +void init_ram_default_io( void ) +{ + int ret; + static ram_io_t ram0, ram1; + static io_driver_t io_ram0, io_ram1; + + /* define 2 pools to play with, each 8 Mb */ + ram0.start=0xd0000000; + ram0.len=8*1024*1024; + ram0.pos=0; + + ram1.start=0xd0800000; + ram1.len=8*1024*1024; + ram1.pos=0; + + ret = ram_io_init( &io_ram0, &ram0 ); + if ( ret ) return; + + ret = ram_io_init( &io_ram1, &ram1 ); + if ( ret ) return; + + ret = io_register( &io_ram0, "RAM0" ); + if ( ret ) return; + + ret = io_register( &io_ram1, "RAM1" ); + if ( ret ) return; +} +__initlist(init_ram_default_io, INIT_LEVEL_OTHER_STUFF + 2); + + /***************************************************************** * sysver - print system version */ @@ -273,14 +325,33 @@ static char sysver_help[] = "print BLOB and system3 version number\n"; __commandlist(sysver_cmd, "sysver", sysver_help); +/********************************************************************** + * sys3dbg - set system3 debug level + */ +int sys3dbg_cmd( int argc, char *argv[] ) +{ + int ret; + u32 lvl; + + if ( argc < 2 ) return -EINVAL; + + ret = strtou32(argv[1], &lvl); + if ( ret < 0 ) return -EINVAL; + + sys3_dbg = lvl; + printf( "sys3dbg: debug level set to %d\n", sys3_dbg ); + + return 0; +} +static char sys3dbg_help[] = "sys3dbg level\n"; +__commandlist(sys3dbg_cmd, "sys3dbg", sys3dbg_help); + /***************************************************************** * sa1111_init - initialize companion chip */ static void sa1111_init() { - _DBG( "%s", "START\n" ); - /* * First, set up the 3.6864MHz clock on GPIO 27 for the SA-1111: * (SA-1110 Developer's Manual, section 9.1.2.1) @@ -316,11 +387,6 @@ * Ensure all clocks are initially off. */ SKPCR = 0; - - printf( "SA1111 ID: %08x\n", SBI_SKID ); - - - _DBG( "%s", "DONE\n" ); } #if defined(CONFIG_PCMCIA_SUPPORT) @@ -331,15 +397,6 @@ { printf( "PT Digital Board PCMCIA init\n" ); sa1111_init(); -#if SYSTEM3_DEBUG - printf( "MECR=0x%08x\n", MECR ); - printf( "MSC0=0x%08x\n", MSC0 ); - printf( "MSC1=0x%08x\n", MSC1 ); - printf( "MSC2=0x%08x\n", MSC2 ); - printf( "SA1111_BASE=0x%08x\n", SA1111_VBASE ); - printf( "SBI_SMCR=0x%08x\n", SBI_SMCR ); - printf( "SBI_SKID=0x%08x\n", SBI_SKID ); -#endif return 0; } @@ -361,9 +418,6 @@ char buffer[4096]; - /* set ata debg level high */ - //ataio_dbg_set( 5 ); - ret = pcmcia_init(); if ( ret != 0 ) ERR( -EINVAL ); @@ -426,9 +480,6 @@ printf( "slot %d enabled\n", slot ); - //ret = pcmcia_slot_cfg_reg_get( slot, &cfg_reg ); - //if ( ret != 0 ) ERR( -EINVAL ); - ret = ide_init( &drive, (u32)slot_base ); if ( ret != 0 ) ERR( -EINVAL ); @@ -448,42 +499,6 @@ } #endif -#if 0 - printf( "slot %d base address: %x\n", slot, (u32)slot_base ); - printf( "slot %d config register: %x\n", slot, 0x1f0 ); - - pio_set_iobase_addr( (u32)slot_base, (u32)slot_base + 0x1f0 ); - printf( "\nUsing I/O base addresses %x and %x.\n", - (u32)slot_base, (u32)slot_base + 0x1f0 ); - - /* 2) find out what devices are present -- this is the step */ - /* many driver writers ignore. You really can't just do */ - /* resets and commands without first knowing what is out there. */ - /* Even if you don't care the driver does care. */ - numDev = reg_config(); - printf( "\nFound %d devices on this ATA interface:\n", numDev ); - printf( " Device 0 type is %s.\n", devTypeStr[ reg_config_info[0] ] ); - printf( " Device 1 type is %s.\n", devTypeStr[ reg_config_info[1] ] ); - - /* that's the basics, now do some stuff in polling mode */ - - /* do an ATA soft reset (SRST) and return the command block */ - /* regs for device 0 in struct reg_cmd_info */ - printf( "Soft Reset...\n" ); - ret = reg_reset( 0, 0 ); - if ( ret ) ERR( -EINVAL ); - - ret = reg_pio_data_in( - 0, CMD_IDENTIFY_DEVICE, - 0, 0, - 0, 0, 0, - buffer, - 1, 0 - ); - if ( ret != 0 ) ERR( -EINVAL ); - dumpmem( buffer, 512 ); -#endif - ret = pcmcia_dump_stati(); if ( ret != 0 ) ERR( -EINVAL ); @@ -498,99 +513,11 @@ __commandlist(pcmcia_test, "pcmciatest", pcmciahelp); #endif -/***************************************************************** - * misc utility funcs - */ -static char tohex(char b) -{ - b = b & 0xf; - if (b < 10) return '0' + b; - return 'a' + (b - 10); -} - -static void dumpmem(char *ptr, int len) -{ - char line[80], chars[80], *p, b, *c, *end; - int j; - - end = ptr + len; - while (ptr < end) { - SerialOutputHex((int)ptr); - p = line; - c = chars; - - *p++ = ' '; - for (j = 0; j < 16; j++) { - b = *ptr++; - *p++ = tohex(b >> 4); - *p++ = tohex(b); - *p++ = ' '; - *c++ = ' ' <= b && b <= '~' ? b : '.'; - } - *p = 0; - SerialOutputString(line); - *c = 0; - SerialOutputString(chars); - serial_write('\n'); - } -} int tar_cmd( int argc, char *argv[] ) { -#if 0 - int ret = 0; - u32 start = 0; - u32 dest = 0; - tar_arch_t my_arch; - - tar_dbg_set( 100 ); - - if ( argc<3 ) ERR( -EINVAL ); - - ret = strtou32(argv[2], &start); - if ( ret < 0 ) ERR( -EINVAL ); - - arch_adr.start = (unsigned char *)start; - ret = tar_init( &my_arch, mem_block_get, mem_block_reset, &arch_adr ); - if ( ret ) { - printf( "tar_init: %d\n", ret ); - goto DONE; - } - - switch (argv[1][0]) { - case 't': - case 'T': - ret = tar_tell( &my_arch ); - if ( ret ) { - printf( "tar_tell: %d\n", ret ); - goto DONE; - } - break; - case 'x': - case 'X': - if ( argc<4 ) ERR( -EINVAL ); - - ret = strtou32(argv[4], &dest); - if ( ret < 0 ) ERR( -EINVAL ); - - _DBG( "dest=%p\n", (unsigned char *)dest ); - _DBG( "filename=%s\n", argv[3] ); - - ret = tar_xtract( &my_arch, argv[3], (unsigned char *)dest ); - if ( ret ) { - printf( "tar_xtract: %d\n", ret ); - goto DONE; - } - dumpmem( (unsigned char*)dest, 0x200 ); - break; - } - -DONE: - return ret; -#else /* FIXME: rewrite using io drivers */ return -EINVAL; -#endif } static char tar_help[] = "tar [t|x] src [filename dest]\n"; __commandlist(tar_cmd, "tar", tar_help); @@ -599,21 +526,20 @@ int io_cmd( int argc, char *argv[] ) { int ret; - io_driver_t *iotar, *ioram1, *iocf; + io_driver_t *iotar, *ioram1, *iocf, *iopart; char buffer[1024]; - + io_dbg_set( 100 ); tar_dbg_set( 100 ); -#if 0 - ret = io_test(); - if ( ret ) return -EINVAL; -#endif - ioram1 = io_get_byname( "RAM1" ); if ( !ioram1 ) return -EINVAL; printf( "found 'RAM1': %p\n", ioram1 ); + iopart = io_get_byname( "BLOB_PART" ); + if ( !iopart ) return -EINVAL; + printf( "found 'BLOB_PART': %p\n", iopart ); + iotar = io_get_byname( "TAR" ); if ( !iotar ) return -EINVAL; printf( "found 'TAR': %p\n", iotar ); @@ -629,29 +555,55 @@ return -EINVAL; } - ret = io_read( buffer, (unsigned char *)0, 1024, iocf ); - if ( ret ) { - printf( "io_read() error %d\n", ret ); - return -EINVAL; - } - ret = io_copy( ioram1, iocf, 1024 ); - if ( ret ) { - printf( "io_copy() error %d\n", ret ); - return -EINVAL; + { + /* just a test: read first two sectors ("virtual address" + 0x00000000-0x00001000) into a buffer */ + ret = io_read( buffer, (unsigned char *)0, 1024, iocf ); + if ( ret ) { + printf( "io_read() error %d\n", ret ); + return -EINVAL; + } + /* same as above, just use generic io to pool 1 */ + ret = io_copy( ioram1, iocf, 1024 ); + if ( ret ) { + printf( "io_copy() error %d\n", ret ); + return -EINVAL; + } } - /* have tar io driver reading from RAM0 io driver */ - //ret = io_chain_driver( "TAR", "RAM0" ); + /* have tar io driver reading from CF card io driver */ ret = io_chain_driver( "TAR", "CF" ); if ( ret ) return -EINVAL; + /* chain blob partition io driver to ram1 (simulate flash) */ + ret = io_chain_driver( "BLOB_PART", "RAM1" ); + if ( ret ) return -EINVAL; + /* select a file */ ret = io_configure( iotar, "system3.c" ); if ( ret ) return -EINVAL; printf( "selected file\n" ); + { + /* NOTE: partition.c code is buggy. The call below + * finds th "config" partition (which is next to the + * "blob" partition). I'm investigating ... + */ + const blob_partition_t *part; + part = pt_find_by_name( "blob" ); + DBG( 1, "%s: part=%p\n", __FUNCTION__, part ); + if ( part ) { + DBG( 1, "part->name=%s\n", part->name ); + } + } + + /* select a partition */ + ret = io_configure( iopart, "blob" ); + if ( ret ) return -EINVAL; + printf( "selected partition\n" ); + /* copy a file */ - ret = io_copy( ioram1, iotar, io_get_size( iotar ) ); + ret = io_copy( iopart, iotar, io_get_size( iotar ) ); if ( ret ) return -EINVAL; printf( "copied file\n" ); @@ -684,13 +636,173 @@ static char io_help[] = "io test function\n"; __commandlist(io_cmd, "iotest", io_help); -extern int cf_test_module( int argc, char *argv[] ); -extern char cf_help[]; -__commandlist(cf_test_module, "cftest", cf_help); +/********************************************************************** + * blob partition io driver + * + * - default blob partition is registered as a default io driver + * - the configure call "selects" a partition by it's name. + * (just like the tar io driver) + */ +int part_io_init( io_driver_t *io ); +static int part_io_conf( io_driver_t * io, void *conf ); +static int part_io_read( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *io ); +static int part_io_write( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *io ); + +/* register default blob partition io driver */ +void init_part_default_io( void ) +{ + int ret; + static io_driver_t io_part; + + ret = part_io_init( &io_part ); + if ( ret ) return ; + + ret = io_register( &io_part, "BLOB_PART" ); + if ( ret ) return; + + return; +} +__initlist(init_part_default_io, INIT_LEVEL_OTHER_STUFF + 3); + +/* initialize driver struct */ +int part_io_init( io_driver_t *io ) +{ + if ( !io ) + return -EINVAL; + + io->private_data = NULL; + io->io_size = 0; + io->conf = part_io_conf; + io->read = part_io_read; + io->write = part_io_write; + io->child_io = NULL; + + return 0; +} + +/* configure: select a partition by name */ +static int part_io_conf( io_driver_t * io, void *conf ) +{ + char *name; + const blob_partition_t *part; + + if ( !io || !conf ) + return -EINVAL; + + name = (char *)conf; + if ( !name ) + return -EINVAL; + + part = pt_find_by_name( name ); + if ( !part ) + return -EINVAL; + + DBG( 1, "%s: found partition '%s': offset=%x, size=%x, flags=%x\n", __FUNCTION__, + part->name, part->offset, part->size, part->flags ); + + + io->io_size=part->size; + io->private_data=(void*)part; + + return 0; +} + +static int part_io_read( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *io ) +{ + blob_partition_t *part; + io_driver_t *child; + + DBG( 1, "%s: dest=%p, src=%p, amount=%d, io=%p\n", __FUNCTION__, + dest, src, amount, io ); + + if ( !io || !dest ) + return -EINVAL; + + child = io_get_child( io ); + if ( !child ) + return -EINVAL; + + part = (blob_partition_t *)io->private_data; + if ( !part ) + return -EINVAL; + + DBG( 1, "%s: using partition '%s'.\n", __FUNCTION__, part->name ); + DBG( 1, "%s: dest=%p, src=%p(=%p), amount=%d, io=%p\n", __FUNCTION__, + dest, src, (void*)(src + part->offset), amount, io ); + + /* defer reading to our child */ + return io_read(dest, (void *)((u32)src + part->offset), amount, child); +} + +static int part_io_write( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *io ) +{ + blob_partition_t *part; + io_driver_t *child; + + + if ( !io || !src ) + return -EINVAL; + + child = io_get_child( io ); + if ( !child ) + return -EINVAL; + + part = (blob_partition_t *)io->private_data; + if ( !part ) + return -EINVAL; + + DBG( 1, "%s: using partition '%s'.\n", __FUNCTION__, part->name ); + DBG( 1, "%s: dest=%p(=%p), src=%p, amount=%d, io=%p\n", __FUNCTION__, + dest, (void*)(dest + part->offset), src, amount, io ); + + /* defer writing to our child */ + return io_write((void *)((u32)dest + part->offset), src, amount, child); +} + +/***************************************************************** + * misc utility funcs + */ +static char tohex(char b) +{ + b = b & 0xf; + if (b < 10) return '0' + b; + return 'a' + (b - 10); +} + +static void dumpmem(char *ptr, int len) +{ + char line[80], chars[80], *p, b, *c, *end; + int j; + + end = ptr + len; + while (ptr < end) { + SerialOutputHex((int)ptr); + p = line; + c = chars; + + *p++ = ' '; + for (j = 0; j < 16; j++) { + b = *ptr++; + *p++ = tohex(b >> 4); + *p++ = tohex(b); + *p++ = ' '; + *c++ = ' ' <= b && b <= '~' ? b : '.'; + } + *p = 0; + SerialOutputString(line); + *c = 0; + SerialOutputString(chars); + serial_write('\n'); + } +} /***************************************************************** * manually reference flash and download commands until they * are in libblob. */ +extern int cf_test_module( int argc, char *argv[] ); +extern char cf_help[]; +__commandlist(cf_test_module, "cftest", cf_help); + extern int fwrite_cmd(int argc, char *argv[]); extern char fwrite_help[]; __commandlist(fwrite_cmd, "fwrite", fwrite_help); |
From: Stefan E. <se...@us...> - 2002-05-08 16:08:10
|
Update of /cvsroot/blob/blob/src/blob In directory usw-pr-cvs1:/tmp/cvs-serv17541 Modified Files: system3.c Log Message: - added default partition table. Copied from lart.c (thanks erik!) Index: system3.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/system3.c,v retrieving revision 1.15 retrieving revision 1.16 diff -u -d -r1.15 -r1.16 --- system3.c 8 May 2002 14:05:44 -0000 1.15 +++ system3.c 8 May 2002 16:02:53 -0000 1.16 @@ -43,6 +43,7 @@ #include <blob/uucodec.h> #include <blob/serial.h> #include <blob/time.h> +#include <blob/partition.h> #include <blob/sa1100.h> #include <blob/sa1111.h> @@ -112,6 +113,84 @@ }, }; +/* default partition table for SYSTEM3 + +System3 flash layout +~~~~~~~~~~~~~~~~~~~~ + +16Mb Flash +256k erase size + +0x00000000 BLOB 256k +0x00040000 CONFIG 256k +0x00080000 KERNEL 1024k +0x00180000 INITRD 1536k +0x00300000 CRAMFS 13312k +0x01000000 + + */ +static const blob_partition_t system3_default_partition_table[] = { + { + /* start of table */ + magic: BLOB_DEFAULT_PART_TABLE_MAGIC, + next: sizeof(blob_partition_t), + offset: 0x00000000, /* absolute base address */ + size: 16 * 1024 * 1024 /* total size of the flash */ + }, + { + /* blob itself */ + magic: BLOB_PART_VALID_MAGIC, + next: sizeof(blob_partition_t), + offset: BLOB_FLASH_BASE, + size: BLOB_FLASH_LEN, + name: "blob", + mem_base: BLOB_RAM_BASE + }, + { + /* system config area */ + magic: BLOB_PART_VALID_MAGIC, + next: sizeof(blob_partition_t), + offset: CONFIG_FLASH_BASE, + size: CONFIG_FLASH_LEN, + name: "config", + flags: 0 + }, + { + /* kernel */ + magic: BLOB_PART_VALID_MAGIC, + next: sizeof(blob_partition_t), + offset: KERNEL_FLASH_BASE, + size: KERNEL_FLASH_LEN, + name: "zImage", + flags: BLOB_PART_FLAG_LOAD | BLOB_PART_FLAG_EXEC, + mem_base: KERNEL_RAM_BASE, + entry_point: KERNEL_RAM_BASE + }, + { + /* ramdisk */ + magic: BLOB_PART_VALID_MAGIC, + next: sizeof(blob_partition_t), + offset: RAMDISK_FLASH_BASE, + size: RAMDISK_FLASH_LEN, + name: "initrd.gz", + flags: BLOB_PART_FLAG_LOAD, + mem_base: RAMDISK_RAM_BASE + }, + { + /* root (cramfs) */ + magic: BLOB_PART_VALID_MAGIC, + next: sizeof(blob_partition_t), + offset: CRAMFS_FLASH_BASE, + size: CRAMFS_FLASH_LEN, + name: "cramfs.img", + flags: BLOB_PART_FLAG_CRAMFS, + }, + { + /* last entry */ + magic: BLOB_PART_LAST_MAGIC + } +}; + /********************************************************************** * static functions */ @@ -163,6 +242,25 @@ serial_driver = &sa11x0_serial_driver; } __initlist(system3_init_hardware, INIT_LEVEL_DRIVER_SELECTION); + +/********************************************************************** + * system3 default partition table + */ +static void system3_set_partition_table(void) +{ + /* the default partition table */ + default_partition_table = system3_default_partition_table; + + /* we don't know where the flash partition table will live, so + * put the pointer at 0x0000000 and let the partition table + * parser figure out. + */ + flash_partition_table = (blob_partition_t*)0x00000000; +} + +__initlist(system3_set_partition_table, INIT_LEVEL_OTHER_STUFF); +/* FIXME: need to think if this is the correct init level, we might + * want to have this before the param list stuff starts running */ /***************************************************************** * sysver - print system version |
From: Stefan E. <se...@us...> - 2002-05-08 15:37:42
|
Update of /cvsroot/blob/blob In directory usw-pr-cvs1:/tmp/cvs-serv4652 Modified Files: AUTHORS Log Message: - corrected email address Index: AUTHORS =================================================================== RCS file: /cvsroot/blob/blob/AUTHORS,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -r1.7 -r1.8 --- AUTHORS 11 Feb 2002 16:43:51 -0000 1.7 +++ AUTHORS 8 May 2002 15:37:39 -0000 1.8 @@ -51,12 +51,12 @@ * PT system 3 port ================== -- Stefan Eletzhofer <ste...@ww...> +- Stefan Eletzhofer <ste...@el...> * Memory tester =============== -- Stefan Eletzhofer <ste...@ww...> +- Stefan Eletzhofer <ste...@el...> * Ipaq H3600 port |
From: Stefan E. <se...@us...> - 2002-05-08 14:08:03
|
Update of /cvsroot/blob/blob/src/lib In directory usw-pr-cvs1:/tmp/cvs-serv17359 Modified Files: cf.c Log Message: - set CF to 8-bit-mode, PIO - initialize CF card on socket 1 as "CF" by default. - BUGFIX: src address NULL is ok for cf_io_read() - This code now seems to work. Reads correct sectors, and works together with the tar io driver. Correctly extracts files from a raw tar archive on /dev/hda. Yeah! Index: cf.c =================================================================== RCS file: /cvsroot/blob/blob/src/lib/cf.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- cf.c 3 May 2002 16:02:22 -0000 1.2 +++ cf.c 8 May 2002 14:01:18 -0000 1.3 @@ -170,10 +170,20 @@ if ( ret ) return -EINVAL; + ret = ide_setfeature( &drive, IDE_FEAT_8BITON, 0 ); + if ( ret ) + return -EINVAL; + + ret = ide_setfeature( &drive, IDE_FEAT_IOMODE, IDE_IOM_PIO ); + if ( ret ) + return -EINVAL; + ret = ide_status_dump( &drive ); if ( ret ) return -EINVAL; + + ret = 0; DONE: if ( ret != 0 ) { @@ -202,7 +212,7 @@ if ( ret ) return; } -//__initlist(cf_default_io_init, INIT_LEVEL_OTHER_STUFF + 2); +__initlist(cf_default_io_init, INIT_LEVEL_OTHER_STUFF + 2); int cf_io_init( io_driver_t *io ) { @@ -246,7 +256,7 @@ u16 start_off; int block, to_copy; - if ( !dest || !src ) + if ( !dest ) return -EINVAL; /* starting block number */ @@ -265,6 +275,12 @@ if ( ret != 0 ) return -EINVAL; + if ( cf_dbg>5 ) { + ret = ide_status_dump( &drive ); + if ( ret ) + return -EINVAL; + } + if ( start_off ) { to_copy = IDE_BLOCK_SIZE - start_off; } else { @@ -332,7 +348,7 @@ return ret; } - ret = io_read( buffer, 256, 512, &cf_def_io ); + ret = io_read( buffer, (unsigned char *)256, 512, &cf_def_io ); if ( ret ) { DBG( 1, "%s: io_read: %d\n", __FUNCTION__, ret ); return ret; |
From: Stefan E. <se...@us...> - 2002-05-08 14:05:49
|
Update of /cvsroot/blob/blob/src/blob In directory usw-pr-cvs1:/tmp/cvs-serv20864 Modified Files: system3.c Log Message: - iotest command: use TAR io driver chained to CF io driver and RAM1 io driver to extract a file from CF card to RAM pool 1. Index: system3.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/system3.c,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -r1.14 -r1.15 --- system3.c 2 May 2002 15:57:29 -0000 1.14 +++ system3.c 8 May 2002 14:05:44 -0000 1.15 @@ -501,13 +501,16 @@ int io_cmd( int argc, char *argv[] ) { int ret; - io_driver_t *iotar, *ioram1; + io_driver_t *iotar, *ioram1, *iocf; + char buffer[1024]; io_dbg_set( 100 ); - tar_dbg_set( 1 ); + tar_dbg_set( 100 ); +#if 0 ret = io_test(); if ( ret ) return -EINVAL; +#endif ioram1 = io_get_byname( "RAM1" ); if ( !ioram1 ) return -EINVAL; @@ -517,10 +520,32 @@ if ( !iotar ) return -EINVAL; printf( "found 'TAR': %p\n", iotar ); + iocf = io_get_byname( "CF" ); + if ( !iocf ) return -EINVAL; + printf( "found 'CF': %p\n", iocf ); + + /* CF card is on slot 1 */ + ret = io_configure( iocf, (void *)1 ); + if ( ret ) { + printf( "io_configure() error %d\n", ret ); + return -EINVAL; + } + + ret = io_read( buffer, (unsigned char *)0, 1024, iocf ); + if ( ret ) { + printf( "io_read() error %d\n", ret ); + return -EINVAL; + } + ret = io_copy( ioram1, iocf, 1024 ); + if ( ret ) { + printf( "io_copy() error %d\n", ret ); + return -EINVAL; + } + /* have tar io driver reading from RAM0 io driver */ - ret = io_chain_driver( "TAR", "RAM0" ); + //ret = io_chain_driver( "TAR", "RAM0" ); + ret = io_chain_driver( "TAR", "CF" ); if ( ret ) return -EINVAL; - printf( "chained RAM0->TAR\n" ); /* select a file */ ret = io_configure( iotar, "system3.c" ); @@ -561,6 +586,9 @@ static char io_help[] = "io test function\n"; __commandlist(io_cmd, "iotest", io_help); +extern int cf_test_module( int argc, char *argv[] ); +extern char cf_help[]; +__commandlist(cf_test_module, "cftest", cf_help); /***************************************************************** * manually reference flash and download commands until they * are in libblob. |
From: Stefan E. <se...@us...> - 2002-05-08 14:02:37
|
Update of /cvsroot/blob/blob/src/lib In directory usw-pr-cvs1:/tmp/cvs-serv19986 Modified Files: generic_io.c Log Message: - IO driver debug macro Index: generic_io.c =================================================================== RCS file: /cvsroot/blob/blob/src/lib/generic_io.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- generic_io.c 2 May 2002 15:27:50 -0000 1.2 +++ generic_io.c 8 May 2002 14:02:35 -0000 1.3 @@ -49,9 +49,14 @@ #define IO_DEBUG 1 #ifdef IO_DEBUG -# define DBG( x, args... ) if ( io_dbg>x ) printf( args ) +# define DBG( x, args... ) if ( io_dbg>x ) printf( args ) +# define DBGIO( x, io ) if ( io_dbg>x ) printf( "%s: " \ + "%s(%p)={ c=%p, r=%p, w=%p,\n\tp=%p, sz=%d, ch=%p,\n\tn='%s' }\n", \ + __FUNCTION__, #io, io, io->conf, io->read, io->write, \ + io->private_data, io->io_size, io->child_io, io->name ); #else # define DBG( x, args... ) +# define DBGIO( x, io ) #endif @@ -128,9 +133,14 @@ int io_configure( io_driver_t *io, void *conf_data ) { + DBG( 1, "%s: io=%p, conf_data=%p\n", __FUNCTION__, + io, conf_data ); + if ( !io ) return -EINVAL; + DBGIO( 5, io ); + if (io->conf ) return io->conf( io, conf_data ); @@ -167,10 +177,14 @@ if ( !p ) return -EINVAL; + DBGIO( 5, p ); + c = io_get_byname( new_child ); if ( !c ) return -EINVAL; + DBGIO( 5, c ); + DBG( 1, "%s: chained Parent '%s' -> child '%s'.\n", __FUNCTION__, io_get_name( p ), io_get_name( c ) ); @@ -181,6 +195,11 @@ int io_read( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *rd ) { + DBG( 1, "%s: dest=%p, src=%p, amount=%d, rd=%p\n", __FUNCTION__, + dest, src, amount, rd ); + + DBGIO( 5, rd ); + if ( !rd || !rd->read ) return -EINVAL; @@ -191,6 +210,11 @@ int io_write( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *rd ) { + DBG( 1, "%s: dest=%p, src=%p, amount=%d, rd=%p\n", __FUNCTION__, + dest, src, amount, rd ); + + DBGIO( 5, rd ); + if ( !rd|| !rd->write ) return -EINVAL; @@ -205,6 +229,12 @@ int ret = 0; int blocks, block, to_copy; unsigned char *adr = NULL; + + DBG( 1, "%s: dest=%p, src=%p, amount=%d\n", __FUNCTION__, + dest, src, amount ); + + DBGIO( 5, src ); + DBGIO( 5, dest ); if ( !dest || !src ) return -EINVAL; |
From: Stefan E. <se...@us...> - 2002-05-08 13:56:05
|
Update of /cvsroot/blob/blob/include/blob In directory usw-pr-cvs1:/tmp/cvs-serv16690 Modified Files: ide.h Log Message: - ide_setfeature() command, and defines. Index: ide.h =================================================================== RCS file: /cvsroot/blob/blob/include/blob/ide.h,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- ide.h 26 Apr 2002 09:23:03 -0000 1.3 +++ ide.h 8 May 2002 13:56:02 -0000 1.4 @@ -42,7 +42,8 @@ /* HDC internal command bytes (HDC_Cmd[7]) */ #define HDC_RECAL 0x10 /* 0001 0000 */ -#define HDC_READ 0x20 /* 0010 0000 */ +//#define HDC_READ 0x20 /* 0010 0000 */ +#define HDC_READ 0x21 /* 0010 0000 */ #define HDC_READ_LONG 0x22 /* 0010 0010 */ #define HDC_WRITE 0x30 /* 0011 0000 */ #define HDC_WRITE_LONG 0x32 /* 0011 0010 */ @@ -52,6 +53,20 @@ #define HDC_DIAG 0x90 /* 1001 0000 */ #define HDC_SET_PARAMS 0x91 /* 1001 0001 */ #define HDC_IDENTIFY 0xEC /* ask drive to identify itself */ +#define HDC_SETFEATURE 0xEF /* set ide feature, opcodes below */ + +/* SET FEATURE OPCODES */ +#define IDE_FEAT_8BITON 0x01 /* 8 bit io */ +#define IDE_FEAT_8BITOFF 0x81 /* set io transfer mode, parameter see below */ +#define IDE_FEAT_WCEN 0x02 /* write cache enable */ +#define IDE_FEAT_IOMODE 0x03 /* set io transfer mode, parameter see below */ + +/* IO transfermode Feature param */ +#define IDE_IOM_PIO 0x00 /* default PIO */ +#define IDE_IOM_PIO_noIORDY 0x01 /* PIO w/o IORDY */ +#define IDE_IOM_PIO_FC( x ) (0x4|(x&0x3)) /* PIO with flow control */ +#define IDE_IOM_DMA( x ) (0x10|(x&0x3)) /* multiple DMA, mode x */ +#define IDE_IOM_UDMA( x ) (0x20|(x&0x3)) /* UDMA, mode x */ #define HD_PORT 0x1f0 #define HD_REG_PORT 0x3f6 @@ -167,6 +182,8 @@ int ide_reset( ide_drive_t *drive ); int ide_identify_drive( ide_drive_t *drive ); + +int ide_setfeature( ide_drive_t *drive, unsigned char opcode, unsigned char param ); int hd_read( ide_drive_t *drive, int head, int sector, int cyl, char *buffer); |
From: Stefan E. <se...@us...> - 2002-05-08 13:55:33
|
Update of /cvsroot/blob/blob/src/lib In directory usw-pr-cvs1:/tmp/cvs-serv16398 Modified Files: ide.c Log Message: - added ide_setfeature() to set ide features Index: ide.c =================================================================== RCS file: /cvsroot/blob/blob/src/lib/ide.c,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -r1.4 -r1.5 --- ide.c 27 Apr 2002 04:59:59 -0000 1.4 +++ ide.c 8 May 2002 13:55:28 -0000 1.5 @@ -23,6 +23,9 @@ * $Id$ * * $Log$ + * Revision 1.5 2002/05/08 13:55:28 seletz + * - added ide_setfeature() to set ide features + * * Revision 1.4 2002/04/27 04:59:59 timriker * turn on ide and pcmcia again, fix pcmcia compiles (but not features) for non sa1111 systems * @@ -67,9 +70,9 @@ #define IDE_DEBUG 1 #ifdef IDE_DEBUG -# define _DBG( args... ) printf( args ) +# define DBG( x, args... ) if ( ide_dbg>x ) printf( args ); #else -# define _DBG( args... ) +# define DBG( x, args... ) #endif #define IDE_DELAY 10 @@ -88,9 +91,9 @@ static char *version = "$Id$"; #ifdef IDE_DEBUG -static int dbg = 1; +static int ide_dbg = 1; #else -static int dbg = 0; +static int ide_dbg = 0; #endif @@ -108,7 +111,7 @@ void ide_dbg_set( int level ) { - dbg = level; + ide_dbg = level; } /********************************************************************** @@ -125,16 +128,14 @@ if ( !drive ) return -1; - if ( dbg > 0 ) { - printf( "ide: %s\n", version ); - } + DBG( 1, "ide: %s\n", version ); drive->ide_port = (u8 *)(base_addr + HD_PORT); drive->ide_reg = (u8 *)(base_addr + HD_REG_PORT); drive->last_status = 0; - _DBG( "%s: ide_port=%p\n", __FUNCTION__, drive->ide_port ); - _DBG( "%s: ide_reg=%p\n", __FUNCTION__, drive->ide_reg ); + DBG( 1, "%s: ide_port=%p\n", __FUNCTION__, drive->ide_port ); + DBG( 1, "%s: ide_reg=%p\n", __FUNCTION__, drive->ide_reg ); return 0; } @@ -147,15 +148,22 @@ int ide_status_dump( ide_drive_t *drive ) { u8 status; - int i; if ( !drive || !drive->ide_port ) return -1; - for (i = 0; i < 8; i++) { - status = drive->ide_port[i]; - printf("port[ %d ] %x\n", i, status); - } + + status = drive->ide_port[7]; + printf( "ide: status[%s %s %s %s %s %s %s %s]\n", + status&BUSY ?"BSY":" ", + status&READY ?"RDY":" ", + status&WRITE_FAULT ?"DF ":" ", + status&SEEKOK ?"DSC":" ", + status&DATA_REQ ?"DRQ":" ", + status&CORRECTED ?"COR":" ", + status&REV_INDEX ?"IDX":" ", + status&ERROR ?"ERR":" " + ); return 0; } @@ -180,9 +188,11 @@ #if 1 /* reset hd controller */ - reg[0] = 0x04; + reg[0] = 0x06; + barrier(); msleep(IDE_DELAY); - reg[0] = 0x00; + reg[0] = 0x02; + barrier(); msleep(IDE_DELAY); #else msleep(5*IDE_DELAY); @@ -194,6 +204,7 @@ port[4] = 0; port[5] = 0; port[6] = 0xa0; + barrier(); msleep(IDE_DELAY); return 0; @@ -244,6 +255,39 @@ } /********************************************************************** + * ide_setfeature + * + * - set features + * + */ +int ide_setfeature( ide_drive_t *drive, unsigned char opcode, unsigned char param ) +{ + volatile u8 *port = NULL; + volatile u8 *reg = NULL; + + if ( !drive || !drive->ide_port ) + return -1; + + port = drive->ide_port; + reg = drive->ide_reg; + + DBG( 1, "%s: HDC_SETFEATURE( 0x%02x, 0x%02x )\n", __FUNCTION__, + opcode, param ); + + port[1] = opcode; + port[2] = param; + port[3] = 0; + port[4] = 0; + port[5] = 0; + port[6] = 0; + port[7] = HDC_SETFEATURE; + + hd_busy_wait(port); + + return 0; +} + +/********************************************************************** * hd_read * * - read head/sector/cyl of drive to a buffer. Reads 1 block (512 bytes) of @@ -274,8 +318,8 @@ hd_cmd[5] = (cyl >> 8) & 0xff; /* cylinder hi byte */ hd_cmd[6] = (hd_drive << 4) | (hd_head & 0x0f) | 0xa0; - if (dbg > 2) - printf("hd_read() h=%d s=%d c=%d\n", hd_head, hd_sector, hd_cyl); + DBG( 2, "%s: h=%d s=%d c=%d\n", __FUNCTION__, hd_head, hd_sector, + hd_cyl); #if 0 if (hd_head > 7) { @@ -290,16 +334,18 @@ hd_busy_wait(port); for (i = 1; i < 7; i++) { - hd_busy_wait(port); port[i] = hd_cmd[i]; + barrier(); } port[7] = HDC_READ; + barrier(); hd_busy_wait(port); for (i = 0; i < 512; i++) { buffer[i] = port[0]; + barrier(); } drive->last_status = status = port[7]; @@ -332,9 +378,8 @@ if ( !drive || !drive->ide_port ) return -1; - if (dbg > 2) - printf("hd_read_mapped(sector_num=%d, buffer=%x)\n", - sector_num, (u32)buffer); + DBG( 2, "%s: sector_num=%d, buffer=%p\n", __FUNCTION__, + sector_num, buffer); #if 0 sector = (sector_num % disk_sectors_per_track) + 1; @@ -371,7 +416,7 @@ _cyl = sector; - _DBG( "%s: => (h:%d, s:%d, c:%d)\n", __FUNCTION__, _head, _sec, _cyl ); + DBG( 1, "%s: => (h:%d, s:%d, c:%d)\n", __FUNCTION__, _head, _sec, _cyl ); if ( head ) *head = _head; if ( sec ) *sec = _sec; @@ -402,15 +447,17 @@ port[5] = 0; port[6] = 0xa0; port[7] = HDC_IDENTIFY; + barrier(); hd_busy_wait(port); for (i = 0; i < 512; i++) { + barrier(); buffer[i] = port[0]; } status = port[7]; - _DBG( "%s: status=0x%02x\n", __FUNCTION__, status ); + DBG( 1, "%s: status=0x%02x\n", __FUNCTION__, status ); if (status & ERROR) { printf("ide: identify status: %2x\n", status); @@ -441,9 +488,11 @@ for (i = 1; i < 7; i++) { hd_busy_wait(port); port[i] = hd_cmd[i]; + barrier(); } port[7] = HDC_RECAL; + barrier(); if (hd_busy_wait(port)) return -1; @@ -459,16 +508,18 @@ count = 0; while (count++ < 2500) { status = port[7]; + barrier(); if ((status & BUSY) == 0) break; msleep(1); } - _DBG( "ide: %s: port=%x, count=%d, status=%x\n", __FUNCTION__, - *port, count, status ); + DBG( 1, "%s: port=%p, count=%d, status=%02x\n", __FUNCTION__, + port, count, status ); - if (status & 0x01) { + if ( (status & ERROR) || (status & WRITE_FAULT) ) { err = port[1]; + barrier(); printf( "ide: busy_wait: err = %2x\n", err ); return -1; } |
From: Stefan E. <se...@us...> - 2002-05-03 16:10:31
|
Update of /cvsroot/blob/blob/include/blob In directory usw-pr-cvs1:/tmp/cvs-serv14520 Modified Files: cf.h Log Message: - cf_io_init() changed. Needs no slot number. Use io_configure() instead. Index: cf.h =================================================================== RCS file: /cvsroot/blob/blob/include/blob/cf.h,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- cf.h 3 May 2002 10:04:47 -0000 1.1 +++ cf.h 3 May 2002 16:10:29 -0000 1.2 @@ -39,6 +39,6 @@ int cf_init( int slot ); /* io driver init */ -int cf_io_init( io_driver_t *io, int slot ); +int cf_io_init( io_driver_t *io ); #endif |
From: Stefan E. <se...@us...> - 2002-05-03 16:05:01
|
Update of /cvsroot/blob/blob/src/lib In directory usw-pr-cvs1:/tmp/cvs-serv13087 Modified Files: cf.c Log Message: - BUGFIX: cf_io_read(): read too much, buffer overrun :( Index: cf.c =================================================================== RCS file: /cvsroot/blob/blob/src/lib/cf.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- cf.c 3 May 2002 10:04:23 -0000 1.1 +++ cf.c 3 May 2002 16:02:22 -0000 1.2 @@ -43,7 +43,10 @@ /********************************************************************** * defines */ -#define CF_DEBUG 0 +#define CF_DEBUG 1 + +/* define this to activate module test cmd */ +#define CF_TEST_MODULE 1 #if CF_DEBUG # define DBG( x, args... ) if ( cf_dbg>x ) printf( args ); @@ -192,19 +195,18 @@ cf_dbg_set( 0 ); /* init default cf drv */ - ret = cf_io_init( &cf_def_io, cf_slot ); + ret = cf_io_init( &cf_def_io ); if ( ret ) return; ret = io_register( &cf_def_io, "CF" ); if ( ret ) return; } -__initlist(cf_default_io_init, INIT_LEVEL_OTHER_STUFF + 2); +//__initlist(cf_default_io_init, INIT_LEVEL_OTHER_STUFF + 2); -int cf_io_init( io_driver_t *io, int slot ) +int cf_io_init( io_driver_t *io ) { - DBG( 5, "%s: io=%p, slot=%p\n", __FUNCTION__, - io, slot ); + DBG( 5, "%s: io=%p\n", __FUNCTION__, io ); io->conf = cf_io_conf; io->read = cf_io_read; @@ -222,10 +224,14 @@ int cf_io_conf( io_driver_t *io, void *conf ) { + DBG( 5, "%s: io=%p, conf=%p\n", __FUNCTION__, + io, conf ); + if ( !io || !conf ) return -EINVAL; cf_slot = (int)conf; + DBG( 5, "%s: cf_slot=%d\n", __FUNCTION__, cf_slot ); io->private_data = (void *)cf_slot; @@ -253,7 +259,7 @@ __FUNCTION__, start_block, start_off, src, dest, amount ); block = start_block; - while ( amount ) { + while ( amount > 0 ) { /* read block into buffer */ ret = hd_read_mapped( &drive, block, buffer ); if ( ret != 0 ) @@ -265,6 +271,11 @@ to_copy = IDE_BLOCK_SIZE; } + + if ( amount < to_copy ) { + to_copy = amount; + } + DBG( 15, "%s: block=%d, to_copy=%d, amount=%d\n", __FUNCTION__, block, to_copy, amount ); @@ -287,3 +298,47 @@ { return -EINVAL; } + + +/********************************************************************** + * Module test + */ +#if defined(CF_TEST_MODULE) +int cf_test_module( int argc, char *argv[] ) +{ + int ret; + static io_driver_t cf_def_io; + char buffer[1024]; + + /* this is a debug command. be verbose. */ + cf_dbg_set( 100 ); + + /* init default cf drv */ + ret = cf_io_init( &cf_def_io ); + if ( ret ) { + DBG( 1, "%s: cf_io_init: %d\n", __FUNCTION__, ret ); + return ret; + } + + ret = io_register( &cf_def_io, "CF" ); + if ( ret ) { + DBG( 1, "%s: cf_io_register: %d\n", __FUNCTION__, ret ); + return ret; + } + + ret = io_configure( &cf_def_io, (void *)1 ); + if ( ret ) { + DBG( 1, "%s: cf_io_configure: %d\n", __FUNCTION__, ret ); + return ret; + } + + ret = io_read( buffer, 256, 512, &cf_def_io ); + if ( ret ) { + DBG( 1, "%s: io_read: %d\n", __FUNCTION__, ret ); + return ret; + } + + return 0; +} +char cf_help[] = "cf test function\n"; +#endif |
From: Stefan E. <se...@us...> - 2002-05-03 10:04:50
|
Update of /cvsroot/blob/blob/include/blob In directory usw-pr-cvs1:/tmp/cvs-serv12130 Added Files: cf.h Log Message: - cf support header file --- NEW FILE: cf.h --- /* * cf.h * * Copyright (C) 2002, Stefan Eletzhofer <ste...@el...> * * 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; either version 2 of the License, or * (at your option) any later version. * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ #ifndef BLOB_CF_H #define BLOB_CF_H 1 /***************************************************************** * CF Flash register definitions */ /* config register - offset 0 */ #define CF_REG_CFG (0x00) #define CF_CFG_SRST (0x80) #define CF_CFG_LVLREQ (0x40) #define CF_CFG_MMAP (0x00) #define CF_CFG_IOMAP (0x01) #define CF_CFG_IO_IDE0 (0x02) #define CF_CFG_IO_IDE1 (0x03) /* config status register - offset 2 */ #define CF_REG_CFGSTAT (0x02) /* init CF card in PCMCIA slot <slot> */ int cf_init( int slot ); /* io driver init */ int cf_io_init( io_driver_t *io, int slot ); #endif |
From: Stefan E. <se...@us...> - 2002-05-03 10:04:29
|
Update of /cvsroot/blob/blob/src/lib In directory usw-pr-cvs1:/tmp/cvs-serv10534 Added Files: cf.c Log Message: - this code supplies CF access through generic io. - first stage of evolution, WIP, YMMV .... - missing: - proper wrapping with config options (autoconf/automake). - this code uses PCMCIA, IDE and gereric_io libs - test --- NEW FILE: cf.c --- /********************************************************************** * cf.c: compact flash IDE access * * Copyright (C) 2002, Stefan Eletzhofer <ste...@el...> * * 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; either version 2 of the License, or * (at your option) any later version. * * 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA * * $Id: cf.c,v 1.1 2002/05/03 10:04:23 seletz Exp $ * */ /********************************************************************** * Includes */ #ifdef HAVE_CONFIG_H # include <blob/config.h> #endif #include <blob/types.h> #include <blob/errno.h> #include <blob/util.h> #include <blob/time.h> #include <blob/command.h> #include <blob/init.h> #include <blob/generic_io.h> #include <blob/pcmcia.h> #include <blob/ide.h> #include <blob/cf.h> /********************************************************************** * defines */ #define CF_DEBUG 0 #if CF_DEBUG # define DBG( x, args... ) if ( cf_dbg>x ) printf( args ); #else # define DBG( x, args... ) #endif #define IDE_BLOCK_SIZE 512 /********************************************************************** * module globals */ #if CF_DEBUG static int cf_dbg = 1; #else static int cf_dbg = 0; #endif static char module_version[] = "$Id: cf.c,v 1.1 2002/05/03 10:04:23 seletz Exp $"; /* static atm. Do we need more than one CF card? */ static int cf_slot = 1; static u32 cf_slot_base = 0L; static u32 cf_slot_attr = 0L; static ide_drive_t drive; /********************************************************************** * static functions */ static int cf_io_conf( io_driver_t *io, void *conf ); static int cf_io_read( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *io ); static int cf_io_write( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *io ); /**********************************************************************/ /**********************************************************************/ /**********************************************************************/ /* set debug level */ void cf_dbg_set( int lvl ) { cf_dbg = lvl; } /***************************************************************** * cf_init - initialize CF card plugged in slot <slot> */ int cf_init( int slot ) { int ret = 0; u16 cfg_reg; u8 cfgvalue; u8 value; ret = pcmcia_init(); if ( ret != 0 ) return -EINVAL; if ( cf_dbg > 10 ) { pcmcia_dbg_set( 5 ); ide_dbg_set( 5 ); } ret = pcmcia_slot_detect( slot ); if ( !ret ) return -EINVAL; printf( "cf: slot %d detected\n", slot ); ret = pcmcia_slot_enable( slot ); if ( ret ) return -EINVAL; ret = pcmcia_slot_address_get( slot, &cf_slot_base, &cf_slot_attr ); if ( ret ) return -EINVAL; ret = pcmcia_slot_reset( slot ); if ( ret ) return -EINVAL; ret = pcmcia_cis_parse( slot ); if ( ret ) return -EINVAL; ret = pcmcia_slot_cfg_reg_get( slot, &cfg_reg ); if ( ret ) return -EINVAL; DBG( 2, "cf: slot %d config register: 0x%03x\n", slot, cfg_reg ); pcmcia_slot_attr_read( slot, CF_REG_CFG, &cfgvalue ); DBG( 2, "slot %d config register: 0x%02x = 0x%02x\n", slot, CF_REG_CFG, cfgvalue ); pcmcia_slot_attr_read( slot, CF_REG_CFGSTAT, &value ); DBG( 2, "slot %d config status register: 0x%02x = 0x%02x\n", slot, CF_REG_CFGSTAT, value ); /* reset CF card */ pcmcia_slot_attr_write( slot, CF_REG_CFG, cfgvalue | CF_CFG_SRST ); msleep(1); pcmcia_slot_attr_write( slot, CF_REG_CFG, cfgvalue & (~CF_CFG_SRST) ); pcmcia_slot_attr_read( slot, CF_REG_CFG, &cfgvalue ); DBG( 2, "slot %d config register: 0x%02x = 0x%02x\n", slot, CF_REG_CFG, cfgvalue ); /* configure for true ide mode */ pcmcia_slot_attr_write( slot, CF_REG_CFG, cfgvalue | CF_CFG_IO_IDE0 ); pcmcia_slot_attr_read( slot, CF_REG_CFG, &cfgvalue ); DBG( 2, "slot %d config register: 0x%02x = 0x%02x\n", slot, CF_REG_CFG, cfgvalue ); pcmcia_slot_attr_read( slot, CF_REG_CFGSTAT, &value ); DBG( 2, "slot %d config status register: 0x%02x = 0x%02x\n", slot, CF_REG_CFGSTAT, value ); DBG( 2, "slot %d enabled\n", slot ); ret = ide_init( &drive, (u32)cf_slot_base ); if ( ret ) return -EINVAL; ret = ide_reset( &drive ); ret = ide_identify_drive( &drive ); if ( ret ) return -EINVAL; ret = ide_status_dump( &drive ); if ( ret ) return -EINVAL; ret = 0; DONE: if ( ret != 0 ) { printf( "cf: error (%d).\n", ret ); } return ret; } /********************************************************************** * CF io driver * - maps "adresses" to blocks of IDE_BLOCK_SIZE bytes. Reads * whole blocks, but copies only requested data. */ void cf_default_io_init( void ) { int ret; static io_driver_t cf_def_io; cf_dbg_set( 0 ); /* init default cf drv */ ret = cf_io_init( &cf_def_io, cf_slot ); if ( ret ) return; ret = io_register( &cf_def_io, "CF" ); if ( ret ) return; } __initlist(cf_default_io_init, INIT_LEVEL_OTHER_STUFF + 2); int cf_io_init( io_driver_t *io, int slot ) { DBG( 5, "%s: io=%p, slot=%p\n", __FUNCTION__, io, slot ); io->conf = cf_io_conf; io->read = cf_io_read; io->write = cf_io_write; io->private_data = (void *)NULL; /* filled by configure */ io->io_size = 0; /* filled for us by io_chain() */ io->child_io = NULL; return 0; } int cf_io_conf( io_driver_t *io, void *conf ) { if ( !io || !conf ) return -EINVAL; cf_slot = (int)conf; io->private_data = (void *)cf_slot; return cf_init( cf_slot ); } static int cf_io_read( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *io ) { int ret = 0; static unsigned char buffer[IDE_BLOCK_SIZE]; u32 start_block; u16 start_off; int block, to_copy; if ( !dest || !src ) return -EINVAL; /* starting block number */ start_block = (u32)src/IDE_BLOCK_SIZE; /* start offset (in-block-offset)*/ start_off = (u32)src - start_block*IDE_BLOCK_SIZE; DBG( 1, "%s: start_block=%d, start_off=%d, src=%p, dest=%p, amount=%d\n", __FUNCTION__, start_block, start_off, src, dest, amount ); block = start_block; while ( amount ) { /* read block into buffer */ ret = hd_read_mapped( &drive, block, buffer ); if ( ret != 0 ) return -EINVAL; if ( start_off ) { to_copy = IDE_BLOCK_SIZE - start_off; } else { to_copy = IDE_BLOCK_SIZE; } DBG( 15, "%s: block=%d, to_copy=%d, amount=%d\n", __FUNCTION__, block, to_copy, amount ); /* copy data */ memcpy( dest, buffer + start_off, to_copy ); if ( start_off ) { start_off=0; } dest += to_copy; amount -= to_copy; block += 1; } return 0; } static int cf_io_write( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *io ) { return -EINVAL; } |
From: Stefan E. <se...@us...> - 2002-05-03 09:59:55
|
Update of /cvsroot/blob/blob/include/blob In directory usw-pr-cvs1:/tmp/cvs-serv9395 Modified Files: tar.h Log Message: - don't export tar_io_conf Index: tar.h =================================================================== RCS file: /cvsroot/blob/blob/include/blob/tar.h,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- tar.h 2 May 2002 15:23:01 -0000 1.2 +++ tar.h 3 May 2002 09:59:52 -0000 1.3 @@ -258,6 +258,5 @@ * io driver for tar archives */ int tar_io_init( io_driver_t *io, tar_arch_t *arch ); -int tar_io_conf( io_driver_t *io, void *conf ); #endif |
From: Stefan E. <se...@us...> - 2002-05-03 09:59:20
|
Update of /cvsroot/blob/blob/src/lib In directory usw-pr-cvs1:/tmp/cvs-serv8879 Modified Files: tar.c Log Message: - use TAR_BLOCKSIZE instead of magic numbers - made non-exported functions static - don't export tar_io_conf, it's wrapped by io_configure() Index: tar.c =================================================================== RCS file: /cvsroot/blob/blob/src/lib/tar.c,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -r1.3 -r1.4 --- tar.c 2 May 2002 15:28:54 -0000 1.3 +++ tar.c 3 May 2002 09:59:16 -0000 1.4 @@ -59,7 +59,6 @@ static char module_version[] = "$Id$"; - /********************************************************************** * static functions */ @@ -73,9 +72,9 @@ static int tar_from_oct( unsigned char *start, size_t digits, unsigned long *value ); /* io driver stuff */ -int tar_io_conf( io_driver_t * io, void *conf ); -int tar_io_read( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *io ); -int tar_io_write( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *io ); +static int tar_io_conf( io_driver_t * io, void *conf ); +static int tar_io_read( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *io ); +static int tar_io_write( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *io ); /**********************************************************************/ /**********************************************************************/ @@ -90,7 +89,7 @@ /********************************************************************** * io driver for tar archives */ -void init_tar_default_io( void ) +static void init_tar_default_io( void ) { int ret; static io_driver_t def_tar_io_driver; @@ -112,8 +111,8 @@ if ( !io || !arch ) return -EINVAL; - DBG( 5, "%s: driver=%p, arch=%p\n", __FUNCTION__, - driver, arch ); + DBG( 5, "%s: io=%p, arch=%p\n", __FUNCTION__, + io, arch ); io->conf = tar_io_conf; io->read = tar_io_read; @@ -130,7 +129,7 @@ } /* the user gives us a filename in conf */ -int tar_io_conf( io_driver_t * io, void *conf ) +static int tar_io_conf( io_driver_t * io, void *conf ) { int ret; char *name; @@ -169,7 +168,7 @@ return 0; } -int tar_io_read( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *io ) +static int tar_io_read( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *io ) { io_driver_t *child; tar_arch_t *arch; @@ -183,7 +182,7 @@ if ( !child ) return -EINVAL; - offset = arch->f_start_block*512; + offset = arch->f_start_block*TAR_BLOCKSIZE; DBG( 3, "%s: dest=%p, src=%p(=%p), amount=%d, child=%p\n", __FUNCTION__, dest, src, (char *)((u32)src + offset), amount, child ); @@ -191,7 +190,7 @@ return io_read(dest, (unsigned char *)(offset + (u32)src), amount, child ); } -int tar_io_write( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *io ) +static int tar_io_write( unsigned char *dest, unsigned char *src, size_t amount, io_driver_t *io ) { return -EINVAL; } @@ -366,7 +365,7 @@ if ( !size ) return -EINVAL; - ret = io_read( dest, (unsigned char*)(arch->f_start_block*512), arch->f_size, arch->io_driver ); + ret = io_read( dest, (unsigned char*)(arch->f_start_block*TAR_BLOCKSIZE), arch->f_size, arch->io_driver ); if ( ret ) return ret; @@ -383,7 +382,7 @@ return -EINVAL; /* get header */ - ret = io_read( arch->buffer, (unsigned char *)(arch->block*512), 512, arch->io_driver ); + ret = io_read( arch->buffer, (unsigned char *)(arch->block*TAR_BLOCKSIZE), TAR_BLOCKSIZE, arch->io_driver ); if ( ret ) { printf( "tar: cant get block: %d\n", ret ); goto DONE; @@ -407,7 +406,7 @@ } arch->f_start_block = arch->block; - arch->f_blocks = (arch->f_size/512) + (arch->f_size%512?1:0); + arch->f_blocks = (arch->f_size/TAR_BLOCKSIZE) + (arch->f_size%TAR_BLOCKSIZE?1:0); printf( "tar: %s %ld bytes, %d blocks\n", phdr->name, arch->f_size, arch->f_blocks ); |
From: Stefan E. <se...@us...> - 2002-05-02 15:57:35
|
Update of /cvsroot/blob/blob/src/blob In directory usw-pr-cvs1:/tmp/cvs-serv29677 Modified Files: system3.c Log Message: - io driver test command Index: system3.c =================================================================== RCS file: /cvsroot/blob/blob/src/blob/system3.c,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -r1.13 -r1.14 --- system3.c 26 Apr 2002 18:26:38 -0000 1.13 +++ system3.c 2 May 2002 15:57:29 -0000 1.14 @@ -46,6 +46,9 @@ #include <blob/sa1100.h> #include <blob/sa1111.h> + +#include <blob/generic_io.h> + #include <blob/pcmcia.h> #include <blob/ide.h> #include <blob/tar.h> @@ -254,13 +257,10 @@ u32 slot_attr; u16 cfg_reg; ide_drive_t drive; - int numDev; int sec; u8 cfgvalue; u8 value; - unsigned char * devTypeStr[] - = { "no device found", "unknown type", "ATA", "ATAPI" }; char buffer[4096]; /* set ata debg level high */ @@ -413,7 +413,7 @@ static void dumpmem(char *ptr, int len) { char line[80], chars[80], *p, b, *c, *end; - int i, j; + int j; end = ptr + len; while (ptr < end) { @@ -439,11 +439,11 @@ int tar_cmd( int argc, char *argv[] ) { +#if 0 int ret = 0; u32 start = 0; u32 dest = 0; tar_arch_t my_arch; - struct mem arch_adr; tar_dbg_set( 100 ); @@ -483,15 +483,83 @@ printf( "tar_xtract: %d\n", ret ); goto DONE; } - dumpmem( dest, 0x200 ); + dumpmem( (unsigned char*)dest, 0x200 ); break; } DONE: return ret; +#else + /* FIXME: rewrite using io drivers */ + return -EINVAL; +#endif } static char tar_help[] = "tar [t|x] src [filename dest]\n"; __commandlist(tar_cmd, "tar", tar_help); + +extern int io_test(void); +int io_cmd( int argc, char *argv[] ) +{ + int ret; + io_driver_t *iotar, *ioram1; + + io_dbg_set( 100 ); + tar_dbg_set( 1 ); + + ret = io_test(); + if ( ret ) return -EINVAL; + + ioram1 = io_get_byname( "RAM1" ); + if ( !ioram1 ) return -EINVAL; + printf( "found 'RAM1': %p\n", ioram1 ); + + iotar = io_get_byname( "TAR" ); + if ( !iotar ) return -EINVAL; + printf( "found 'TAR': %p\n", iotar ); + + /* have tar io driver reading from RAM0 io driver */ + ret = io_chain_driver( "TAR", "RAM0" ); + if ( ret ) return -EINVAL; + printf( "chained RAM0->TAR\n" ); + + /* select a file */ + ret = io_configure( iotar, "system3.c" ); + if ( ret ) return -EINVAL; + printf( "selected file\n" ); + + /* copy a file */ + ret = io_copy( ioram1, iotar, io_get_size( iotar ) ); + if ( ret ) return -EINVAL; + + printf( "copied file\n" ); + +/* + Future uses/extensions: + + raw flash access: + iofl = io_get_byname( "FLASH" ); + ret = io_configure( iofl, 0x00300000 ); // base offset to r/w + + filesystem access: + iocramfs = io_get_byname( "CRAMFS" ); or + ioext2 = io_get_byname( "EXT2FS" ); or + iofat = io_get_byname( "FAT32" ); + + Partitioning: + iopart = io_get_byname( "BLOBPART" ); + io_configure( iopart, "kernel" ); + + Flash kernel coming from a cramfs file on CF: + io_chain_driver( "BLOB_PART", "FLASH" ); // write chain + io_chain_driver( "CRAMFS", "CF" ); // read chain + io_configure( iocramfs, "zImage" ); // select "zImage" file + io_configure( iopart, "kernel" ); // select "kernel" partition + io_copy( iopart, iocramfs, io_get_size( iocramfs ) ); + */ + return 0; +} +static char io_help[] = "io test function\n"; +__commandlist(io_cmd, "iotest", io_help); /***************************************************************** * manually reference flash and download commands until they |
From: Stefan E. <se...@us...> - 2002-05-02 15:28:58
|
Update of /cvsroot/blob/blob/src/lib In directory usw-pr-cvs1:/tmp/cvs-serv19345 Modified Files: tar.c Log Message: - kill logs Index: tar.c =================================================================== RCS file: /cvsroot/blob/blob/src/lib/tar.c,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -r1.2 -r1.3 --- tar.c 2 May 2002 15:24:21 -0000 1.2 +++ tar.c 2 May 2002 15:28:54 -0000 1.3 @@ -19,36 +19,6 @@ * * $Id$ * - * $Log$ - * Revision 1.2 2002/05/02 15:24:21 seletz - * - use generic io framework to provide a tar reader w/o actually knowing - * where the data comes from. - * - * Revision 1.1 2002/04/26 18:24:54 seletz - * - first revision of minimal tar archive support. - * - this module will be used to get a blob/ramdisk/kernel - * update mechanism from e.g. CF cards using raw tar archives. - * For ex. do a "tar -c --posix -f /def/hda zImage blob initrd.gz cramfs.img" - * with /dev/hda a mounted CF card, ship the CF card to your customer - * and off you go. - * - Missing so far: - * * only posix tar format - * * no zlib support (do we need this?) - * * only "t" and "x" are supported, i.e. no creation of tar - * archives so far. - * - This is WIP .... - * - * Revision 1.2 2002/04/24 14:27:08 seletz - * - first round of bugfixing. Now at last one can read 512 byte sectors - * of a CF in true-ide mode. See system3.c::pcmciatest(). - * - * Still WIP. YMMV, and so on.... - * - * Revision 1.1 2002/04/18 19:52:49 seletz - * - Added PCMCIA and IDE framework. Based on Brad Parker's code. - * NOTE NOTE NOTE: - * This is all Work-In-Progress (you have been warned) - * */ /********************************************************************** |
From: Stefan E. <se...@us...> - 2002-05-02 15:27:53
|
Update of /cvsroot/blob/blob/src/lib In directory usw-pr-cvs1:/tmp/cvs-serv18745 Modified Files: generic_io.c Log Message: - damned logs, kill them Index: generic_io.c =================================================================== RCS file: /cvsroot/blob/blob/src/lib/generic_io.c,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -r1.1 -r1.2 --- generic_io.c 2 May 2002 15:22:07 -0000 1.1 +++ generic_io.c 2 May 2002 15:27:50 -0000 1.2 @@ -21,35 +21,6 @@ * * $Id$ * - * $Log$ - * Revision 1.1 2002/05/02 15:22:07 seletz - * - generic io framework - * - this tries to add a generic io framework. io "drivers" for - * a memory pool included. - * Why do i need this? Well, i want to have CF, Flash, Memory, filesystem - * and tar file access separated from each other. Please have a look at - * generic_io.h, - * system3.c::iotest(), - * and tar.c (now also using the generic io framework) - * - * Revision 1.4 2002/04/27 04:59:59 timriker - * turn on ide and pcmcia again, fix pcmcia compiles (but not features) for non sa1111 systems - * - * Revision 1.3 2002/04/26 09:22:05 seletz - * - added original copyright from Brad Parker - * - corrected EMAIL addr - * - * Revision 1.2 2002/04/24 14:27:08 seletz - * - first round of bugfixing. Now at last one can read 512 byte sectors - * of a CF in true-ide mode. See system3.c::pcmciatest(). - * - * Still WIP. YMMV, and so on.... - * - * Revision 1.1 2002/04/18 19:52:49 seletz - * - Added PCMCIA and IDE framework. Based on Brad Parker's code. - * NOTE NOTE NOTE: - * This is all Work-In-Progress (you have been warned) - * */ /********************************************************************** |