You can subscribe to this list here.
2001 |
Jan
|
Feb
(4) |
Mar
(47) |
Apr
(27) |
May
(113) |
Jun
|
Jul
|
Aug
(1) |
Sep
(15) |
Oct
(25) |
Nov
|
Dec
(34) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2002 |
Jan
(17) |
Feb
(5) |
Mar
(5) |
Apr
(2) |
May
(16) |
Jun
|
Jul
|
Aug
(15) |
Sep
(28) |
Oct
(78) |
Nov
(39) |
Dec
|
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
(4) |
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Paul M. <le...@us...> - 2003-07-19 21:56:32
|
Update of /cvsroot/linuxdc/linux-sh-dc In directory sc8-pr-cvs1:/tmp/cvs-serv8288 Modified Files: Tag: linux-sh-dc-2_4-branch ChangeLog.dc Added Files: Tag: linux-sh-dc-2_4-branch ChangeLog-2002.dc Log Message: Shuffle changelogs. --- NEW FILE: ChangeLog-2002.dc --- 2002-11-20 Adrian McMenamin <ad...@mc...> First write code (may now delete files) added to vmufs. BEFORE YOU USE THIS MAKE SURE YOU UNDERSTAND WHAT THE GPL SAYS ABOUT "NO WARRANTY". NO WARRANTY IS OFFERED. If you want to keep your vmu the way it is - don't use this code! * fs/vmufs/super.c: First write support added * fs/vmufs/inode.c: First write support added 2002-11-13 Adrian McMenamin <ad...@mc...> * fs/vmufs/super.c: Fixes to file mode code 2002-11-10 Adrian McMenamin <ad...@mc...> Moving vmufs towards device independence * fs/vmufs/vmufs.h: Moving away from mtd layer * fs/vmufs/inode.c: Taking out mtd layer code * fs/vmufs/super.c: Removing mtd layer code 2002-11-08 Adrian McMenamin <ad...@mc...> Code tidied up before starting work on writing * fs/vmufs/inode.c: General tidy up * fs/vmufs/super.c: General tidy up 2002-11-06 Adrian McMenamin <ad...@mc...> * fs/vmufs/inode.c: further fixes to handle large number of vmu files * fs/vmufs/super.c: further fixes 2002-11-05 Adrian McMenamin <ad...@mc...> * fs/vmufs/inode.c: Code now handles more than 16 files on one vmu flash slab 2002-11-04 Adrian McMenamin <ad...@mc...> Further vmufs improvements/clean ups * fs/vmufs/super.c: Make bcd conversion function inline * fs/vmufs/inode.c: Traverse through FAT rather than simply assume all files saved in sequential order 2002-11-03 M. R. Brown <mr...@li...> * drivers/mtd/maps/vmu-flash.c (dc_flashmap_connect): Assign name based on the connected port and unit. Dreamcast internal flash support (read tested only). * drivers/mtd/chips/jedec_probe.c: New file, imported from stock 2.4.20-pre11. Add device and chip type for the Fujitsu MBM29LV002TC. * drivers/mtd/maps/dreamcast-flash.c: New file. * drivers/mtd/maps/Config.in: Add CONFIG_MTD_DREAMCAST. * drivers/mtd/maps/Makefile: Add target for CONFIG_MTD_DREAMCAST. 2002-11-03 Paul Mundt <le...@li...> * fs/vmufs/super.c (vmufs_read_super): Free up the root inode if the root dentry allocation fails. Clear out inode mode fmt and force to directory/regular file in certain cases. * fs/vmufs/inode.c (vmufs_readdir): Rework some of the filldir semantics. * fs/vmufs/vmufs_inode.c: Renamed to inode.c, ran through indent, some general cleanup. * fs/vmufs/vmufs_sblock.c: Renamed to super.c, also ran through indent and cleaned up some. 2002-11-03 Adrian McMenamin <ad...@mc...> Further VMU fs cleanup * fs/vmufs/inode.c: Redundant code removed * fs/vmufs/super.c: Force directory and regular file types - seems to fix problems with remounts Initial VMU File System Support added: * fs/vmufs/vmufs.h: New file * fs/vmufs/vmufs_inode.c: New file * fs/vmufs/vmufs_sblock.c: New file * fs/vmufs: Directory added 2002-11-02 M. R. Brown <mr...@li...> * fs/vmufs/vmufs.h: Add extern to struct declaration so that they won't be multiply defined. * fs/Config.in, fs/vmufs/Makefile: Fix typos. * fs/Config.in: Add CONFIG_VMU_FS. * fs/Makefile.in: Add target for CONFIG_VMU_FS. * fs/vmufs/Makefile: New file. * fs/Config.in, fs/Makefile: Add files from Linux 2.4.20-pre11. 2002-11-01 M. R. Brown <mr...@li...> From Mike Barnett: * drivers/maple/maple.c (maple_dma_irq): Make sure maple_detect_callback() is called if the previous command was MAPLE_COMMAND_DEVINFO. 2002-10-26 M. R. Brown <mr...@li...> * Documentation/Configure.help, drivers/sound/Config.in: Fix merge breakage. Linux-SH 2.4.20-pre11 * AGAINST-2.4.20-pre11: New file. * AGAINST-2.4.19: Remove. * Documentation/Configure.help, Makefile, arch/sh/config.in, drivers/char/drm/Config.in, drivers/char/drm/Makefile, drivers/char/Makefile, drivers/mtd/maps/Config.in, drivers/mtd/maps/Makefile, drivers/sound/Config.in: Merge changes from Linux-SH 2.4.20-pre11. Linux-SH 2.4.19 * AGAINST-2.4.19: New file. * AGAINST-2.4.18: Removed. * Makefile, drivers/mtd/maps/Makefile, drivers/sound/Config.in, drivers/sound/Makefile: Merge changes from Linux-SH 2.4.19. 2002-10-18 Adrian McMenamin <ad...@mc...> * drivers/sound/aica/main.c: Parameterised loading added (insmod aica sleeps=1 to lighten load on system from driver playing back high sample rate sounds) 2002-09-20 Adrian McMenamin <ad...@mc...> vmublk files removed as they only saved 1.25k on a zImage compile. Currently these files can also been seen at sf project vmublk * drivers/mtd/devices: Directory removed 2002-09-18 Adrian McMenamin <ad...@mc...> vmublk - a thin vmu block device added. This is thin (and non-cacheing) alternative to mtdblock. mtdblock is designed for large erasesize mtds, vmublk is a thinner alternative (though mtdblock can be used) for the vmu. * drivers/mtd/devices/Config.in: fixed * drivers/mtd/devices/vmublk.c: tidied * drivers/mtd/devices/Makefile: Makefile support *drivers/mtd/devices/Config.in: support for vmu block device added *drivers/mtd/devices/vmublk.c: vmu block device driver added *drivers/mtd/devices: directory added *fs/vmuflash-fs.c: File removed 2002-09-16 Adrian McMenamin <ad...@mc...> *fs/vmuflash-fs.c: Module can now be removed as well as loaded 2002-09-15 Adrian McMenamin <ad...@mc...> *fs/vmuflash-fs.c : Cleaned and improved Initial check-in of vmu flash file system *fs : directory added *fs/vmuflash-fs.c : initial check-in 2002-09-11 Adrian McMenamin <ad...@mc...> * drivers/mtd/maps/vmu-flash.c: Code cleaned-up 2002-09-10 Adrian McMenamin <ad...@mc...> * drivers/mtd/maps/vmu-flash.c: Multiple vmu devices now supported 2002-09-03 Adrian McMenamin <ad...@mc...> * drivers/mtd/maps/vmu-flash.c: Writes now cached 2002-09-01 Adrian McMenamin <ad...@mc...> VMU writes now working - but slowly and code needs to be cleaned. Beware of writing over saved game data! * drivers/mtd/maps/vmu-flash.c: Phased writing now in place and appears to work using kernel 'flat' char and cached block drivers. 2002-08-31 Adrian McMenamin <ad...@mc...> VMU reads now work * drivers/mtd/maps/vmu-flash.c: memcopy code corrected and further diagnostic code inserted - now correctly reads VMU data. Writes to follow. 2002-08-31 Adrian McMenamin <ad...@mc...> * drivers/mtd/maps/vmu-flash.c: Code corrected 2002-08-31 Adrian McMenamin <ad...@mc...> Enhanced diagnostics of flash chips - reading now broadly works * drivers/mtd/maps/vmu-flash.c: Further code updates 2002-08-28 Adrian McMenamin <ad...@mc...> * drivers/mtd/maps/vmu-flash.c: Updated code - almost works 2002-08-24 Adrian McMenamin <ad...@mc...> * drivers/mtd/maps/vmu-flash.c: Cleaned up kmalloc code * drivers/sound/microphone.c: Made clear this is licensed under GPL 2002-08-22 Adrian McMenamin <ad...@mc...> * drivers/sound/microphone.c: Very experimental microphone driver code (not working at present) 2002-08-22 Adrian McMenamin <ad...@mc...> * drivers/mtd/maps/vmu-flash.c: Updated and semi-working VMU flash driver 2002-05-01 Paul Mundt <le...@ch...> * Makefile: Set ARCH explicitly to sh. * drivers/maple/maple.c: Add a MODULE_LICENSE() tag to avoid accidentally tainting the kernel. (maple_init): Further cleanup. Make sure kmapled gets shot when request_irq() fails .. also remember to exit_maple_low() to get rid of some of those pesky allocations. (init_maple_low): Free up maple_sendbuf in the event that request_irq() fails. 2002-05-01 M. R. Brown <mr...@0x...> * arch/sh/kernel/io_dc.c (dreamcast_isa_port2addr): Fixed offset returned for 0x1f0-0x1f7 addresses. Initial IDE support. * include/asm-sh/ide.h (ide_default_irq_dreamcast): New function. (ide_default_irq): Added check for MACH_DREAMCAST. * include/asm-sh/dc_sysasic.h: Added HW_EVENT_EXT0. Renamed HW_EVENT_EXTERNAL to HW_EVENT_EXT1. * arch/sh/kernel/pci-dc.c: We now use HW_EVENT_EXT1. * arch/sh/kernel/io_dc.c (dreamcast_isa_port2addr): Added checks for primary IDE command and control (status) registers. * include/asm-sh/ide.h, arch/sh/kernel/io_dc.c: Imported from LinuxSH 2.4.18. * Makefile: Added. Add "-dc" to EXTRAVERSION to distinguish ourselves from LinuxSH kernels. Sync'd tree against LinuxSH 2.4.18. * AGAINST-2.4.18: Added file. * AGAINST-2.4.16: Removed file. * arch/sh/mm/Makefile, drivers/char/Makefile, drivers/maple/Config.in, drivers/maple/Makefile, Documentation/Configure.help: Merged changes from LinuxSH 2.4.18. 2002-03-20 Adrian McMenamin <ad...@mc...> Changed config.in file to reflect Puru Puru driver only supports NAKI rockerpak at present * drivers/char/joystick/Config.in: Puru Puru pack driver support correctly described 2002-03-14 Adrian McMenamin <ad...@mc...> Fixed (mostly) hot plugging code in Puru Puru driver * drivers/char/joystick/purupuru.c: Fixed hot plugging code. May still be problems when other devices are repeatedly plugged and unplugged 2002-03-07 Adrian McMenamin <ad...@mc...> Fixed multiple device support in Puru Puru driver * drivers/char/joystick/purupuru.c: Fixed multiple device support 2002-02-22 Adrian McMenamin <ad...@mc...> Implemented tasklet in Puru Puru driver * drivers/char/joystick/purupuru.c: Moved most interrupt handling code into tasklet 2002-02-21 Adrian McMenamin <ad...@mc...> Puru Puru (rumble) Pack support added * drivers/char/joystick/purupuru.c: Support for Puru Puru (rumble) Pack added. Tested as both module and built-in. * drivers/char/joystick/Config.in: New file * drivers/char/joystick/Makefile: New file 2002-02-03 Fredrik Hubinette <hu...@hu...> * drivers/maple/maple.c: Devices are now automatically connected to their approperiate drivers when a new driver is loaded. This should make developing maple modules significantly more convenient. 2002-01-30 Adrian McMenamin <ad...@mc...> Fixed minor closedown bug in sound driver * drivers/sound/aica/main.c: Modified with bug fix 2002-01-27 Adrian McMenamin <ad...@mc...> Removed C++ style comments * drivers/sound/aica/main.c: Removed C++ style comments 2002-01-26 Adrian McMenamin <ad...@mc...> Cleaned up some more sound driver code * drivers/sound/aica/main.c: Removed some more redundant code 2002-01-23 M. R. Brown <mr...@0x...> Split HEAD into older 2.4 Maple branch. Imported Fredrik Hubinette's Maple update and lightgun patch. * drivers/char/Makefile, drivers/char/joystick/maplecontrol.c, drivers/char/maple_keyb.c, drivers/char/maplemouse.c, drivers/maple/maple.c, drivers/video/pvr2fb, include/linux/maple.h: Modified by Fredrik Hubinette's Maple patch. * drivers/char/maple_lg.c: New file (from Maple patch). * drivers/char/Makefile: New file. * drivers/char/joystick: Added directory. * drivers/char/joystick/maplecontrol.c: New file. * drivers/char/maple_keyb.c: New file. * drivers/char/maplemouse.c: New file. * include/linux: Added directory. * include/linux/maple.h: New file. * drivers/maple/maple.c: Removed. * include/asm-sh/maple.h: Removed. 2002-01-18 Adrian McMenamin <ad...@mc...> Cleaned up AICA driver * drivers/sound/aica/main.c: Removed dead code, optimised other bits 2002-01-09 M. R. Brown <mr...@0x...> Imported Adrian McMenamin's AICA sound driver. * drivers/sound/Config.in: Added CONFIG_SOUND_AICA. * drivers/sound/Makefile: Added Yamaha AICA support. * drivers/sound/aica: Added directory. * drivers/sound/aica/main.c: New file. This is Adrian's original aica.c renamed to keep the Makefile coherent. * drivers/sound/aica/arm7.h: New file. * drivers/sound/aica/Makefile: New file. * drivers/sound/aica/firmware: Added directory. * drivers/sound/aica/firmware/Makefile: New file. * drivers/sound/aica/firmware/aica.h: New file. * drivers/sound/aica/firmware/aica.c: New file. * drivers/sound/aica/firmware/aica_cmd_iface.h: New file. * drivers/sound/aica/firmware/bin2hex.pl: New file. * drivers/sound/aica/firmware/crt0.s: New file. * drivers/sound/aica/firmware/main.c: New file. * drivers/sound/aica/firmware/prog.elf: New file. * drivers/sound/aica/firmware/stream.drv: New file. * ChangeLog-2001.dc: New file. Rotated original changelog. * driver/sound: Added directory. * driver/sound/Makefile: New file, from Linus 2.4.16. * driver/sound/Config.in: New file, from Linus 2.4.16. Index: ChangeLog.dc =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/ChangeLog.dc,v retrieving revision 1.56.2.25 retrieving revision 1.56.2.26 diff -u -d -r1.56.2.25 -r1.56.2.26 --- ChangeLog.dc 13 May 2003 22:32:33 -0000 1.56.2.25 +++ ChangeLog.dc 19 Jul 2003 21:56:28 -0000 1.56.2.26 @@ -17,424 +17,3 @@ * fs/vmufs/super.c: Further write support * fs/vmufs/inode.c: Further write support -2002-11-20 Adrian McMenamin <ad...@mc...> - - First write code (may now delete files) added to vmufs. - BEFORE YOU USE THIS MAKE SURE YOU UNDERSTAND WHAT - THE GPL SAYS ABOUT "NO WARRANTY". NO WARRANTY IS - OFFERED. If you want to keep your vmu the way it - is - don't use this code! - - * fs/vmufs/super.c: First write support added - * fs/vmufs/inode.c: First write support added - - -2002-11-13 Adrian McMenamin <ad...@mc...> - - * fs/vmufs/super.c: Fixes to file mode code - -2002-11-10 Adrian McMenamin <ad...@mc...> - - Moving vmufs towards device independence - - * fs/vmufs/vmufs.h: Moving away from mtd layer - * fs/vmufs/inode.c: Taking out mtd layer code - * fs/vmufs/super.c: Removing mtd layer code - - -2002-11-08 Adrian McMenamin <ad...@mc...> - - Code tidied up before starting work on writing - - * fs/vmufs/inode.c: General tidy up - * fs/vmufs/super.c: General tidy up - -2002-11-06 Adrian McMenamin <ad...@mc...> - - * fs/vmufs/inode.c: further fixes to handle large - number of vmu files - * fs/vmufs/super.c: further fixes - - -2002-11-05 Adrian McMenamin <ad...@mc...> - - * fs/vmufs/inode.c: Code now handles more than 16 - files on one vmu flash slab - - -2002-11-04 Adrian McMenamin <ad...@mc...> - - Further vmufs improvements/clean ups - - * fs/vmufs/super.c: Make bcd conversion function inline - * fs/vmufs/inode.c: Traverse through FAT rather than - simply assume all files saved in sequential order - - -2002-11-03 M. R. Brown <mr...@li...> - - * drivers/mtd/maps/vmu-flash.c (dc_flashmap_connect): Assign name - based on the connected port and unit. - - Dreamcast internal flash support (read tested only). - - * drivers/mtd/chips/jedec_probe.c: New file, imported from stock - 2.4.20-pre11. Add device and chip type for the Fujitsu MBM29LV002TC. - - * drivers/mtd/maps/dreamcast-flash.c: New file. - * drivers/mtd/maps/Config.in: Add CONFIG_MTD_DREAMCAST. - * drivers/mtd/maps/Makefile: Add target for CONFIG_MTD_DREAMCAST. - -2002-11-03 Paul Mundt <le...@li...> - - * fs/vmufs/super.c (vmufs_read_super): Free up the root inode - if the root dentry allocation fails. Clear out inode mode fmt - and force to directory/regular file in certain cases. - * fs/vmufs/inode.c (vmufs_readdir): Rework some of the filldir - semantics. - * fs/vmufs/vmufs_inode.c: Renamed to inode.c, ran through indent, - some general cleanup. - * fs/vmufs/vmufs_sblock.c: Renamed to super.c, also ran through - indent and cleaned up some. - -2002-11-03 Adrian McMenamin <ad...@mc...> - - Further VMU fs cleanup - * fs/vmufs/inode.c: Redundant code removed - * fs/vmufs/super.c: Force directory and regular file types - - seems to fix problems with remounts - - Initial VMU File System Support added: - * fs/vmufs/vmufs.h: New file - * fs/vmufs/vmufs_inode.c: New file - * fs/vmufs/vmufs_sblock.c: New file - * fs/vmufs: Directory added - -2002-11-02 M. R. Brown <mr...@li...> - - * fs/vmufs/vmufs.h: Add extern to struct declaration so that they - won't be multiply defined. - - * fs/Config.in, fs/vmufs/Makefile: Fix typos. - - * fs/Config.in: Add CONFIG_VMU_FS. - * fs/Makefile.in: Add target for CONFIG_VMU_FS. - - * fs/vmufs/Makefile: New file. - - * fs/Config.in, fs/Makefile: Add files from Linux 2.4.20-pre11. - -2002-11-01 M. R. Brown <mr...@li...> - - From Mike Barnett: - * drivers/maple/maple.c (maple_dma_irq): Make sure - maple_detect_callback() is called if the previous command was - MAPLE_COMMAND_DEVINFO. - -2002-10-26 M. R. Brown <mr...@li...> - - * Documentation/Configure.help, drivers/sound/Config.in: Fix merge - breakage. - - Linux-SH 2.4.20-pre11 - - * AGAINST-2.4.20-pre11: New file. - * AGAINST-2.4.19: Remove. - - * Documentation/Configure.help, Makefile, arch/sh/config.in, - drivers/char/drm/Config.in, drivers/char/drm/Makefile, - drivers/char/Makefile, drivers/mtd/maps/Config.in, - drivers/mtd/maps/Makefile, drivers/sound/Config.in: Merge changes from - Linux-SH 2.4.20-pre11. - - Linux-SH 2.4.19 - - * AGAINST-2.4.19: New file. - * AGAINST-2.4.18: Removed. - - * Makefile, drivers/mtd/maps/Makefile, drivers/sound/Config.in, - drivers/sound/Makefile: Merge changes from Linux-SH 2.4.19. - -2002-10-18 Adrian McMenamin <ad...@mc...> - - * drivers/sound/aica/main.c: Parameterised - loading added (insmod aica sleeps=1 to lighten - load on system from driver playing back - high sample rate sounds) - - -2002-09-20 Adrian McMenamin <ad...@mc...> - - vmublk files removed as they only saved 1.25k - on a zImage compile. Currently these files can - also been seen at sf project vmublk - - * drivers/mtd/devices: Directory removed - - -2002-09-18 Adrian McMenamin <ad...@mc...> - - vmublk - a thin vmu block device added. This is - thin (and non-cacheing) alternative to mtdblock. - mtdblock is designed for large erasesize mtds, - vmublk is a thinner alternative (though mtdblock - can be used) for the vmu. - - * drivers/mtd/devices/Config.in: fixed - * drivers/mtd/devices/vmublk.c: tidied - - * drivers/mtd/devices/Makefile: Makefile support - - *drivers/mtd/devices/Config.in: support for vmu - block device added - - *drivers/mtd/devices/vmublk.c: vmu block device - driver added - - *drivers/mtd/devices: directory added - - *fs/vmuflash-fs.c: File removed - - -2002-09-16 Adrian McMenamin <ad...@mc...> - - *fs/vmuflash-fs.c: Module can now be removed as - well as loaded - - -2002-09-15 Adrian McMenamin <ad...@mc...> - - *fs/vmuflash-fs.c : Cleaned and improved - - Initial check-in of vmu flash file system - - *fs : directory added - *fs/vmuflash-fs.c : initial check-in - - -2002-09-11 Adrian McMenamin <ad...@mc...> - - * drivers/mtd/maps/vmu-flash.c: Code cleaned-up - - -2002-09-10 Adrian McMenamin <ad...@mc...> - - * drivers/mtd/maps/vmu-flash.c: Multiple - vmu devices now supported - - -2002-09-03 Adrian McMenamin <ad...@mc...> - - * drivers/mtd/maps/vmu-flash.c: Writes now - cached - - -2002-09-01 Adrian McMenamin <ad...@mc...> - - VMU writes now working - but slowly and code - needs to be cleaned. Beware of writing over - saved game data! - - * drivers/mtd/maps/vmu-flash.c: Phased writing - now in place and appears to work using kernel - 'flat' char and cached block drivers. - -2002-08-31 Adrian McMenamin <ad...@mc...> - - VMU reads now work - - * drivers/mtd/maps/vmu-flash.c: memcopy code - corrected and further diagnostic code inserted - - now correctly reads VMU data. Writes to follow. - -2002-08-31 Adrian McMenamin <ad...@mc...> - - * drivers/mtd/maps/vmu-flash.c: Code corrected - -2002-08-31 Adrian McMenamin <ad...@mc...> - - Enhanced diagnostics of flash chips - reading now broadly works - - * drivers/mtd/maps/vmu-flash.c: Further code updates - -2002-08-28 Adrian McMenamin <ad...@mc...> - - * drivers/mtd/maps/vmu-flash.c: Updated code - almost works - -2002-08-24 Adrian McMenamin <ad...@mc...> - - * drivers/mtd/maps/vmu-flash.c: Cleaned up kmalloc code - * drivers/sound/microphone.c: Made clear this is licensed - under GPL - -2002-08-22 Adrian McMenamin <ad...@mc...> - - * drivers/sound/microphone.c: Very experimental microphone - driver code (not working at present) - - -2002-08-22 Adrian McMenamin <ad...@mc...> - - * drivers/mtd/maps/vmu-flash.c: Updated and semi-working VMU - flash driver - - -2002-05-01 Paul Mundt <le...@ch...> - - * Makefile: Set ARCH explicitly to sh. - - * drivers/maple/maple.c: Add a MODULE_LICENSE() tag to avoid - accidentally tainting the kernel. - - (maple_init): Further cleanup. Make sure kmapled gets shot when - request_irq() fails .. also remember to exit_maple_low() to get - rid of some of those pesky allocations. - - (init_maple_low): Free up maple_sendbuf in the event that - request_irq() fails. - -2002-05-01 M. R. Brown <mr...@0x...> - - * arch/sh/kernel/io_dc.c (dreamcast_isa_port2addr): Fixed offset - returned for 0x1f0-0x1f7 addresses. - - Initial IDE support. - - * include/asm-sh/ide.h (ide_default_irq_dreamcast): New function. - (ide_default_irq): Added check for MACH_DREAMCAST. - * include/asm-sh/dc_sysasic.h: Added HW_EVENT_EXT0. Renamed - HW_EVENT_EXTERNAL to HW_EVENT_EXT1. - * arch/sh/kernel/pci-dc.c: We now use HW_EVENT_EXT1. - * arch/sh/kernel/io_dc.c (dreamcast_isa_port2addr): Added checks for - primary IDE command and control (status) registers. - * include/asm-sh/ide.h, arch/sh/kernel/io_dc.c: Imported from LinuxSH - 2.4.18. - - * Makefile: Added. Add "-dc" to EXTRAVERSION to distinguish ourselves - from LinuxSH kernels. - - Sync'd tree against LinuxSH 2.4.18. - - * AGAINST-2.4.18: Added file. - * AGAINST-2.4.16: Removed file. - - * arch/sh/mm/Makefile, drivers/char/Makefile, drivers/maple/Config.in, - drivers/maple/Makefile, Documentation/Configure.help: Merged changes - from LinuxSH 2.4.18. - -2002-03-20 Adrian McMenamin <ad...@mc...> - - Changed config.in file to reflect Puru Puru driver only supports NAKI rockerpak at present - - * drivers/char/joystick/Config.in: Puru Puru pack driver support correctly described - -2002-03-14 Adrian McMenamin <ad...@mc...> - - Fixed (mostly) hot plugging code in Puru Puru driver - - * drivers/char/joystick/purupuru.c: Fixed hot plugging code. May still - be problems when other devices are repeatedly plugged and unplugged - -2002-03-07 Adrian McMenamin <ad...@mc...> - - Fixed multiple device support in Puru Puru driver - - * drivers/char/joystick/purupuru.c: Fixed multiple device - support - -2002-02-22 Adrian McMenamin <ad...@mc...> - - Implemented tasklet in Puru Puru driver - - * drivers/char/joystick/purupuru.c: Moved most interrupt - handling code into tasklet - -2002-02-21 Adrian McMenamin <ad...@mc...> - - Puru Puru (rumble) Pack support added - - * drivers/char/joystick/purupuru.c: Support for Puru Puru - (rumble) Pack added. Tested as both module and built-in. - * drivers/char/joystick/Config.in: New file - * drivers/char/joystick/Makefile: New file - -2002-02-03 Fredrik Hubinette <hu...@hu...> - - * drivers/maple/maple.c: Devices are now automatically connected - to their approperiate drivers when a new driver is loaded. This - should make developing maple modules significantly more convenient. - -2002-01-30 Adrian McMenamin <ad...@mc...> - - Fixed minor closedown bug in sound driver - - * drivers/sound/aica/main.c: Modified with bug fix - -2002-01-27 Adrian McMenamin <ad...@mc...> - - Removed C++ style comments - - * drivers/sound/aica/main.c: Removed C++ style comments - -2002-01-26 Adrian McMenamin <ad...@mc...> - - Cleaned up some more sound driver code - - * drivers/sound/aica/main.c: Removed some more redundant code - -2002-01-23 M. R. Brown <mr...@0x...> - - Split HEAD into older 2.4 Maple branch. Imported Fredrik Hubinette's - Maple update and lightgun patch. - - * drivers/char/Makefile, drivers/char/joystick/maplecontrol.c, - drivers/char/maple_keyb.c, drivers/char/maplemouse.c, - drivers/maple/maple.c, drivers/video/pvr2fb, include/linux/maple.h: - Modified by Fredrik Hubinette's Maple patch. - * drivers/char/maple_lg.c: New file (from Maple patch). - - * drivers/char/Makefile: New file. - * drivers/char/joystick: Added directory. - * drivers/char/joystick/maplecontrol.c: New file. - * drivers/char/maple_keyb.c: New file. - * drivers/char/maplemouse.c: New file. - * include/linux: Added directory. - * include/linux/maple.h: New file. - - * drivers/maple/maple.c: Removed. - * include/asm-sh/maple.h: Removed. - -2002-01-18 Adrian McMenamin <ad...@mc...> - - Cleaned up AICA driver - - * drivers/sound/aica/main.c: Removed dead code, optimised other bits - -2002-01-09 M. R. Brown <mr...@0x...> - - Imported Adrian McMenamin's AICA sound driver. - - * drivers/sound/Config.in: Added CONFIG_SOUND_AICA. - * drivers/sound/Makefile: Added Yamaha AICA support. - - * drivers/sound/aica: Added directory. - * drivers/sound/aica/main.c: New file. This is Adrian's original - aica.c renamed to keep the Makefile coherent. - * drivers/sound/aica/arm7.h: New file. - * drivers/sound/aica/Makefile: New file. - * drivers/sound/aica/firmware: Added directory. - * drivers/sound/aica/firmware/Makefile: New file. - * drivers/sound/aica/firmware/aica.h: New file. - * drivers/sound/aica/firmware/aica.c: New file. - * drivers/sound/aica/firmware/aica_cmd_iface.h: New file. - * drivers/sound/aica/firmware/bin2hex.pl: New file. - * drivers/sound/aica/firmware/crt0.s: New file. - * drivers/sound/aica/firmware/main.c: New file. - * drivers/sound/aica/firmware/prog.elf: New file. - * drivers/sound/aica/firmware/stream.drv: New file. - - * ChangeLog-2001.dc: New file. Rotated original changelog. - - * driver/sound: Added directory. - * driver/sound/Makefile: New file, from Linus 2.4.16. - * driver/sound/Config.in: New file, from Linus 2.4.16. |
From: Adrian M. <zx8...@us...> - 2003-05-13 22:32:36
|
Update of /cvsroot/linuxdc/linux-sh-dc In directory sc8-pr-cvs1:/tmp/cvs-serv23937 Modified Files: Tag: linux-sh-dc-2_4-branch ChangeLog.dc Log Message: Updated vmufs with more write support: BEWARE - experimental code Index: ChangeLog.dc =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/ChangeLog.dc,v retrieving revision 1.56.2.24 retrieving revision 1.56.2.25 diff -u -d -r1.56.2.24 -r1.56.2.25 --- ChangeLog.dc 3 May 2003 16:34:23 -0000 1.56.2.24 +++ ChangeLog.dc 13 May 2003 22:32:33 -0000 1.56.2.25 @@ -1,10 +1,19 @@ +2003-05-13 Adrian McMenamin <ad...@mc...> + + Further work on VMUFS - improved write support + + * fs/vmufs/vmufs.h: Further write support + * fs/vmufs/super.c: Further write support + * fs/vmufs/inode.c: Further write support + + 2003-05-03 Adrian McMenamin <ad...@mc...> Further write code added to vmufs. PLEASE REMEMBER THAT NO WARRANTY IS OFFERED. Only use this code on a vmu you are prepared to see get trashed! - * fs/vmufs/inode.h: Further write support + * fs/vmufs/vmufs.h: Further write support * fs/vmufs/super.c: Further write support * fs/vmufs/inode.c: Further write support |
From: Adrian M. <zx8...@us...> - 2003-05-13 22:29:30
|
Update of /cvsroot/linuxdc/linux-sh-dc/fs/vmufs In directory sc8-pr-cvs1:/tmp/cvs-serv22192/fs/vmufs Modified Files: Tag: linux-sh-dc-2_4-branch vmufs.h inode.c super.c Log Message: Updated vmufs with more write support: BEWARE - experimental code Index: vmufs.h =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/fs/vmufs/Attic/vmufs.h,v retrieving revision 1.1.2.4 retrieving revision 1.1.2.5 diff -u -d -r1.1.2.4 -r1.1.2.5 --- vmufs.h 3 May 2003 16:31:14 -0000 1.1.2.4 +++ vmufs.h 13 May 2003 22:29:26 -0000 1.1.2.5 @@ -8,6 +8,8 @@ #define VMUFS_NAMELEN 12 +#define VMUFS_ZEROBLOCK 32768 + extern struct inode_operations vmufs_inode_operations; extern struct inode_operations vmufs_file_inode_operations; Index: inode.c =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/fs/vmufs/Attic/inode.c,v retrieving revision 1.1.2.16 retrieving revision 1.1.2.17 diff -u -d -r1.1.2.16 -r1.1.2.17 --- inode.c 3 May 2003 16:31:14 -0000 1.1.2.16 +++ inode.c 13 May 2003 22:29:26 -0000 1.1.2.17 @@ -62,6 +62,7 @@ bh->b_data + 4 + (fno % 0x10) * 0x20, 12); + fno++; if ((fno / 0x10) > (vmudetails->dir_bnum - blck_read)) { brelse(bh); @@ -84,7 +85,12 @@ /* No files at all */ return ERR_PTR(error); } - if (memcmp(dent->d_name.name, first_one->fname, 12) != 0) { + int filenamelen = strlen(dent->d_name.name); + if (filenamelen > 12) + filenamelen = 12; + if (memcmp + (dent->d_name.name, first_one->fname, + filenamelen) != 0) { if (first_one->next) { first_one = first_one->next; kfree(first_one->prev); @@ -138,7 +144,7 @@ { /* Create an inode */ if (de->d_name.len > VMUFS_NAMELEN) - return (ERR_PTR(-ENAMETOOLONG)); + return -ENAMETOOLONG; int y; struct inode *inode; @@ -157,7 +163,7 @@ /* Is this an executible file? */ if (imode & 73) { /*Octal 111 */ - inode->i_ino = 0; + inode->i_ino = VMUFS_ZEROBLOCK; /* But this already allocated? */ bh_fat = bread(sb->s_dev, vmudetails->fat_bnum, @@ -173,7 +179,7 @@ } else { /*Look for a free block in the FAT */ - long nextblock = 199; /*TO DO: Make this portable */ + long nextblock = vmudetails->numblocks - 1; bh_fat = bread(sb->s_dev, vmudetails->fat_bnum, sb->s_blocksize); @@ -226,14 +232,22 @@ /* Have the directory entry * so now update it */ int z = (y % 0x10) * 0x20; - if (inode->i_ino != 0) + if (inode->i_ino != VMUFS_ZEROBLOCK) bh->b_data[z] = 0x33; /* data file */ else bh->b_data[z] = 0xcc; if ((bh->b_data[z + 1] != (char) 0x00) && (bh->b_data[z + 1] != (char) 0xff)) bh->b_data[z + 1] = (char) 0x00; - ((__u16 *) bh->b_data)[z / 2 + 1] = cpu_to_le16(inode->i_ino); + if (inode->i_ino != VMUFS_ZEROBLOCK) { + ((__u16 *) bh->b_data)[z / 2 + 1] = + cpu_to_le16(inode->i_ino); + ((__u16 *) bh->b_data)[z / 2 + 0x0D] = 0; + } else { + ((__u16 *) bh->b_data)[z / 2 + 1] = 0; + ((__u16 *) bh->b_data)[z / 2 + 0x0D] = 1; + } + /* Name */ memset((char *) (bh->b_data + z + 0x04), '\0', 0x0C); memcpy((char *) (bh->b_data + z + 0x04), ((de->d_name).name), @@ -274,10 +288,6 @@ ((__u16 *) bh->b_data)[z / 2 + 0x0C] = cpu_to_le16(inode->i_blocks); - if (inode->i_ino != 0) - ((__u16 *) bh->b_data)[z / 2 + 0x0D] = 0; - else - ((__u16 *) bh->b_data)[z / 2 + 0x0D] = 1; /*game */ inode->i_mtime = unix_date; mark_buffer_dirty(bh); brelse(bh); @@ -309,6 +319,7 @@ int vmufs_readdir(struct file *filp, void *dirent, filldir_t filldir) { + int filenamelen; struct dentry *dentry = filp->f_dentry; struct inode *inode = dentry->d_inode; struct super_block *sb = inode->i_sb; @@ -353,8 +364,7 @@ bh = bread(sb->s_dev, blck_read, 512); } - saved_file->ftype = - ((__u8 *) bh->b_data)[0 + ((i - 2) % 0x10) * 0x20]; + saved_file->ftype = bh->b_data[((i - 2) % 0x10) * 0x20]; if (saved_file->ftype == 0) break; @@ -364,12 +374,16 @@ ((i - 2) % 0x10) * 0x10]); + if (saved_file->fblk == 0) + saved_file->fblk = VMUFS_ZEROBLOCK; /*Make sure we can see file */ memcpy(saved_file->fname, bh->b_data + 4 + ((i - 2) % 0x10) * 0x20, 12); - + filenamelen = strlen(saved_file->fname); + if (filenamelen > 12) + filenamelen = 12; if (filldir - (dirent, saved_file->fname, 12, i++, saved_file->fblk, - DT_REG) < 0) { + (dirent, saved_file->fname, filenamelen, i++, + saved_file->fblk, DT_REG) < 0) { goto finish; } @@ -393,10 +407,61 @@ int vmufs_game_write(struct file *file, const char *buf, char *writebuf, - size_t count) + size_t count, loff_t * ppos) { - /* Assume this is a game */ - return -EIO; + __u16 fatdata; + struct buffer_head *bh_fat, *bh; + struct inode *in = (file->f_dentry)->d_inode; + struct super_block *sb = in->i_sb; + struct memcard *vmudetails = + ((struct memcard *) sb->u.generic_sbp); + + unsigned long blkoffset = *ppos >> in->i_sb->s_blocksize_bits; + if (blkoffset < 1) { + /* Additional sanity check */ + kfree(writebuf); + return -EIO; + } + unsigned long blksize = in->i_blksize; + + /* Is the next block free in the VMU? */ + bh_fat = bread(in->i_sb->s_dev, vmudetails->fat_bnum, blksize); + fatdata = ((__u16 *) bh_fat->b_data)[(__u16) blkoffset]; + + if (fatdata != 0xfffc) { + printk(KERN_ERR + "vmufs: Cannot save game file - insufficient linear space\n"); + kfree(writebuf); + return -EFBIG; + } + + /*Now we have the space - write the block out */ + bh = bread(sb->s_dev, blkoffset, in->i_blksize); + if (count < in->i_blksize) + memset((char *) (bh->b_data), '\0', in->i_blksize); + memcpy((char *) (bh->b_data), writebuf, count); + mark_buffer_dirty(bh); + brelse(bh); + in->i_size += in->i_blksize; + in->i_blocks++; + /*Now update the FAT */ + + + ((__u16 *) (bh_fat->b_data))[(__u16) blkoffset] = 0xfffa; + ((__u16 *) (bh_fat->b_data))[((__u16) (blkoffset - 1))] = + cpu_to_le16(blkoffset); + mark_buffer_dirty(bh_fat); + + + brelse(bh_fat); + + + kfree(writebuf); + *ppos += count; + return count; + + + } ssize_t vmufs_file_write(struct file * file, const char *buf, size_t count, @@ -429,65 +494,62 @@ copy_from_user(writebuf, buf, count); - if (in->i_ino == 0) { - vmufs_game_write(file, buf, writebuf, count); - } else { - /* We have a data file - - * so let's write it out to - * the vmu */ + /* Handle game files */ + unsigned long inode_num = in->i_ino; + if (inode_num == VMUFS_ZEROBLOCK) + inode_num = 0; - /*Start by writing out to first block */ - if (blkoffset == 0) { - unsigned long currentblock = in->i_ino; - __u16 fatdata; - bh = bread(sb->s_dev, in->i_ino, in->i_blksize); - if (count < in->i_blksize) - memset((char *) (bh->b_data), '\0', - in->i_blksize); - memcpy((char *) (bh->b_data), writebuf, count); - mark_buffer_dirty(bh); - brelse(bh); - in->i_size = in->i_blksize; /* will increment as we grow */ - in->i_blocks = 1; - /* Update FAT */ - bh_fat = - bread(in->i_sb->s_dev, vmudetails->fat_bnum, - blksize); - /*Wipe out any old FAT records for this inode */ - do { - fatdata = - ((__u16 *) bh_fat-> - b_data)[(__u16) currentblock]; - if (fatdata == 0xfffc) - break; /* already empty */ - ((__u16 *) (bh_fat-> - b_data))[(__u16) currentblock] - = 0xfffc; - mark_buffer_dirty(bh_fat); - if (fatdata == 0xfffa) - break; /* end of file */ - } while (1); - /* Avoid writes to mtd if possible - * so check if a write is really - * required here */ + /*Start by writing out to first block */ + if (blkoffset == 0) { + unsigned long currentblock = inode_num; + __u16 fatdata; + bh = bread(sb->s_dev, inode_num, in->i_blksize); + if (count < in->i_blksize) + memset((char *) (bh->b_data), '\0', in->i_blksize); + memcpy((char *) (bh->b_data), writebuf, count); + mark_buffer_dirty(bh); + brelse(bh); + in->i_size = in->i_blksize; /* will increment as we grow */ + in->i_blocks = 1; + /* Update FAT */ + bh_fat = + bread(in->i_sb->s_dev, vmudetails->fat_bnum, blksize); + /*Wipe out any old FAT records for this inode */ + do { fatdata = ((__u16 *) bh_fat-> - b_data)[(__u16) (in->i_ino)]; - if (fatdata != 0xfffa) { - ((__u16 *) (bh_fat->b_data))[(__u16) (in-> - i_ino)] - = 0xfffa; - mark_buffer_dirty(bh_fat); - } - brelse(bh_fat); - + b_data)[(__u16) currentblock]; + if (fatdata == 0xfffc) + break; /* already empty */ + ((__u16 *) (bh_fat->b_data))[(__u16) currentblock] + = 0xfffc; + mark_buffer_dirty(bh_fat); + if (fatdata == 0xfffa) + break; /* end of file */ + } while (1); + /* Avoid writes to mtd if possible + * so check if a write is really + * required here */ + fatdata = ((__u16 *) bh_fat->b_data)[(__u16) (inode_num)]; + if (fatdata != 0xfffa) { + ((__u16 *) (bh_fat->b_data))[(__u16) (inode_num)] + = 0xfffa; + mark_buffer_dirty(bh_fat); } - /* Now every other block */ - else { + brelse(bh_fat); + + } + /* Now every other block */ + else { + if (inode_num == 0) { + return vmufs_game_write(file, buf, writebuf, count, + ppos); + } else { + /*Look for a free block in the FAT */ __u16 fatdata; - unsigned long nextblock = in->i_ino - 1; + unsigned long nextblock = inode_num - 1; bh_fat = bread(in->i_sb->s_dev, vmudetails->fat_bnum, blksize); @@ -525,7 +587,7 @@ 0xfffa; mark_buffer_dirty(bh_fat); } - int previousblock = in->i_ino; + int previousblock = inode_num; do { fatdata = ((__u16 *) bh_fat-> @@ -534,7 +596,7 @@ || (fatdata == 0xfffa)) { ((__u16 *) bh_fat-> b_data)[previousblock] = - nextblock; + cpu_to_le16(nextblock); mark_buffer_dirty(bh_fat); break; } @@ -563,6 +625,9 @@ loff_t * ppos) { struct inode *in = file->f_dentry->d_inode; + unsigned long inode_num = in->i_ino; + if (inode_num == VMUFS_ZEROBLOCK) + inode_num = 0; unsigned long blkoffset = *ppos >> in->i_sb->s_blocksize_bits; unsigned long blksize = in->i_blksize; unsigned long blcks_to_read, x; @@ -586,7 +651,7 @@ readbuf = kmalloc(count, GFP_KERNEL); /* Traverse through FAT to read the blocks in */ x = 0; - next_block = in->i_ino; + next_block = inode_num; bh_fat = bread(in->i_sb->s_dev, vmudetails->fat_bnum, blksize); /*Walk through to where we are */ if (blkoffset > 0) { Index: super.c =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/fs/vmufs/Attic/super.c,v retrieving revision 1.1.2.15 retrieving revision 1.1.2.16 diff -u -d -r1.1.2.15 -r1.1.2.16 --- super.c 3 May 2003 16:31:14 -0000 1.1.2.15 +++ super.c 13 May 2003 22:29:26 -0000 1.1.2.16 @@ -94,15 +94,22 @@ in->i_version = ++event; brelse(bh); } else { - int blck_read = vmudetails->dir_bnum; - struct buffer_head *bh = bread(sb->s_dev, blck_read, 512); - int y; - if (in->i_ino > (vmudetails->dir_len * 0x10)) { + if ((in->i_ino > vmudetails->numblocks) + && (in->i_ino != VMUFS_ZEROBLOCK)) { /* Not here */ - brelse(bh); + printk(KERN_INFO + "vmufs: Attempt to access file which cannot exist on this size of VMU\n"); return; } + unsigned long inode_num = in->i_ino; + if (inode_num == VMUFS_ZEROBLOCK) + inode_num = 0; + + int blck_read = vmudetails->dir_bnum; + struct buffer_head *bh = bread(sb->s_dev, blck_read, 512); + int y; + /* * Do the same here.. clear out the old mask, and force @@ -114,7 +121,7 @@ in->i_mode |= S_IFREG; /* Scan through the directory to find the matching file */ - for (y = 0; y < (vmudetails->dir_len * 0x10); y++) { + for (y = 0; y < vmudetails->numblocks; y++) { if ((y / 0x10) > (vmudetails->dir_bnum - blck_read)) { brelse(bh); @@ -123,12 +130,14 @@ } if (le16_to_cpu (((__u16 *) bh->b_data)[(y % 0x10) * 0x10 + - 0x01]) == in->i_ino) + 0x01]) == inode_num) break; } - if (y >= (vmudetails->dir_len * 0x10)) { + if (y >= vmudetails->numblocks) { brelse(bh); + printk(KERN_INFO + "vmufs: could not find this file on the vmu\n"); /* TO DO: error return required */ return; } @@ -176,7 +185,7 @@ 0x0C]); in->i_size = in->i_blocks * 512; in->i_blksize = 512; - + /*printk(KERN_INFO "File has inode %i and is %i bytes long\n", in->i_ino, in->i_size); */ brelse(bh); } } @@ -215,7 +224,8 @@ int z, y, x, blck_read; __u16 nextblock, fatdata; - + if (in->i_ino == VMUFS_ZEROBLOCK) + in->i_ino = 0; sb = in->i_sb; vmudetails = (struct memcard *) sb->u.generic_sbp; bh = bread(sb->s_dev, vmudetails->fat_bnum, in->i_blksize); @@ -298,21 +308,22 @@ { struct buffer_head *bh; + unsigned long inode_num; int y, blck_read, name_len; struct super_block *sb = in->i_sb; struct memcard *vmudetails = ((struct memcard *) sb->u.generic_sbp); - - printk(KERN_INFO "In vmufs_write_inode\n"); - + if (in->i_ino == VMUFS_ZEROBLOCK) + inode_num = 0; + else + inode_num = in->i_ino; /* update the directory and inode details */ - /* Now search for the directory entry */ blck_read = vmudetails->dir_bnum; bh = bread(sb->s_dev, blck_read, in->i_blksize); - for (y = 0; y < (vmudetails->dir_len * 0x10); y++) { + for (y = 0; y < vmudetails->numblocks; y++) { if ((y / 0x10) > (vmudetails->dir_bnum - blck_read)) { brelse(bh); blck_read--; @@ -320,20 +331,20 @@ } if (le16_to_cpu (((__u16 *) bh->b_data)[(y % 0x10) * 0x10 + - 0x01]) == in->i_ino) + 0x01]) == inode_num) break; } /* Have the directory entry * so now update it */ int z = (y % 0x10) * 0x20; - if (in->i_ino != 0) + if (inode_num != 0) bh->b_data[z] = 0x33; /* data file */ else bh->b_data[z] = 0xcc; if ((bh->b_data[z + 1] != (char) 0x00) && (bh->b_data[z + 1] != (char) 0xff)) bh->b_data[z + 1] = (char) 0x00; - ((__u16 *) bh->b_data)[z / 2 + 1] = cpu_to_le16(in->i_ino); + ((__u16 *) bh->b_data)[z / 2 + 1] = cpu_to_le16(inode_num); /* BCD timestamp it */ unsigned long unix_date = CURRENT_TIME; int year, day, nl_day, month; /*inspired by FAT driver */ @@ -369,10 +380,10 @@ bh->b_data[z + 0x16] = bcd_from_u8((__u8) (unix_date % 60)); ((__u16 *) bh->b_data)[z / 2 + 0x0C] = cpu_to_le16(in->i_blocks); - if (in->i_ino != 0) + if (inode_num != 0) ((__u16 *) bh->b_data)[z / 2 + 0x0D] = 0; else - ((__u16 *) bh->b_data)[z / 2 + 0x0D] = 1; /*game */ + ((__u16 *) bh->b_data)[z / 2 + 0x0D] = cpu_to_le16(1); /*game */ in->i_mtime = unix_date; mark_buffer_dirty(bh); brelse(bh); @@ -402,6 +413,14 @@ } + +/********************** + * vmufs_read_super * + * Read directory * + * locations off * + * superblock * + * ********************/ + static struct super_block *vmufs_read_super(struct super_block *sb, void *data, int silent) { @@ -426,20 +445,13 @@ struct memcard *vmudata = kmalloc(sizeof(struct memcard), GFP_KERNEL); - vmudata->numblocks = z; + + vmudata->numblocks = le16_to_cpu(((__u16 *) bh->b_data)[0x50 / 2]); /*User blocks */ vmudata->sb_bnum = z - 1; - vmudata->fat_bnum = z - 2; - if (z < 512) - vmudata->fat_len = 1; - else if (z == 512) - vmudata->fat_len = 2; - else - vmudata->fat_len = 4; - vmudata->dir_bnum = vmudata->fat_bnum - vmudata->fat_len; - if (z == 128) - vmudata->dir_len = 7; - else - vmudata->dir_len = 13 * (z / 256); + vmudata->fat_bnum = le16_to_cpu(((__u16 *) bh->b_data)[0x46 / 2]); + vmudata->fat_len = le16_to_cpu(((__u16 *) bh->b_data)[0x48 / 2]); + vmudata->dir_bnum = le16_to_cpu(((__u16 *) bh->b_data)[0x4a / 2]); + vmudata->dir_len = le16_to_cpu(((__u16 *) bh->b_data)[0x4c / 2]); sb->u.generic_sbp = vmudata; struct inode *root_i; |
From: Adrian M. <zx8...@us...> - 2003-05-03 16:34:26
|
Update of /cvsroot/linuxdc/linux-sh-dc In directory sc8-pr-cvs1:/tmp/cvs-serv8152 Modified Files: Tag: linux-sh-dc-2_4-branch ChangeLog.dc Log Message: Updated vmufs with more write support: BEWARE - experimental code Index: ChangeLog.dc =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/ChangeLog.dc,v retrieving revision 1.56.2.23 retrieving revision 1.56.2.24 diff -u -d -r1.56.2.23 -r1.56.2.24 --- ChangeLog.dc 20 Nov 2002 22:53:01 -0000 1.56.2.23 +++ ChangeLog.dc 3 May 2003 16:34:23 -0000 1.56.2.24 @@ -1,3 +1,13 @@ +2003-05-03 Adrian McMenamin <ad...@mc...> + + Further write code added to vmufs. PLEASE REMEMBER + THAT NO WARRANTY IS OFFERED. Only use this code on + a vmu you are prepared to see get trashed! + + * fs/vmufs/inode.h: Further write support + * fs/vmufs/super.c: Further write support + * fs/vmufs/inode.c: Further write support + 2002-11-20 Adrian McMenamin <ad...@mc...> First write code (may now delete files) added to vmufs. |
From: Adrian M. <zx8...@us...> - 2003-05-03 16:31:17
|
Update of /cvsroot/linuxdc/linux-sh-dc/fs/vmufs In directory sc8-pr-cvs1:/tmp/cvs-serv6932/fs/vmufs Modified Files: Tag: linux-sh-dc-2_4-branch inode.c super.c vmufs.h Log Message: Updated vmufs with more write support: BEWARE - experimental code Index: inode.c =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/fs/vmufs/Attic/inode.c,v retrieving revision 1.1.2.15 retrieving revision 1.1.2.16 diff -u -d -r1.1.2.15 -r1.1.2.16 --- inode.c 20 Nov 2002 22:53:00 -0000 1.1.2.15 +++ inode.c 3 May 2003 16:31:14 -0000 1.1.2.16 @@ -3,7 +3,7 @@ * * inode operations for the VMU file system * - * Copyright (C) 2002 Adrian McMenamin + * Copyright (C) 2002, 2003 Adrian McMenamin * Copyright (C) 2002 Paul Mundt * * This file is part of the LinuxDC project (linuxdc.sf.net). @@ -25,6 +25,10 @@ void *sbp = sb->u.generic_sbp; struct memcard *vmudetails = (struct memcard *) sbp; + if (dent->d_name.len > VMUFS_NAMELEN) + return (ERR_PTR(-ENAMETOOLONG)); + + long blck_read = vmudetails->dir_bnum; struct buffer_head *bh = bread(sb->s_dev, blck_read, 512); struct vmufs_file_info *first_one = NULL; @@ -32,6 +36,7 @@ int fno = 0; do { + /* Build a list of files in the directory */ struct vmufs_file_info *saved_file = kmalloc(sizeof(struct vmufs_file_info), GFP_KERNEL); saved_file->prev = last_one; @@ -75,6 +80,8 @@ if (first_one == NULL) { error = -ENOENT; + dent->d_inode = NULL; + /* No files at all */ return ERR_PTR(error); } if (memcmp(dent->d_name.name, first_one->fname, 12) != 0) { @@ -83,11 +90,17 @@ kfree(first_one->prev); } else { kfree(first_one); + dent->d_inode = NULL; + d_add(dent, NULL); error = -ENOENT; return ERR_PTR(error); } } else { ino = iget(sb, le16_to_cpu(first_one->fblk)); + if (!ino) { + error = -EACCES; + return (ERR_PTR(error)); + } break; } } while (1); @@ -120,11 +133,177 @@ return 0; } +static int vmufs_inode_create(struct inode *dir, struct dentry *de, + int imode) +{ + /* Create an inode */ + if (de->d_name.len > VMUFS_NAMELEN) + return (ERR_PTR(-ENAMETOOLONG)); + + int y; + struct inode *inode; + struct super_block *sb = dir->i_sb; + void *sbp = sb->u.generic_sbp; + struct memcard *vmudetails = (struct memcard *) sbp; + struct buffer_head *bh_fat, *bh; + __u16 fatdata; + + inode = new_inode(sb); + if (!inode) { + return -ENOSPC; + } + /* Walk through blocks looking for a new inode */ + + /* Is this an executible file? */ + if (imode & 73) { /*Octal 111 */ + inode->i_ino = 0; + /* But this already allocated? */ + bh_fat = + bread(sb->s_dev, vmudetails->fat_bnum, + sb->s_blocksize); + fatdata = ((__u16 *) bh_fat->b_data)[0]; + if (fatdata != 0xfffc) { + printk(KERN_ERR + "vmufs: cannot write executible file to vmu - block 0 already allocated.\n"); + brelse(bh_fat); + return -ENOSPC; + } + + } else { + /*Look for a free block in the FAT */ + + long nextblock = 199; /*TO DO: Make this portable */ + bh_fat = + bread(sb->s_dev, vmudetails->fat_bnum, + sb->s_blocksize); + do { + fatdata = ((__u16 *) bh_fat->b_data)[nextblock]; + if (fatdata == 0xfffc) + break; /*empty block */ + if (--nextblock < 0) + break; + } while (1); + if (nextblock < 0) { + iput(inode); + brelse(bh_fat); + return -ENOSPC; + } + inode->i_ino = nextblock; + } + brelse(bh_fat); + + + + + inode->i_uid = current->fsuid; + inode->i_gid = + (dir->i_mode & S_ISGID) ? dir->i_gid : current->fsgid; + inode->i_mtime = inode->i_atime = inode->i_ctime = CURRENT_TIME; + inode->i_blksize = sb->s_blocksize; + inode->i_mode = imode; + inode->i_blocks = 0; + inode->i_sb = sb; + insert_inode_hash(inode); + mark_inode_dirty(inode); + inode->i_op = &vmufs_inode_operations; + inode->i_fop = &vmufs_file_operations; + + /* Write to the directory */ + /* Now search for space for the directory entry */ + long blck_read = vmudetails->dir_bnum; + bh = bread(sb->s_dev, blck_read, inode->i_blksize); + + for (y = 0; y < (vmudetails->dir_len * 0x10); y++) { + if ((y / 0x10) > (vmudetails->dir_bnum - blck_read)) { + brelse(bh); + blck_read--; + bh = bread(sb->s_dev, blck_read, inode->i_blksize); + } + if (((bh->b_data)[(y % 0x10) * 0x20]) == 0) + break; + } + /* Have the directory entry + * so now update it */ + int z = (y % 0x10) * 0x20; + if (inode->i_ino != 0) + bh->b_data[z] = 0x33; /* data file */ + else + bh->b_data[z] = 0xcc; + if ((bh->b_data[z + 1] != (char) 0x00) + && (bh->b_data[z + 1] != (char) 0xff)) + bh->b_data[z + 1] = (char) 0x00; + ((__u16 *) bh->b_data)[z / 2 + 1] = cpu_to_le16(inode->i_ino); + /* Name */ + memset((char *) (bh->b_data + z + 0x04), '\0', 0x0C); + memcpy((char *) (bh->b_data + z + 0x04), ((de->d_name).name), + de->d_name.len); + /* BCD timestamp it */ + unsigned long unix_date = CURRENT_TIME; + int year, day, nl_day, month; /*inspired by FAT driver */ + day = unix_date / 86400 - 3652; + year = day / 365; + if ((year + 3) / 4 + 365 * year > day) + year--; + day -= (year + 3) / 4 + 365 * year; + if (day == 59 && !(year & 3)) { + nl_day = day; + month = 2; + } else { + nl_day = (year & 3) || day <= 59 ? day : day - 1; + for (month = 0; month < 12; month++) + if (day_n[month] > nl_day) + break; + } + + __u8 century = 19; + if (year > 19) + century = 20; + bh->b_data[z + 0x10] = bcd_from_u8(century); + __u8 u8year = year + 80; + if (u8year > 99) + u8year = u8year - 100; + bh->b_data[z + 0x11] = bcd_from_u8(u8year); + bh->b_data[z + 0x12] = bcd_from_u8((__u8) month); + bh->b_data[z + 0x13] = + bcd_from_u8((__u8) day - day_n[month - 1] + 1); + bh->b_data[z + 0x14] = + bcd_from_u8((__u8) ((unix_date / 3600) % 24)); + bh->b_data[z + 0x15] = bcd_from_u8((__u8) ((unix_date / 60) % 60)); + bh->b_data[z + 0x16] = bcd_from_u8((__u8) (unix_date % 60)); + + ((__u16 *) bh->b_data)[z / 2 + 0x0C] = + cpu_to_le16(inode->i_blocks); + if (inode->i_ino != 0) + ((__u16 *) bh->b_data)[z / 2 + 0x0D] = 0; + else + ((__u16 *) bh->b_data)[z / 2 + 0x0D] = 1; /*game */ + inode->i_mtime = unix_date; + mark_buffer_dirty(bh); + brelse(bh); + + + d_instantiate(de, inode); + + + + return 0; +} + + +static int vmufs_inode_rename(struct inode *in_source, + struct dentry *de_source, + struct inode *in_target, + struct dentry *de_target) +{ + return -EPERM; +} struct inode_operations vmufs_inode_operations = { lookup:vmufs_inode_lookup, unlink:vmufs_inode_unlink, + create:vmufs_inode_create, + rename:vmufs_inode_rename, }; @@ -212,7 +391,175 @@ fsync:file_fsync, }; -ssize_t vmufs_file_read(struct file *file, char *buf, size_t count, + +int vmufs_game_write(struct file *file, const char *buf, char *writebuf, + size_t count) +{ + /* Assume this is a game */ + return -EIO; +} + +ssize_t vmufs_file_write(struct file * file, const char *buf, size_t count, + loff_t * ppos) +{ + struct buffer_head *bh; + struct buffer_head *bh_fat; + if ((ssize_t) count < 0) + return -ENOENT; + struct inode *in = (file->f_dentry)->d_inode; + struct super_block *sb = in->i_sb; + struct memcard *vmudetails = + ((struct memcard *) sb->u.generic_sbp); + + + unsigned long blkoffset = *ppos >> in->i_sb->s_blocksize_bits; + unsigned long blksize = in->i_blksize; + + /* We will assume that all files - + * unless having inode value of 0 + * are data files + */ + + + /* copy buffer */ + char *writebuf; + if (count > in->i_blksize) + count = in->i_blksize; + writebuf = kmalloc(count, GFP_KERNEL); + copy_from_user(writebuf, buf, count); + + + if (in->i_ino == 0) { + vmufs_game_write(file, buf, writebuf, count); + } else { + + /* We have a data file - + * so let's write it out to + * the vmu */ + + /*Start by writing out to first block */ + if (blkoffset == 0) { + unsigned long currentblock = in->i_ino; + __u16 fatdata; + bh = bread(sb->s_dev, in->i_ino, in->i_blksize); + if (count < in->i_blksize) + memset((char *) (bh->b_data), '\0', + in->i_blksize); + memcpy((char *) (bh->b_data), writebuf, count); + mark_buffer_dirty(bh); + brelse(bh); + in->i_size = in->i_blksize; /* will increment as we grow */ + in->i_blocks = 1; + /* Update FAT */ + bh_fat = + bread(in->i_sb->s_dev, vmudetails->fat_bnum, + blksize); + /*Wipe out any old FAT records for this inode */ + do { + fatdata = + ((__u16 *) bh_fat-> + b_data)[(__u16) currentblock]; + if (fatdata == 0xfffc) + break; /* already empty */ + ((__u16 *) (bh_fat-> + b_data))[(__u16) currentblock] + = 0xfffc; + mark_buffer_dirty(bh_fat); + if (fatdata == 0xfffa) + break; /* end of file */ + } while (1); + /* Avoid writes to mtd if possible + * so check if a write is really + * required here */ + fatdata = + ((__u16 *) bh_fat-> + b_data)[(__u16) (in->i_ino)]; + if (fatdata != 0xfffa) { + ((__u16 *) (bh_fat->b_data))[(__u16) (in-> + i_ino)] + = 0xfffa; + mark_buffer_dirty(bh_fat); + } + brelse(bh_fat); + + } + /* Now every other block */ + else { + /*Look for a free block in the FAT */ + __u16 fatdata; + unsigned long nextblock = in->i_ino - 1; + bh_fat = + bread(in->i_sb->s_dev, vmudetails->fat_bnum, + blksize); + do { + fatdata = + ((__u16 *) bh_fat->b_data)[nextblock]; + if (fatdata == 0xfffc) + break; /*empty block */ + if (--nextblock < 0) + break; + } while (1); + if ((long) nextblock < 0) { + brelse(bh_fat); + kfree(writebuf); + printk(KERN_ERR + "vmufs: Out of space on vmu device\n"); + return -EFBIG; + } + /*Now we have the space - write the block out */ + bh = bread(sb->s_dev, nextblock, in->i_blksize); + if (count < in->i_blksize) + memset((char *) (bh->b_data), '\0', + in->i_blksize); + memcpy((char *) (bh->b_data), writebuf, count); + mark_buffer_dirty(bh); + brelse(bh); + in->i_size += in->i_blksize; + in->i_blocks++; + /*Now update the FAT if required */ + fatdata = + ((__u16 *) bh_fat->b_data)[(__u16) nextblock]; + if (fatdata != 0xfffa) { + ((__u16 *) (bh_fat-> + b_data))[(__u16) nextblock] = + 0xfffa; + mark_buffer_dirty(bh_fat); + } + int previousblock = in->i_ino; + do { + fatdata = + ((__u16 *) bh_fat-> + b_data)[previousblock]; + if ((fatdata == 0xfffc) + || (fatdata == 0xfffa)) { + ((__u16 *) bh_fat-> + b_data)[previousblock] = + nextblock; + mark_buffer_dirty(bh_fat); + break; + } + previousblock = fatdata; + blkoffset--; + } while (blkoffset > 0); + brelse(bh_fat); + if (blkoffset < 1) { + /* Additional sanity check */ + kfree(writebuf); + return -EIO; + } + + } + + + } + + + kfree(writebuf); + *ppos += count; + return count; +} + +ssize_t vmufs_file_read(struct file * file, char *buf, size_t count, loff_t * ppos) { struct inode *in = file->f_dentry->d_inode; @@ -254,6 +601,7 @@ memcpy(readbuf + x * blksize, bh_file->b_data, blksize); x++; fatblk = ((__u16 *) bh_fat->b_data)[next_block]; + brelse(bh_file); if (fatblk == 0xfffa) break; next_block = fatblk; @@ -264,12 +612,19 @@ copy_to_user(buf, readbuf, count); kfree(readbuf); *ppos += count; - + brelse(bh_fat); return count; } +static int vmufs_file_open(struct inode *in, struct file *f) +{ + return 0; +} + struct file_operations vmufs_file_operations = { read:vmufs_file_read, + write:vmufs_file_write, + open:vmufs_file_open, }; struct inode_operations vmufs_file_inode_operations = { Index: super.c =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/fs/vmufs/Attic/super.c,v retrieving revision 1.1.2.14 retrieving revision 1.1.2.15 diff -u -d -r1.1.2.14 -r1.1.2.15 --- super.c 20 Nov 2002 22:53:00 -0000 1.1.2.14 +++ super.c 3 May 2003 16:31:14 -0000 1.1.2.15 @@ -7,7 +7,7 @@ * http://linuxdc.org * * http://sourceforge.net/projects/linuxdc * * * - * This software is copyright, 2002, * + * This software is copyright, 2002, 2003 * * Adrian McMenamin * * ad...@mc... * * * @@ -39,6 +39,13 @@ return (topnib * 10) + botnib; } +inline __u8 bcd_from_u8(__u8 num) +{ + __u8 topnib = num / 10; + __u8 botnib = num % 10; + return ((topnib << 4) | (botnib)); +} + static struct super_block *vmufs_read_super(struct super_block *, void *, int); @@ -227,12 +234,12 @@ * Have to wander through this * to find the appropriate entry */ blck_read = vmudetails->dir_bnum; - bh = bread(sb->s_dev, blck_read, 512); + bh = bread(sb->s_dev, blck_read, in->i_blksize); for (y = 0; y < (vmudetails->dir_len * 0x10); y++) { if ((y / 0x10) > (vmudetails->dir_bnum - blck_read)) { brelse(bh); blck_read--; - bh = bread(sb->s_dev, blck_read, 512); + bh = bread(sb->s_dev, blck_read, in->i_blksize); } if (le16_to_cpu (((__u16 *) bh->b_data)[(y % 0x10) * 0x10 + @@ -251,7 +258,7 @@ if ((y / 0x10) > (vmudetails->dir_bnum - blck_read)) { brelse(bh); blck_read--; - bh = bread(sb->s_dev, blck_read, 512); + bh = bread(sb->s_dev, blck_read, in->i_blksize); } if (bh->b_data[(y % 0x10) * 0x20] == 0x00) { /* Not a file */ y--; @@ -260,10 +267,12 @@ brelse(bh); /* force read of correct block */ bh = bread(sb->s_dev, - (vmudetails->dir_bnum - y / 0x10), 512); + (vmudetails->dir_bnum - y / 0x10), + in->i_blksize); bh_old = bread(sb->s_dev, - (vmudetails->dir_bnum - x / 0x10), 512); + (vmudetails->dir_bnum - x / 0x10), + in->i_blksize); /* Copy this directory entry over */ for (z = 0; z < 0x10; z++) { ((__u16 *) bh_old->b_data)[(x % 0x10) * @@ -288,12 +297,94 @@ static void vmufs_write_inode(struct inode *in) { - /* Nothing at present */ + struct buffer_head *bh; + int y, blck_read, name_len; + struct super_block *sb = in->i_sb; + struct memcard *vmudetails = + ((struct memcard *) sb->u.generic_sbp); -} static struct super_operations vmufs_super_operations = { - read_inode:vmufs_read_inode, write_inode:vmufs_write_inode, - delete_inode:vmufs_delete_inode, put_super:vmufs_put_super, + printk(KERN_INFO "In vmufs_write_inode\n"); + + /* update the directory and inode details */ + + + /* Now search for the directory entry */ + blck_read = vmudetails->dir_bnum; + bh = bread(sb->s_dev, blck_read, in->i_blksize); + for (y = 0; y < (vmudetails->dir_len * 0x10); y++) { + if ((y / 0x10) > (vmudetails->dir_bnum - blck_read)) { + brelse(bh); + blck_read--; + bh = bread(sb->s_dev, blck_read, in->i_blksize); + } + if (le16_to_cpu + (((__u16 *) bh->b_data)[(y % 0x10) * 0x10 + + 0x01]) == in->i_ino) + break; + } + /* Have the directory entry + * so now update it */ + int z = (y % 0x10) * 0x20; + if (in->i_ino != 0) + bh->b_data[z] = 0x33; /* data file */ + else + bh->b_data[z] = 0xcc; + if ((bh->b_data[z + 1] != (char) 0x00) + && (bh->b_data[z + 1] != (char) 0xff)) + bh->b_data[z + 1] = (char) 0x00; + ((__u16 *) bh->b_data)[z / 2 + 1] = cpu_to_le16(in->i_ino); + /* BCD timestamp it */ + unsigned long unix_date = CURRENT_TIME; + int year, day, nl_day, month; /*inspired by FAT driver */ + day = unix_date / 86400 - 3652; + year = day / 365; + if ((year + 3) / 4 + 365 * year > day) + year--; + day -= (year + 3) / 4 + 365 * year; + if (day == 59 && !(year & 3)) { + nl_day = day; + month = 2; + } else { + nl_day = (year & 3) || day <= 59 ? day : day - 1; + for (month = 0; month < 12; month++) + if (day_n[month] > nl_day) + break; + } + + __u8 century = 19; + if (year > 19) + century = 20; + bh->b_data[z + 0x10] = bcd_from_u8(century); + __u8 u8year = year + 80; + if (u8year > 99) + u8year = u8year - 100; + bh->b_data[z + 0x11] = bcd_from_u8(u8year); + bh->b_data[z + 0x12] = bcd_from_u8((__u8) month); + bh->b_data[z + 0x13] = + bcd_from_u8((__u8) day - day_n[month - 1] + 1); + bh->b_data[z + 0x14] = + bcd_from_u8((__u8) ((unix_date / 3600) % 24)); + bh->b_data[z + 0x15] = bcd_from_u8((__u8) ((unix_date / 60) % 60)); + bh->b_data[z + 0x16] = bcd_from_u8((__u8) (unix_date % 60)); + + ((__u16 *) bh->b_data)[z / 2 + 0x0C] = cpu_to_le16(in->i_blocks); + if (in->i_ino != 0) + ((__u16 *) bh->b_data)[z / 2 + 0x0D] = 0; + else + ((__u16 *) bh->b_data)[z / 2 + 0x0D] = 1; /*game */ + in->i_mtime = unix_date; + mark_buffer_dirty(bh); + brelse(bh); + +} + +static struct super_operations vmufs_super_operations = { + + read_inode:vmufs_read_inode, + write_inode:vmufs_write_inode, + delete_inode:vmufs_delete_inode, + put_super:vmufs_put_super, statfs:vmufs_statfs, }; @@ -370,7 +461,7 @@ root_i = iget(sb, vmudata->sb_bnum); if (!root_i) { - printk("VMUFS: get root inode failed\n"); + printk(KERN_ERR "vmufs: get root inode failed\n"); return NULL; } Index: vmufs.h =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/fs/vmufs/Attic/vmufs.h,v retrieving revision 1.1.2.3 retrieving revision 1.1.2.4 diff -u -d -r1.1.2.3 -r1.1.2.4 --- vmufs.h 10 Nov 2002 00:52:00 -0000 1.1.2.3 +++ vmufs.h 3 May 2003 16:31:14 -0000 1.1.2.4 @@ -3,9 +3,12 @@ *****************************/ /* Licenced under the GPL v2 - * Copyright Adrian McMenamin, 2002 + * Copyright Adrian McMenamin, 2002, 2003 * ad...@mc... */ + +#define VMUFS_NAMELEN 12 + extern struct inode_operations vmufs_inode_operations; extern struct inode_operations vmufs_file_inode_operations; extern struct file_operations vmufs_file_dir_operations; @@ -36,3 +39,10 @@ inline int int_from_bcd(__u8 bcd); +inline __u8 bcd_from_u8(__u8 num); + +/* Linear day numbers of the respective 1sts in non-leap years. */ + +static int day_n[] = + { 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, 0, 0, 0, 0 }; + /* JanFebMarApr May Jun Jul Aug Sep Oct Nov Dec */ |
From: Adrian M. <zx8...@us...> - 2002-11-20 22:53:04
|
Update of /cvsroot/linuxdc/linux-sh-dc In directory sc8-pr-cvs1:/tmp/cvs-serv9230 Modified Files: Tag: linux-sh-dc-2_4-branch ChangeLog.dc Log Message: vmufs write support - EXPERIMENTAL Index: ChangeLog.dc =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/ChangeLog.dc,v retrieving revision 1.56.2.22 retrieving revision 1.56.2.23 diff -u -d -r1.56.2.22 -r1.56.2.23 --- ChangeLog.dc 13 Nov 2002 23:19:41 -0000 1.56.2.22 +++ ChangeLog.dc 20 Nov 2002 22:53:01 -0000 1.56.2.23 @@ -1,3 +1,15 @@ +2002-11-20 Adrian McMenamin <ad...@mc...> + + First write code (may now delete files) added to vmufs. + BEFORE YOU USE THIS MAKE SURE YOU UNDERSTAND WHAT + THE GPL SAYS ABOUT "NO WARRANTY". NO WARRANTY IS + OFFERED. If you want to keep your vmu the way it + is - don't use this code! + + * fs/vmufs/super.c: First write support added + * fs/vmufs/inode.c: First write support added + + 2002-11-13 Adrian McMenamin <ad...@mc...> * fs/vmufs/super.c: Fixes to file mode code |
From: Adrian M. <zx8...@us...> - 2002-11-20 22:53:04
|
Update of /cvsroot/linuxdc/linux-sh-dc/fs/vmufs In directory sc8-pr-cvs1:/tmp/cvs-serv9230/fs/vmufs Modified Files: Tag: linux-sh-dc-2_4-branch super.c inode.c Log Message: vmufs write support - EXPERIMENTAL Index: super.c =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/fs/vmufs/Attic/super.c,v retrieving revision 1.1.2.13 retrieving revision 1.1.2.14 diff -u -d -r1.1.2.13 -r1.1.2.14 --- super.c 13 Nov 2002 23:19:41 -0000 1.1.2.13 +++ super.c 20 Nov 2002 22:53:00 -0000 1.1.2.14 @@ -127,13 +127,19 @@ } /* identified the correct directory entry */ - century = int_from_bcd((bh->b_data)[0x10 + (y % 0x10) * 0x20]); - year = int_from_bcd((bh->b_data)[0x11 + (y % 0x10) * 0x20]); - month = int_from_bcd((bh->b_data)[0x12 + (y % 0x10) * 0x20]); + century = + int_from_bcd((bh->b_data)[0x10 + (y % 0x10) * 0x20]); + year = + int_from_bcd((bh->b_data)[0x11 + (y % 0x10) * 0x20]); + month = + int_from_bcd((bh->b_data)[0x12 + (y % 0x10) * 0x20]); day = int_from_bcd((bh->b_data)[0x13 + (y % 0x10) * 0x20]); - hour = int_from_bcd((bh->b_data)[0x14 + (y % 0x10) * 0x20]); - minute = int_from_bcd((bh->b_data)[0x15 + (y % 0x10) * 0x20]); - second = int_from_bcd((bh->b_data)[0x16 + (y % 0x10) * 0x20]); + hour = + int_from_bcd((bh->b_data)[0x14 + (y % 0x10) * 0x20]); + minute = + int_from_bcd((bh->b_data)[0x15 + (y % 0x10) * 0x20]); + second = + int_from_bcd((bh->b_data)[0x16 + (y % 0x10) * 0x20]); in->i_ctime = in->i_mtime = mktime(century * 100 + year, month, day, hour, minute, @@ -191,9 +197,103 @@ return 0; } -static struct super_operations vmufs_super_operations = { - read_inode:vmufs_read_inode, - put_super:vmufs_put_super, +static void vmufs_delete_inode(struct inode *in) +{ + /* Delete inode by marking space as free in FAT + * no need to waste time and effort by actually + * wiping underlying data on media */ + struct buffer_head *bh, *bh_old; + struct super_block *sb; + struct memcard *vmudetails; + int z, y, x, blck_read; + __u16 nextblock, fatdata; + + + sb = in->i_sb; + vmudetails = (struct memcard *) sb->u.generic_sbp; + bh = bread(sb->s_dev, vmudetails->fat_bnum, in->i_blksize); + /*FAT now read in - seek start of file and wonder through FAT */ + nextblock = in->i_ino; + do { + fatdata = ((__u16 *) bh->b_data)[nextblock]; + ((__u16 *) bh->b_data)[nextblock] = 0xfffc; + if (fatdata == 0xfffa) + break; /*end of file */ + nextblock = fatdata; + } while (1); + mark_buffer_dirty(bh); + brelse(bh); + /* Now clean the directory entry + * Have to wander through this + * to find the appropriate entry */ + blck_read = vmudetails->dir_bnum; + bh = bread(sb->s_dev, blck_read, 512); + for (y = 0; y < (vmudetails->dir_len * 0x10); y++) { + if ((y / 0x10) > (vmudetails->dir_bnum - blck_read)) { + brelse(bh); + blck_read--; + bh = bread(sb->s_dev, blck_read, 512); + } + if (le16_to_cpu + (((__u16 *) bh->b_data)[(y % 0x10) * 0x10 + + 0x01]) == in->i_ino) + break; + } + + /* Found directory entry - so NULL it now */ + for (z = 0; z < 0x10; z++) { + ((__u16 *) bh->b_data)[(y % 0x10) * 0x10 + z] = 0x0000; + } + /* Replace it with another entry - if one exists */ + mark_buffer_dirty(bh); + x = y; /* save for later use */ + for (y = x + 1; y < (vmudetails->dir_len * 0x10); y++) { + if ((y / 0x10) > (vmudetails->dir_bnum - blck_read)) { + brelse(bh); + blck_read--; + bh = bread(sb->s_dev, blck_read, 512); + } + if (bh->b_data[(y % 0x10) * 0x20] == 0x00) { /* Not a file */ + y--; + if (y == x) + break; /* At the end in any case */ + brelse(bh); + /* force read of correct block */ + bh = bread(sb->s_dev, + (vmudetails->dir_bnum - y / 0x10), 512); + bh_old = + bread(sb->s_dev, + (vmudetails->dir_bnum - x / 0x10), 512); + /* Copy this directory entry over */ + for (z = 0; z < 0x10; z++) { + ((__u16 *) bh_old->b_data)[(x % 0x10) * + 0x10 + z] = + ((__u16 *) bh->b_data)[(y % 0x10) * + 0x10 + z]; + ((__u16 *) bh->b_data)[(y % 0x10) * 0x10 + + z] = 0x00; + } + mark_buffer_dirty(bh); + mark_buffer_dirty(bh_old); /*In case it has been written back already */ + brelse(bh_old); + break; + } + } + + + brelse(bh); + +} + +static void vmufs_write_inode(struct inode *in) +{ + + /* Nothing at present */ + +} static struct super_operations vmufs_super_operations = { + + read_inode:vmufs_read_inode, write_inode:vmufs_write_inode, + delete_inode:vmufs_delete_inode, put_super:vmufs_put_super, statfs:vmufs_statfs, }; @@ -211,7 +311,6 @@ } - static struct super_block *vmufs_read_super(struct super_block *sb, void *data, int silent) { @@ -232,8 +331,8 @@ return NULL; } } - /* Store this data in the super block */ + struct memcard *vmudata = kmalloc(sizeof(struct memcard), GFP_KERNEL); vmudata->numblocks = z; @@ -295,9 +394,8 @@ unregister_filesystem(&vmufs_fs_type); } -module_init(init_vmufs_fs) - module_exit(exit_vmufs_fs) - +module_init(init_vmufs_fs); +module_exit(exit_vmufs_fs); MODULE_DESCRIPTION("Filesystem for Sega Dreamcast VMU"); MODULE_AUTHOR("Adrian McMenamin"); Index: inode.c =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/fs/vmufs/Attic/inode.c,v retrieving revision 1.1.2.14 retrieving revision 1.1.2.15 diff -u -d -r1.1.2.14 -r1.1.2.15 --- inode.c 10 Nov 2002 00:52:00 -0000 1.1.2.14 +++ inode.c 20 Nov 2002 22:53:00 -0000 1.1.2.15 @@ -107,8 +107,24 @@ } + +static int vmufs_inode_unlink(struct inode *in, struct dentry *de) +{ + + /* find the inode of the specified dentry + * and then call the superblock delete_inode */ + struct super_block *sb = in->i_sb; + struct super_operations *s_op = sb->s_op; + s_op->delete_inode(de->d_inode); + + return 0; +} + + + struct inode_operations vmufs_inode_operations = { lookup:vmufs_inode_lookup, + unlink:vmufs_inode_unlink, }; |
From: Adrian M. <zx8...@us...> - 2002-11-13 23:19:44
|
Update of /cvsroot/linuxdc/linux-sh-dc In directory usw-pr-cvs1:/tmp/cvs-serv27738 Modified Files: Tag: linux-sh-dc-2_4-branch ChangeLog.dc Log Message: Fix to file mode code Index: ChangeLog.dc =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/ChangeLog.dc,v retrieving revision 1.56.2.21 retrieving revision 1.56.2.22 diff -u -d -r1.56.2.21 -r1.56.2.22 --- ChangeLog.dc 10 Nov 2002 00:52:00 -0000 1.56.2.21 +++ ChangeLog.dc 13 Nov 2002 23:19:41 -0000 1.56.2.22 @@ -1,3 +1,7 @@ +2002-11-13 Adrian McMenamin <ad...@mc...> + + * fs/vmufs/super.c: Fixes to file mode code + 2002-11-10 Adrian McMenamin <ad...@mc...> Moving vmufs towards device independence |
From: Adrian M. <zx8...@us...> - 2002-11-13 23:19:44
|
Update of /cvsroot/linuxdc/linux-sh-dc/fs/vmufs In directory usw-pr-cvs1:/tmp/cvs-serv27738/fs/vmufs Modified Files: Tag: linux-sh-dc-2_4-branch super.c Log Message: Fix to file mode code Index: super.c =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/fs/vmufs/Attic/super.c,v retrieving revision 1.1.2.12 retrieving revision 1.1.2.13 diff -u -d -r1.1.2.12 -r1.1.2.13 --- super.c 10 Nov 2002 00:52:00 -0000 1.1.2.12 +++ super.c 13 Nov 2002 23:19:41 -0000 1.1.2.13 @@ -114,8 +114,9 @@ blck_read--; bh = bread(sb->s_dev, blck_read, 512); } - if (((__u16 *) bh->b_data)[(y % 0x10) * 0x10 + - 0x01] == in->i_ino) + if (le16_to_cpu + (((__u16 *) bh->b_data)[(y % 0x10) * 0x10 + + 0x01]) == in->i_ino) break; } @@ -126,34 +127,32 @@ } /* identified the correct directory entry */ - century = - int_from_bcd((bh->b_data)[0x10 + (y % 0x10) * 0x20]); - year = - int_from_bcd((bh->b_data)[0x11 + (y % 0x10) * 0x20]); - month = - int_from_bcd((bh->b_data)[0x12 + (y % 0x10) * 0x20]); + century = int_from_bcd((bh->b_data)[0x10 + (y % 0x10) * 0x20]); + year = int_from_bcd((bh->b_data)[0x11 + (y % 0x10) * 0x20]); + month = int_from_bcd((bh->b_data)[0x12 + (y % 0x10) * 0x20]); day = int_from_bcd((bh->b_data)[0x13 + (y % 0x10) * 0x20]); - hour = - int_from_bcd((bh->b_data)[0x14 + (y % 0x10) * 0x20]); - minute = - int_from_bcd((bh->b_data)[0x15 + (y % 0x10) * 0x20]); - second = - int_from_bcd((bh->b_data)[0x16 + (y % 0x10) * 0x20]); + hour = int_from_bcd((bh->b_data)[0x14 + (y % 0x10) * 0x20]); + minute = int_from_bcd((bh->b_data)[0x15 + (y % 0x10) * 0x20]); + second = int_from_bcd((bh->b_data)[0x16 + (y % 0x10) * 0x20]); in->i_ctime = in->i_mtime = mktime(century * 100 + year, month, day, hour, minute, second); + in->i_mode &= ~(S_IWUGO | S_IXUGO); /* Execute if a game, write if not copy protected */ in->i_mode |= S_IRUGO; + /* Mode - is the file copiable? */ - if (((__u8 *) bh->b_data)[0x01 + (y % 0x10) * 0x20] == - 0x00) + if ((((__u8 *) bh->b_data)[0x01 + (y % 0x10) * 0x20] == + 0x00) & ~(sb->s_flags & MS_RDONLY)) in->i_mode |= S_IWUGO; /* Is file executible - ie a game */ - if (((__u8 *) bh->b_data)[(y % 0x10) * 0x20] == 0xcc) + if ((((__u8 *) bh->b_data)[(y % 0x10) * 0x20] == + 0xcc) & ~(sb->s_flags & MS_NOEXEC)) in->i_mode |= S_IXUGO; + in->i_uid = in->i_gid = 0; in->i_op = &vmufs_file_inode_operations; @@ -172,7 +171,8 @@ void vmufs_put_super(struct super_block *sb) { sb->s_dev = 0; - struct memcard *vmudetails = (struct memcard *) (sb->u.generic_sbp); + struct memcard *vmudetails = + (struct memcard *) (sb->u.generic_sbp); kfree(vmudetails); } @@ -218,13 +218,11 @@ /*Search for the superblock - assuming likely sizes are 256, 128, 512 and 1024 blocks */ - struct buffer_head *bh; + struct buffer_head *bh = NULL; int z; /* Have to try lowest number first to avoid oops */ for (z = 128; z < 1024; z = z * 2) { - bh = bread(sb->s_dev, z - 1, 512); - if (check_sb_format(bh)) break; brelse(bh); @@ -300,6 +298,7 @@ module_init(init_vmufs_fs) module_exit(exit_vmufs_fs) - MODULE_DESCRIPTION("Filesystem for Sega Dreamcast VMU"); + +MODULE_DESCRIPTION("Filesystem for Sega Dreamcast VMU"); MODULE_AUTHOR("Adrian McMenamin"); MODULE_LICENSE("GPL"); |
From: Adrian M. <zx8...@us...> - 2002-11-10 00:52:05
|
Update of /cvsroot/linuxdc/linux-sh-dc/fs/vmufs In directory usw-pr-cvs1:/tmp/cvs-serv22516/fs/vmufs Modified Files: Tag: linux-sh-dc-2_4-branch vmufs.h super.c inode.c Log Message: Moving vmufs towards device independence Index: vmufs.h =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/fs/vmufs/Attic/vmufs.h,v retrieving revision 1.1.2.2 retrieving revision 1.1.2.3 diff -u -d -r1.1.2.2 -r1.1.2.3 --- vmufs.h 3 Nov 2002 04:34:28 -0000 1.1.2.2 +++ vmufs.h 10 Nov 2002 00:52:00 -0000 1.1.2.3 @@ -12,15 +12,14 @@ extern struct file_operations vmufs_file_operations; /* Memory card details */ -typedef struct memcard_s { - long partitions; - long blocklen; - long writecnt; - long readcnt; - long removable; +struct memcard { + long sb_bnum; + long fat_bnum; + long fat_len; + long dir_bnum; + long dir_len; long numblocks; - struct mtd_info *mtd; -} memcard_t; +}; struct vmufs_file_info { struct vmufs_file_info *prev; @@ -36,11 +35,4 @@ }; -int int_from_bcd(__u8 bcd); - - -#ifndef MTD_BLOCK_MAJOR -#define MTD_BLOCK_MAJOR 31 -#endif - -#define ROOT_BLOCK 255 +inline int int_from_bcd(__u8 bcd); Index: super.c =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/fs/vmufs/Attic/super.c,v retrieving revision 1.1.2.11 retrieving revision 1.1.2.12 diff -u -d -r1.1.2.11 -r1.1.2.12 --- super.c 8 Nov 2002 19:41:26 -0000 1.1.2.11 +++ super.c 10 Nov 2002 00:52:00 -0000 1.1.2.12 @@ -48,11 +48,13 @@ void vmufs_read_inode(struct inode *in) { struct super_block *sb = in->i_sb; + struct memcard *vmudetails = + ((struct memcard *) sb->u.generic_sbp); + long superblock_bno = vmudetails->sb_bnum; int century, year, month, day, hour, minute, second; - if (in->i_ino == 255) { + if (in->i_ino == superblock_bno) { struct buffer_head *bh = sb_bread(sb, in->i_ino); - century = int_from_bcd((bh->b_data)[0x30]); year = int_from_bcd((bh->b_data)[0x31]); month = int_from_bcd((bh->b_data)[0x32]); @@ -85,11 +87,11 @@ in->i_version = ++event; brelse(bh); } else { - int blck_read = 253; + int blck_read = vmudetails->dir_bnum; struct buffer_head *bh = bread(sb->s_dev, blck_read, 512); int y; - if (in->i_ino > 199) { + if (in->i_ino > (vmudetails->dir_len * 0x10)) { /* Not here */ brelse(bh); return; @@ -105,8 +107,9 @@ in->i_mode |= S_IFREG; /* Scan through the directory to find the matching file */ - for (y = 0; y < 200; y++) { - if ((y / 0x10) > (253 - blck_read)) { + for (y = 0; y < (vmudetails->dir_len * 0x10); y++) { + if ((y / 0x10) > + (vmudetails->dir_bnum - blck_read)) { brelse(bh); blck_read--; bh = bread(sb->s_dev, blck_read, 512); @@ -116,7 +119,7 @@ break; } - if (y >= 200) { + if (y >= (vmudetails->dir_len * 0x10)) { brelse(bh); /* TO DO: error return required */ return; @@ -169,80 +172,105 @@ void vmufs_put_super(struct super_block *sb) { sb->s_dev = 0; + struct memcard *vmudetails = (struct memcard *) (sb->u.generic_sbp); + kfree(vmudetails); } static int vmufs_statfs(struct super_block *sb, struct statfs *buf) { - struct mtd_info *mtd = get_mtd_device(NULL, MINOR(sb->s_dev)); - struct maple_driver_data *d = - (struct maple_driver_data *) (mtd->priv); - memcard_t *memcard = (memcard_t *) (d->private_data); buf->f_type = 0x55555555; - buf->f_bsize = mtd->erasesize; - buf->f_bfree = memcard->numblocks; + buf->f_bsize = 512; + buf->f_bfree = 256; /* TO DO: Fix */ buf->f_bavail = 0; buf->f_ffree = 0; buf->f_namelen = 12; - put_mtd_device(mtd); + return 0; } static struct super_operations vmufs_super_operations = { - read_inode: vmufs_read_inode, - put_super: vmufs_put_super, - statfs: vmufs_statfs, + read_inode:vmufs_read_inode, + put_super:vmufs_put_super, + statfs:vmufs_statfs, }; +static int check_sb_format(struct buffer_head *bh) +{ + __u32 s_magic = 0x55555555; + + if (!((((__u32 *) bh->b_data)[0] == s_magic) + && (((__u32 *) bh->b_data)[1] == s_magic) + && (((__u32 *) bh->b_data)[2] == s_magic) + && (s_magic == ((__u32 *) bh->b_data)[3]))) + return 0; + else + return 1; +} + + + static struct super_block *vmufs_read_super(struct super_block *sb, void *data, int silent) { - struct mtd_info *mtd = get_mtd_device(NULL, MINOR(sb->s_dev)); - struct maple_driver_data *d = - (struct maple_driver_data *) (mtd->priv); - memcard_t *memcard = (memcard_t *) (d->private_data); + + /*Search for the superblock - assuming likely sizes are 256, 128, 512 and 1024 blocks */ + struct buffer_head *bh; + int z; + /* Have to try lowest number first to avoid oops */ + for (z = 128; z < 1024; z = z * 2) { + + bh = bread(sb->s_dev, z - 1, 512); + + if (check_sb_format(bh)) + break; + brelse(bh); + if (z == 1024) { /* failed */ + printk(KERN_ERR + "vmufs: attempted to mount non vmufs medium as vmufs\n"); + return NULL; + } + } + + /* Store this data in the super block */ + struct memcard *vmudata = + kmalloc(sizeof(struct memcard), GFP_KERNEL); + vmudata->numblocks = z; + vmudata->sb_bnum = z - 1; + vmudata->fat_bnum = z - 2; + if (z < 512) + vmudata->fat_len = 1; + else if (z == 512) + vmudata->fat_len = 2; + else + vmudata->fat_len = 4; + vmudata->dir_bnum = vmudata->fat_bnum - vmudata->fat_len; + if (z == 128) + vmudata->dir_len = 7; + else + vmudata->dir_len = 13 * (z / 256); + sb->u.generic_sbp = vmudata; + struct inode *root_i; int erasesize, log_2 = 0; - /* Read off the details of this device */ - if (MAJOR(sb->s_dev) != MTD_BLOCK_MAJOR) { - printk(KERN_ERR - "vmufs: attempt to mount non-MTD device %s\n " - "as vmu filesystem", kdevname(sb->s_dev)); - return NULL; - } - sb->s_blocksize = mtd->erasesize; - erasesize = mtd->erasesize; + + sb->s_blocksize = 512; + erasesize = 512; while ((erasesize /= 2) != 0) log_2++; /* thanks to MR Brown */ sb->s_blocksize_bits = log_2; - sb->s_magic = 0x55555555; /* Nearest thing vmu has */ + sb->s_magic = 0x55555555; sb->s_op = &vmufs_super_operations; - put_mtd_device(mtd); - - bh = sb_bread(sb, memcard->numblocks - 1); - - /* Check a formatted vmu */ - if (!((((__u32 *) bh->b_data)[0] == sb->s_magic) - && (((__u32 *) bh->b_data)[1] == sb->s_magic) - && (((__u32 *) bh->b_data)[2] == sb->s_magic) - && (sb->s_magic == ((__u32 *) bh->b_data)[3]))) { - printk - ("Attempted to mount non-vmufs filesystem as vmufs\n"); - brelse(bh); - return NULL; - } - brelse(bh); - - root_i = iget(sb, memcard->numblocks - 1); + root_i = iget(sb, vmudata->sb_bnum); if (!root_i) { printk("VMUFS: get root inode failed\n"); @@ -270,8 +298,8 @@ } module_init(init_vmufs_fs) -module_exit(exit_vmufs_fs) + module_exit(exit_vmufs_fs) -MODULE_DESCRIPTION("Filesystem for Sega Dreamcast VMU"); + MODULE_DESCRIPTION("Filesystem for Sega Dreamcast VMU"); MODULE_AUTHOR("Adrian McMenamin"); MODULE_LICENSE("GPL"); Index: inode.c =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/fs/vmufs/Attic/inode.c,v retrieving revision 1.1.2.13 retrieving revision 1.1.2.14 diff -u -d -r1.1.2.13 -r1.1.2.14 --- inode.c 8 Nov 2002 19:41:26 -0000 1.1.2.13 +++ inode.c 10 Nov 2002 00:52:00 -0000 1.1.2.14 @@ -22,7 +22,10 @@ struct dentry *vmufs_inode_lookup(struct inode *in, struct dentry *dent) { struct super_block *sb = in->i_sb; - int blck_read = 253; + void *sbp = sb->u.generic_sbp; + struct memcard *vmudetails = (struct memcard *) sbp; + + long blck_read = vmudetails->dir_bnum; struct buffer_head *bh = bread(sb->s_dev, blck_read, 512); struct vmufs_file_info *first_one = NULL; struct vmufs_file_info *last_one = NULL; @@ -32,7 +35,8 @@ struct vmufs_file_info *saved_file = kmalloc(sizeof(struct vmufs_file_info), GFP_KERNEL); saved_file->prev = last_one; - saved_file->ftype = ((__u8 *) bh->b_data)[0 + fno * 0x20]; + saved_file->ftype = + ((__u8 *) bh->b_data)[(fno % 0x10) * 0x20]; if (saved_file->ftype == 0) { /* no file */ if (last_one) @@ -54,7 +58,7 @@ fno++; - if ((fno / 0x10) > (253 - blck_read)) { + if ((fno / 0x10) > (vmudetails->dir_bnum - blck_read)) { brelse(bh); blck_read--; bh = bread(sb->s_dev, blck_read, 512); @@ -113,8 +117,13 @@ struct dentry *dentry = filp->f_dentry; struct inode *inode = dentry->d_inode; struct super_block *sb = inode->i_sb; - struct buffer_head *bh = bread(sb->s_dev, 253, 512); - int blck_read = 253; /* Traverse through all blocks of VMU directory */ + struct memcard *vmudetails = + ((struct memcard *) sb->u.generic_sbp); + + + int blck_read = vmudetails->dir_bnum; /* Traverse through all blocks of VMU directory */ + struct buffer_head *bh = bread(sb->s_dev, blck_read, 512); + int i = filp->f_pos; switch ((unsigned int) filp->f_pos) { @@ -134,16 +143,16 @@ } /* wander through the Directory and find files */ - if (i > 200) { + if ((i - 2) > (vmudetails->dir_len * 0x10)) { brelse(bh); - return -1; /* Cannot be more than 200 */ + return -1; } struct vmufs_file_info *saved_file = kmalloc(sizeof(struct vmufs_file_info), GFP_KERNEL); do { - if ((i - 2) / 0x10 > (253 - blck_read)) { /* move to next block in directory */ + if ((i - 2) / 0x10 > (vmudetails->dir_bnum - blck_read)) { /* move to next block in directory */ brelse(bh); blck_read--; bh = bread(sb->s_dev, blck_read, 512); @@ -181,10 +190,10 @@ } struct file_operations vmufs_file_dir_operations = { - owner: THIS_MODULE, - read: generic_read_dir, - readdir: vmufs_readdir, - fsync: file_fsync, + owner:THIS_MODULE, + read:generic_read_dir, + readdir:vmufs_readdir, + fsync:file_fsync, }; ssize_t vmufs_file_read(struct file *file, char *buf, size_t count, @@ -199,6 +208,9 @@ struct buffer_head *bh_fat; long file_len = in->i_size; char *readbuf; + struct super_block *sb = in->i_sb; + struct memcard *vmudetails = + ((struct memcard *) sb->u.generic_sbp); if (*ppos > file_len) return -EINVAL; @@ -209,11 +221,10 @@ if (blcks_to_read == 0) return 0; readbuf = kmalloc(count, GFP_KERNEL); - - /* Trverse through FAT to read the blocks in */ + /* Traverse through FAT to read the blocks in */ x = 0; next_block = in->i_ino; - bh_fat = bread(in->i_sb->s_dev, 254, blksize); + bh_fat = bread(in->i_sb->s_dev, vmudetails->fat_bnum, blksize); /*Walk through to where we are */ if (blkoffset > 0) { do { @@ -242,7 +253,7 @@ } struct file_operations vmufs_file_operations = { - read: vmufs_file_read, + read:vmufs_file_read, }; struct inode_operations vmufs_file_inode_operations = { |
From: Adrian M. <zx8...@us...> - 2002-11-10 00:52:05
|
Update of /cvsroot/linuxdc/linux-sh-dc In directory usw-pr-cvs1:/tmp/cvs-serv22516 Modified Files: Tag: linux-sh-dc-2_4-branch ChangeLog.dc Log Message: Moving vmufs towards device independence Index: ChangeLog.dc =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/ChangeLog.dc,v retrieving revision 1.56.2.20 retrieving revision 1.56.2.21 diff -u -d -r1.56.2.20 -r1.56.2.21 --- ChangeLog.dc 8 Nov 2002 19:41:26 -0000 1.56.2.20 +++ ChangeLog.dc 10 Nov 2002 00:52:00 -0000 1.56.2.21 @@ -1,3 +1,12 @@ +2002-11-10 Adrian McMenamin <ad...@mc...> + + Moving vmufs towards device independence + + * fs/vmufs/vmufs.h: Moving away from mtd layer + * fs/vmufs/inode.c: Taking out mtd layer code + * fs/vmufs/super.c: Removing mtd layer code + + 2002-11-08 Adrian McMenamin <ad...@mc...> Code tidied up before starting work on writing |
From: Adrian M. <zx8...@us...> - 2002-11-08 19:41:29
|
Update of /cvsroot/linuxdc/linux-sh-dc In directory usw-pr-cvs1:/tmp/cvs-serv21941 Modified Files: Tag: linux-sh-dc-2_4-branch ChangeLog.dc Log Message: Tidy of vmufs code Index: ChangeLog.dc =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/ChangeLog.dc,v retrieving revision 1.56.2.19 retrieving revision 1.56.2.20 diff -u -d -r1.56.2.19 -r1.56.2.20 --- ChangeLog.dc 6 Nov 2002 23:59:06 -0000 1.56.2.19 +++ ChangeLog.dc 8 Nov 2002 19:41:26 -0000 1.56.2.20 @@ -1,3 +1,10 @@ +2002-11-08 Adrian McMenamin <ad...@mc...> + + Code tidied up before starting work on writing + + * fs/vmufs/inode.c: General tidy up + * fs/vmufs/super.c: General tidy up + 2002-11-06 Adrian McMenamin <ad...@mc...> * fs/vmufs/inode.c: further fixes to handle large |
From: Adrian M. <zx8...@us...> - 2002-11-08 19:41:29
|
Update of /cvsroot/linuxdc/linux-sh-dc/fs/vmufs In directory usw-pr-cvs1:/tmp/cvs-serv21941/fs/vmufs Modified Files: Tag: linux-sh-dc-2_4-branch super.c inode.c Log Message: Tidy of vmufs code Index: super.c =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/fs/vmufs/Attic/super.c,v retrieving revision 1.1.2.10 retrieving revision 1.1.2.11 diff -u -d -r1.1.2.10 -r1.1.2.11 --- super.c 6 Nov 2002 23:59:06 -0000 1.1.2.10 +++ super.c 8 Nov 2002 19:41:26 -0000 1.1.2.11 @@ -54,12 +54,12 @@ struct buffer_head *bh = sb_bread(sb, in->i_ino); century = int_from_bcd((bh->b_data)[0x30]); - year = int_from_bcd((bh->b_data)[0x31]); - month = int_from_bcd((bh->b_data)[0x32]); - day = int_from_bcd((bh->b_data)[0x33]); - hour = int_from_bcd((bh->b_data)[0x34]); - minute = int_from_bcd((bh->b_data)[0x35]); - second = int_from_bcd((bh->b_data)[0x36]); + year = int_from_bcd((bh->b_data)[0x31]); + month = int_from_bcd((bh->b_data)[0x32]); + day = int_from_bcd((bh->b_data)[0x33]); + hour = int_from_bcd((bh->b_data)[0x34]); + minute = int_from_bcd((bh->b_data)[0x35]); + second = int_from_bcd((bh->b_data)[0x36]); /* * As a temporary workaround, clear out any @@ -85,7 +85,7 @@ in->i_version = ++event; brelse(bh); } else { - int blck_read = 253; + int blck_read = 253; struct buffer_head *bh = bread(sb->s_dev, blck_read, 512); int y; @@ -106,13 +106,13 @@ /* Scan through the directory to find the matching file */ for (y = 0; y < 200; y++) { - if ((y / 0x10) > (253 - blck_read)){ - brelse(bh); - blck_read--; - bh = bread(sb->s_dev, blck_read, 512); - } - if (((__u16 *) bh->b_data)[(y % 0x10) * 0x10 + 0x01] == - in->i_ino) + if ((y / 0x10) > (253 - blck_read)) { + brelse(bh); + blck_read--; + bh = bread(sb->s_dev, blck_read, 512); + } + if (((__u16 *) bh->b_data)[(y % 0x10) * 0x10 + + 0x01] == in->i_ino) break; } @@ -123,13 +123,19 @@ } /* identified the correct directory entry */ - century = int_from_bcd((bh->b_data)[0x10 + (y % 0x10) * 0x20]); - year = int_from_bcd((bh->b_data)[0x11 + (y % 0x10) * 0x20]); - month = int_from_bcd((bh->b_data)[0x12 + (y % 0x10) * 0x20]); - day = int_from_bcd((bh->b_data)[0x13 + (y % 0x10) * 0x20]); - hour = int_from_bcd((bh->b_data)[0x14 + (y % 0x10) * 0x20]); - minute = int_from_bcd((bh->b_data)[0x15 + (y % 0x10) * 0x20]); - second = int_from_bcd((bh->b_data)[0x16 + (y % 0x10) * 0x20]); + century = + int_from_bcd((bh->b_data)[0x10 + (y % 0x10) * 0x20]); + year = + int_from_bcd((bh->b_data)[0x11 + (y % 0x10) * 0x20]); + month = + int_from_bcd((bh->b_data)[0x12 + (y % 0x10) * 0x20]); + day = int_from_bcd((bh->b_data)[0x13 + (y % 0x10) * 0x20]); + hour = + int_from_bcd((bh->b_data)[0x14 + (y % 0x10) * 0x20]); + minute = + int_from_bcd((bh->b_data)[0x15 + (y % 0x10) * 0x20]); + second = + int_from_bcd((bh->b_data)[0x16 + (y % 0x10) * 0x20]); in->i_ctime = in->i_mtime = mktime(century * 100 + year, month, day, hour, minute, @@ -138,7 +144,8 @@ in->i_mode |= S_IRUGO; /* Mode - is the file copiable? */ - if (((__u8 *) bh->b_data)[0x01 + (y % 0x10) * 0x20] == 0x00) + if (((__u8 *) bh->b_data)[0x01 + (y % 0x10) * 0x20] == + 0x00) in->i_mode |= S_IWUGO; /* Is file executible - ie a game */ if (((__u8 *) bh->b_data)[(y % 0x10) * 0x20] == 0xcc) @@ -150,7 +157,8 @@ in->i_fop = &vmufs_file_operations; in->i_blocks = - le16_to_cpu(((__u16 *) bh->b_data)[(y % 0x10) * 0x10 + 0x0C]); + le16_to_cpu(((__u16 *) bh->b_data)[(y % 0x10) * 0x10 + + 0x0C]); in->i_size = in->i_blocks * 512; in->i_blksize = 512; @@ -166,15 +174,16 @@ static int vmufs_statfs(struct super_block *sb, struct statfs *buf) { struct mtd_info *mtd = get_mtd_device(NULL, MINOR(sb->s_dev)); - struct maple_driver_data *d = (struct maple_driver_data *)(mtd->priv); - memcard_t *memcard = (memcard_t *)(d->private_data); + struct maple_driver_data *d = + (struct maple_driver_data *) (mtd->priv); + memcard_t *memcard = (memcard_t *) (d->private_data); - buf->f_type = 0x55555555; - buf->f_bsize = mtd->erasesize; - buf->f_bfree = memcard->numblocks; - buf->f_bavail = 0; - buf->f_ffree = 0; - buf->f_namelen = 12; + buf->f_type = 0x55555555; + buf->f_bsize = mtd->erasesize; + buf->f_bfree = memcard->numblocks; + buf->f_bavail = 0; + buf->f_ffree = 0; + buf->f_namelen = 12; put_mtd_device(mtd); @@ -182,25 +191,27 @@ } static struct super_operations vmufs_super_operations = { - read_inode: vmufs_read_inode, - put_super: vmufs_put_super, - statfs: vmufs_statfs, + read_inode: vmufs_read_inode, + put_super: vmufs_put_super, + statfs: vmufs_statfs, }; static struct super_block *vmufs_read_super(struct super_block *sb, void *data, int silent) { struct mtd_info *mtd = get_mtd_device(NULL, MINOR(sb->s_dev)); - struct maple_driver_data *d = (struct maple_driver_data *)(mtd->priv); - memcard_t *memcard = (memcard_t *)(d->private_data); + struct maple_driver_data *d = + (struct maple_driver_data *) (mtd->priv); + memcard_t *memcard = (memcard_t *) (d->private_data); struct buffer_head *bh; struct inode *root_i; int erasesize, log_2 = 0; /* Read off the details of this device */ if (MAJOR(sb->s_dev) != MTD_BLOCK_MAJOR) { - printk(KERN_ERR "vmufs: attempt to mount non-MTD device %s\n " - "as vmu filesystem", kdevname(sb->s_dev)); + printk(KERN_ERR + "vmufs: attempt to mount non-MTD device %s\n " + "as vmu filesystem", kdevname(sb->s_dev)); return NULL; } @@ -223,7 +234,8 @@ && (((__u32 *) bh->b_data)[1] == sb->s_magic) && (((__u32 *) bh->b_data)[2] == sb->s_magic) && (sb->s_magic == ((__u32 *) bh->b_data)[3]))) { - printk("Attempted to mount non-vmufs filesystem as vmufs\n"); + printk + ("Attempted to mount non-vmufs filesystem as vmufs\n"); brelse(bh); return NULL; } @@ -263,4 +275,3 @@ MODULE_DESCRIPTION("Filesystem for Sega Dreamcast VMU"); MODULE_AUTHOR("Adrian McMenamin"); MODULE_LICENSE("GPL"); - Index: inode.c =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/fs/vmufs/Attic/inode.c,v retrieving revision 1.1.2.12 retrieving revision 1.1.2.13 diff -u -d -r1.1.2.12 -r1.1.2.13 --- inode.c 6 Nov 2002 23:59:06 -0000 1.1.2.12 +++ inode.c 8 Nov 2002 19:41:26 -0000 1.1.2.13 @@ -47,15 +47,17 @@ last_one = saved_file; saved_file->copy_pro = ((__u8 *) bh->b_data)[1 + (fno % 0x10) * 0x20]; - saved_file->fblk = ((__u16 *) bh->b_data)[1 + (fno % 0x10) * 0x10]; - memcpy(saved_file->fname, bh->b_data + 4 + (fno % 0x10) * 0x20, 12); + saved_file->fblk = + ((__u16 *) bh->b_data)[1 + (fno % 0x10) * 0x10]; + memcpy(saved_file->fname, + bh->b_data + 4 + (fno % 0x10) * 0x20, 12); fno++; - if ((fno/0x10)> (253 - blck_read)){ - brelse(bh); - blck_read--; - bh = bread(sb->s_dev, blck_read, 512); + if ((fno / 0x10) > (253 - blck_read)) { + brelse(bh); + blck_read--; + bh = bread(sb->s_dev, blck_read, 512); } } while (1); @@ -179,10 +181,10 @@ } struct file_operations vmufs_file_dir_operations = { - owner:THIS_MODULE, - read:generic_read_dir, - readdir:vmufs_readdir, - fsync:file_fsync, + owner: THIS_MODULE, + read: generic_read_dir, + readdir: vmufs_readdir, + fsync: file_fsync, }; ssize_t vmufs_file_read(struct file *file, char *buf, size_t count, @@ -240,7 +242,7 @@ } struct file_operations vmufs_file_operations = { - read:vmufs_file_read, + read: vmufs_file_read, }; struct inode_operations vmufs_file_inode_operations = { |
From: Adrian M. <zx8...@us...> - 2002-11-06 23:59:10
|
Update of /cvsroot/linuxdc/linux-sh-dc In directory usw-pr-cvs1:/tmp/cvs-serv29605 Modified Files: Tag: linux-sh-dc-2_4-branch ChangeLog.dc Log Message: More vmufs fixes Index: ChangeLog.dc =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/ChangeLog.dc,v retrieving revision 1.56.2.18 retrieving revision 1.56.2.19 diff -u -d -r1.56.2.18 -r1.56.2.19 --- ChangeLog.dc 5 Nov 2002 23:55:27 -0000 1.56.2.18 +++ ChangeLog.dc 6 Nov 2002 23:59:06 -0000 1.56.2.19 @@ -1,3 +1,10 @@ +2002-11-06 Adrian McMenamin <ad...@mc...> + + * fs/vmufs/inode.c: further fixes to handle large + number of vmu files + * fs/vmufs/super.c: further fixes + + 2002-11-05 Adrian McMenamin <ad...@mc...> * fs/vmufs/inode.c: Code now handles more than 16 |
From: Adrian M. <zx8...@us...> - 2002-11-06 23:59:09
|
Update of /cvsroot/linuxdc/linux-sh-dc/fs/vmufs In directory usw-pr-cvs1:/tmp/cvs-serv29605/fs/vmufs Modified Files: Tag: linux-sh-dc-2_4-branch super.c inode.c Log Message: More vmufs fixes Index: super.c =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/fs/vmufs/Attic/super.c,v retrieving revision 1.1.2.9 retrieving revision 1.1.2.10 diff -u -d -r1.1.2.9 -r1.1.2.10 --- super.c 5 Nov 2002 00:03:04 -0000 1.1.2.9 +++ super.c 6 Nov 2002 23:59:06 -0000 1.1.2.10 @@ -85,7 +85,8 @@ in->i_version = ++event; brelse(bh); } else { - struct buffer_head *bh = bread(sb->s_dev, 253, 512); + int blck_read = 253; + struct buffer_head *bh = bread(sb->s_dev, blck_read, 512); int y; if (in->i_ino > 199) { @@ -105,7 +106,12 @@ /* Scan through the directory to find the matching file */ for (y = 0; y < 200; y++) { - if (((__u16 *) bh->b_data)[y * 0x10 + 0x01] == + if ((y / 0x10) > (253 - blck_read)){ + brelse(bh); + blck_read--; + bh = bread(sb->s_dev, blck_read, 512); + } + if (((__u16 *) bh->b_data)[(y % 0x10) * 0x10 + 0x01] == in->i_ino) break; } @@ -117,13 +123,13 @@ } /* identified the correct directory entry */ - century = int_from_bcd((bh->b_data)[0x10 + y * 0x20]); - year = int_from_bcd((bh->b_data)[0x11 + y * 0x20]); - month = int_from_bcd((bh->b_data)[0x12 + y * 0x20]); - day = int_from_bcd((bh->b_data)[0x13 + y * 0x20]); - hour = int_from_bcd((bh->b_data)[0x14 + y * 0x20]); - minute = int_from_bcd((bh->b_data)[0x15 + y * 0x20]); - second = int_from_bcd((bh->b_data)[0x16 + y * 0x20]); + century = int_from_bcd((bh->b_data)[0x10 + (y % 0x10) * 0x20]); + year = int_from_bcd((bh->b_data)[0x11 + (y % 0x10) * 0x20]); + month = int_from_bcd((bh->b_data)[0x12 + (y % 0x10) * 0x20]); + day = int_from_bcd((bh->b_data)[0x13 + (y % 0x10) * 0x20]); + hour = int_from_bcd((bh->b_data)[0x14 + (y % 0x10) * 0x20]); + minute = int_from_bcd((bh->b_data)[0x15 + (y % 0x10) * 0x20]); + second = int_from_bcd((bh->b_data)[0x16 + (y % 0x10) * 0x20]); in->i_ctime = in->i_mtime = mktime(century * 100 + year, month, day, hour, minute, @@ -132,10 +138,10 @@ in->i_mode |= S_IRUGO; /* Mode - is the file copiable? */ - if (((__u8 *) bh->b_data)[0x01 + y * 0x20] == 0x00) + if (((__u8 *) bh->b_data)[0x01 + (y % 0x10) * 0x20] == 0x00) in->i_mode |= S_IWUGO; /* Is file executible - ie a game */ - if (((__u8 *) bh->b_data)[y * 0x20] == 0xcc) + if (((__u8 *) bh->b_data)[(y % 0x10) * 0x20] == 0xcc) in->i_mode |= S_IXUGO; in->i_uid = in->i_gid = 0; @@ -144,7 +150,7 @@ in->i_fop = &vmufs_file_operations; in->i_blocks = - le16_to_cpu(((__u16 *) bh->b_data)[y * 0x10 + 0x0C]); + le16_to_cpu(((__u16 *) bh->b_data)[(y % 0x10) * 0x10 + 0x0C]); in->i_size = in->i_blocks * 512; in->i_blksize = 512; Index: inode.c =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/fs/vmufs/Attic/inode.c,v retrieving revision 1.1.2.11 retrieving revision 1.1.2.12 diff -u -d -r1.1.2.11 -r1.1.2.12 --- inode.c 5 Nov 2002 23:55:26 -0000 1.1.2.11 +++ inode.c 6 Nov 2002 23:59:06 -0000 1.1.2.12 @@ -22,7 +22,8 @@ struct dentry *vmufs_inode_lookup(struct inode *in, struct dentry *dent) { struct super_block *sb = in->i_sb; - struct buffer_head *bh = bread(sb->s_dev, 253, 512); + int blck_read = 253; + struct buffer_head *bh = bread(sb->s_dev, blck_read, 512); struct vmufs_file_info *first_one = NULL; struct vmufs_file_info *last_one = NULL; int fno = 0; @@ -45,12 +46,17 @@ last_one->next = saved_file; last_one = saved_file; saved_file->copy_pro = - ((__u8 *) bh->b_data)[1 + fno * 0x20]; - saved_file->fblk = ((__u16 *) bh->b_data)[1 + fno * 0x10]; - memcpy(saved_file->fname, bh->b_data + 4 + fno * 0x20, 12); + ((__u8 *) bh->b_data)[1 + (fno % 0x10) * 0x20]; + saved_file->fblk = ((__u16 *) bh->b_data)[1 + (fno % 0x10) * 0x10]; + memcpy(saved_file->fname, bh->b_data + 4 + (fno % 0x10) * 0x20, 12); fno++; + if ((fno/0x10)> (253 - blck_read)){ + brelse(bh); + blck_read--; + bh = bread(sb->s_dev, blck_read, 512); + } } while (1); @@ -135,9 +141,9 @@ kmalloc(sizeof(struct vmufs_file_info), GFP_KERNEL); do { - if ((i - 2) / 0x10 > (blck_read - 253)) { /* move to next block in directory */ + if ((i - 2) / 0x10 > (253 - blck_read)) { /* move to next block in directory */ brelse(bh); - blck_read++; + blck_read--; bh = bread(sb->s_dev, blck_read, 512); } |
From: Adrian M. <zx8...@us...> - 2002-11-05 23:55:31
|
Update of /cvsroot/linuxdc/linux-sh-dc In directory usw-pr-cvs1:/tmp/cvs-serv3198 Modified Files: Tag: linux-sh-dc-2_4-branch ChangeLog.dc Log Message: vmufs should now handle more than first 16 files Index: ChangeLog.dc =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/ChangeLog.dc,v retrieving revision 1.56.2.17 retrieving revision 1.56.2.18 diff -u -d -r1.56.2.17 -r1.56.2.18 --- ChangeLog.dc 5 Nov 2002 00:03:04 -0000 1.56.2.17 +++ ChangeLog.dc 5 Nov 2002 23:55:27 -0000 1.56.2.18 @@ -1,3 +1,9 @@ +2002-11-05 Adrian McMenamin <ad...@mc...> + + * fs/vmufs/inode.c: Code now handles more than 16 + files on one vmu flash slab + + 2002-11-04 Adrian McMenamin <ad...@mc...> Further vmufs improvements/clean ups |
From: Adrian M. <zx8...@us...> - 2002-11-05 23:55:30
|
Update of /cvsroot/linuxdc/linux-sh-dc/fs/vmufs In directory usw-pr-cvs1:/tmp/cvs-serv3198/fs/vmufs Modified Files: Tag: linux-sh-dc-2_4-branch inode.c Log Message: vmufs should now handle more than first 16 files Index: inode.c =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/fs/vmufs/Attic/inode.c,v retrieving revision 1.1.2.10 retrieving revision 1.1.2.11 diff -u -d -r1.1.2.10 -r1.1.2.11 --- inode.c 5 Nov 2002 00:03:04 -0000 1.1.2.10 +++ inode.c 5 Nov 2002 23:55:26 -0000 1.1.2.11 @@ -106,6 +106,7 @@ struct inode *inode = dentry->d_inode; struct super_block *sb = inode->i_sb; struct buffer_head *bh = bread(sb->s_dev, 253, 512); + int blck_read = 253; /* Traverse through all blocks of VMU directory */ int i = filp->f_pos; switch ((unsigned int) filp->f_pos) { @@ -134,17 +135,25 @@ kmalloc(sizeof(struct vmufs_file_info), GFP_KERNEL); do { + if ((i - 2) / 0x10 > (blck_read - 253)) { /* move to next block in directory */ + brelse(bh); + blck_read++; + bh = bread(sb->s_dev, blck_read, 512); + } + saved_file->ftype = - ((__u8 *) bh->b_data)[0 + (i - 2) * 0x20]; + ((__u8 *) bh->b_data)[0 + ((i - 2) % 0x10) * 0x20]; if (saved_file->ftype == 0) break; saved_file->fblk = le16_to_cpu(((__u16 *) bh->b_data)[1 + - (i - 2) * 0x10]); - memcpy(saved_file->fname, bh->b_data + 4 + (i - 2) * 0x20, - 12); + ((i - + 2) % 0x10) * + 0x10]); + memcpy(saved_file->fname, + bh->b_data + 4 + ((i - 2) % 0x10) * 0x20, 12); if (filldir (dirent, saved_file->fname, 12, i++, saved_file->fblk, @@ -189,7 +198,8 @@ count = file_len - *ppos; blcks_to_read = count >> in->i_sb->s_blocksize_bits; - if (blcks_to_read == 0) return 0; + if (blcks_to_read == 0) + return 0; readbuf = kmalloc(count, GFP_KERNEL); /* Trverse through FAT to read the blocks in */ @@ -199,7 +209,8 @@ /*Walk through to where we are */ if (blkoffset > 0) { do { - next_block = ((__u16 *) bh_fat->b_data)[next_block]; + next_block = + ((__u16 *) bh_fat->b_data)[next_block]; blkoffset--; } while (blkoffset > 0); } |
From: Adrian M. <zx8...@us...> - 2002-11-05 00:03:07
|
Update of /cvsroot/linuxdc/linux-sh-dc/fs/vmufs In directory usw-pr-cvs1:/tmp/cvs-serv6413/fs/vmufs Modified Files: Tag: linux-sh-dc-2_4-branch inode.c super.c Log Message: More vmufs clean-ups/improvements - more still needed Index: inode.c =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/fs/vmufs/Attic/inode.c,v retrieving revision 1.1.2.9 retrieving revision 1.1.2.10 diff -u -d -r1.1.2.9 -r1.1.2.10 --- inode.c 3 Nov 2002 19:30:18 -0000 1.1.2.9 +++ inode.c 5 Nov 2002 00:03:04 -0000 1.1.2.10 @@ -25,7 +25,7 @@ struct buffer_head *bh = bread(sb->s_dev, 253, 512); struct vmufs_file_info *first_one = NULL; struct vmufs_file_info *last_one = NULL; - int i, fno = 0; + int fno = 0; do { struct vmufs_file_info *saved_file = @@ -48,8 +48,8 @@ ((__u8 *) bh->b_data)[1 + fno * 0x20]; saved_file->fblk = ((__u16 *) bh->b_data)[1 + fno * 0x10]; memcpy(saved_file->fname, bh->b_data + 4 + fno * 0x20, 12); - - + + fno++; } while (1); @@ -96,7 +96,7 @@ } struct inode_operations vmufs_inode_operations = { - lookup: vmufs_inode_lookup, + lookup:vmufs_inode_lookup, }; @@ -108,7 +108,7 @@ struct buffer_head *bh = bread(sb->s_dev, 253, 512); int i = filp->f_pos; - switch ((unsigned int)filp->f_pos) { + switch ((unsigned int) filp->f_pos) { case 0: if (filldir(dirent, ".", 1, i++, inode->i_ino, DT_DIR) < 0) goto finish; @@ -134,24 +134,28 @@ kmalloc(sizeof(struct vmufs_file_info), GFP_KERNEL); do { - saved_file->ftype = ((__u8 *) bh->b_data)[0 + (i - 2) * 0x20]; + saved_file->ftype = + ((__u8 *) bh->b_data)[0 + (i - 2) * 0x20]; if (saved_file->ftype == 0) break; saved_file->fblk = - le16_to_cpu(((__u16 *) bh->b_data)[1 + (i - 2) * 0x10]); - memcpy(saved_file->fname, bh->b_data + 4 + (i - 2) * 0x20, 12); + le16_to_cpu(((__u16 *) bh->b_data)[1 + + (i - 2) * 0x10]); + memcpy(saved_file->fname, bh->b_data + 4 + (i - 2) * 0x20, + 12); - if (filldir(dirent, saved_file->fname, 12, i++, saved_file->fblk, - DT_REG) < 0) { + if (filldir + (dirent, saved_file->fname, 12, i++, saved_file->fblk, + DT_REG) < 0) { goto finish; } filp->f_pos++; } while (1); -finish: + finish: kfree(saved_file); brelse(bh); @@ -160,10 +164,10 @@ } struct file_operations vmufs_file_dir_operations = { - owner: THIS_MODULE, - read: generic_read_dir, - readdir: vmufs_readdir, - fsync: file_fsync, + owner:THIS_MODULE, + read:generic_read_dir, + readdir:vmufs_readdir, + fsync:file_fsync, }; ssize_t vmufs_file_read(struct file *file, char *buf, size_t count, @@ -173,7 +177,9 @@ unsigned long blkoffset = *ppos >> in->i_sb->s_blocksize_bits; unsigned long blksize = in->i_blksize; unsigned long blcks_to_read, x; - struct buffer_head *bh; + __u16 fatblk, next_block; + struct buffer_head *bh_file; + struct buffer_head *bh_fat; long file_len = in->i_size; char *readbuf; @@ -183,13 +189,30 @@ count = file_len - *ppos; blcks_to_read = count >> in->i_sb->s_blocksize_bits; + if (blcks_to_read == 0) return 0; readbuf = kmalloc(count, GFP_KERNEL); - for (x = 0; x < blcks_to_read; x++) { - bh = bread(in->i_sb->s_dev, in->i_ino - blkoffset - x, blksize); - memcpy(readbuf + x * blksize, bh->b_data, blksize); - brelse(bh); + /* Trverse through FAT to read the blocks in */ + x = 0; + next_block = in->i_ino; + bh_fat = bread(in->i_sb->s_dev, 254, blksize); + /*Walk through to where we are */ + if (blkoffset > 0) { + do { + next_block = ((__u16 *) bh_fat->b_data)[next_block]; + blkoffset--; + } while (blkoffset > 0); } + do { + bh_file = bread(in->i_sb->s_dev, next_block, blksize); + memcpy(readbuf + x * blksize, bh_file->b_data, blksize); + x++; + fatblk = ((__u16 *) bh_fat->b_data)[next_block]; + if (fatblk == 0xfffa) + break; + next_block = fatblk; + } while (x < blcks_to_read); + /* Copy to user space */ copy_to_user(buf, readbuf, count); @@ -200,9 +223,8 @@ } struct file_operations vmufs_file_operations = { - read: vmufs_file_read, + read:vmufs_file_read, }; struct inode_operations vmufs_file_inode_operations = { }; - Index: super.c =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/fs/vmufs/Attic/super.c,v retrieving revision 1.1.2.8 retrieving revision 1.1.2.9 diff -u -d -r1.1.2.8 -r1.1.2.9 --- super.c 3 Nov 2002 19:51:44 -0000 1.1.2.8 +++ super.c 5 Nov 2002 00:03:04 -0000 1.1.2.9 @@ -31,7 +31,7 @@ #include <linux/time.h> #include "vmufs.h" -int int_from_bcd(__u8 bcd) +inline int int_from_bcd(__u8 bcd) { int topnib = (bcd >> 4) & 0x000f; int botnib = bcd & 0x000f; |
From: Adrian M. <zx8...@us...> - 2002-11-05 00:03:07
|
Update of /cvsroot/linuxdc/linux-sh-dc In directory usw-pr-cvs1:/tmp/cvs-serv6413 Modified Files: Tag: linux-sh-dc-2_4-branch ChangeLog.dc Log Message: More vmufs clean-ups/improvements - more still needed Index: ChangeLog.dc =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/ChangeLog.dc,v retrieving revision 1.56.2.16 retrieving revision 1.56.2.17 diff -u -d -r1.56.2.16 -r1.56.2.17 --- ChangeLog.dc 3 Nov 2002 19:51:43 -0000 1.56.2.16 +++ ChangeLog.dc 5 Nov 2002 00:03:04 -0000 1.56.2.17 @@ -1,3 +1,12 @@ +2002-11-04 Adrian McMenamin <ad...@mc...> + + Further vmufs improvements/clean ups + + * fs/vmufs/super.c: Make bcd conversion function inline + * fs/vmufs/inode.c: Traverse through FAT rather than + simply assume all files saved in sequential order + + 2002-11-03 M. R. Brown <mr...@li...> * drivers/mtd/maps/vmu-flash.c (dc_flashmap_connect): Assign name |
From: Adrian M. <zx8...@us...> - 2002-11-03 19:30:22
|
Update of /cvsroot/linuxdc/linux-sh-dc/fs/vmufs In directory usw-pr-cvs1:/tmp/cvs-serv26210/fs/vmufs Modified Files: Tag: linux-sh-dc-2_4-branch inode.c super.c Log Message: VMU fs tidy up continues Index: inode.c =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/fs/vmufs/Attic/inode.c,v retrieving revision 1.1.2.8 retrieving revision 1.1.2.9 diff -u -d -r1.1.2.8 -r1.1.2.9 --- inode.c 3 Nov 2002 09:09:01 -0000 1.1.2.8 +++ inode.c 3 Nov 2002 19:30:18 -0000 1.1.2.9 @@ -48,10 +48,8 @@ ((__u8 *) bh->b_data)[1 + fno * 0x20]; saved_file->fblk = ((__u16 *) bh->b_data)[1 + fno * 0x10]; memcpy(saved_file->fname, bh->b_data + 4 + fno * 0x20, 12); - for (i = 0; i < 8; i++) { - saved_file->date[i] = - int_from_bcd(((__u8 *) bh->b_data)[i + 16 + fno * 0x20]); - } + + fno++; } while (1); Index: super.c =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/fs/vmufs/Attic/super.c,v retrieving revision 1.1.2.6 retrieving revision 1.1.2.7 diff -u -d -r1.1.2.6 -r1.1.2.7 --- super.c 3 Nov 2002 09:09:01 -0000 1.1.2.6 +++ super.c 3 Nov 2002 19:30:18 -0000 1.1.2.7 @@ -61,7 +61,7 @@ minute = int_from_bcd((bh->b_data)[0x35]); second = int_from_bcd((bh->b_data)[0x36]); - in->i_mode |= S_IFDIR; + in->i_mode = S_IFDIR; in->i_atime = CURRENT_TIME; in->i_ctime = in->i_mtime = @@ -76,7 +76,6 @@ /*Not in FAT table */ in->i_size = 512; - /* Times */ in->i_blocks = 1; in->i_blksize = 512; in->i_version = ++event; @@ -92,7 +91,7 @@ } /* a file, not a directory */ - in->i_mode |= S_IFREG; + in->i_mode = S_IFREG; /* Scan through the directory to find the matching file */ for (y = 0; y < 200; y++) { |
From: Adrian M. <zx8...@us...> - 2002-11-03 19:30:22
|
Update of /cvsroot/linuxdc/linux-sh-dc In directory usw-pr-cvs1:/tmp/cvs-serv26210 Modified Files: Tag: linux-sh-dc-2_4-branch ChangeLog.dc Log Message: VMU fs tidy up continues Index: ChangeLog.dc =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/ChangeLog.dc,v retrieving revision 1.56.2.14 retrieving revision 1.56.2.15 diff -u -d -r1.56.2.14 -r1.56.2.15 --- ChangeLog.dc 3 Nov 2002 14:23:13 -0000 1.56.2.14 +++ ChangeLog.dc 3 Nov 2002 19:30:19 -0000 1.56.2.15 @@ -25,6 +25,11 @@ 2002-11-03 Adrian McMenamin <ad...@mc...> + Further VMU fs cleanup + * fs/vmufs/inode.c: Redundant code removed + * fs/vmufs/super.c: Force directory and regular file types - + seems to fix problems with remounts + Initial VMU File System Support added: * fs/vmufs/vmufs.h: New file * fs/vmufs/vmufs_inode.c: New file |
From: M. R. B. <mr...@us...> - 2002-11-03 14:23:17
|
Update of /cvsroot/linuxdc/linux-sh-dc/drivers/mtd/maps In directory usw-pr-cvs1:/tmp/cvs-serv25520/drivers/mtd/maps Modified Files: Tag: linux-sh-dc-2_4-branch vmu-flash.c Log Message: Add port/unit info to mtd_info->name Index: vmu-flash.c =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/drivers/mtd/maps/vmu-flash.c,v retrieving revision 1.11 retrieving revision 1.11.2.1 diff -u -d -r1.11 -r1.11.2.1 --- vmu-flash.c 11 Sep 2002 20:09:07 -0000 1.11 +++ vmu-flash.c 3 Nov 2002 14:23:14 -0000 1.11.2.1 @@ -25,7 +25,8 @@ static int VMU_BLOCK_SIZE; -#define _DEBUG_ +/* Define this to get debugging messages */ +/* #define _DEBUG_ */ #ifdef _DEBUG_ #define DEBGM(fmt, args...) (printk(KERN_INFO fmt, ##args)) @@ -37,7 +38,7 @@ /* MTD Information */ static struct mtd_info *vmu_flash_mtd = NULL; - +static unsigned char mtdname[40]; static struct mapleq *lastmq; static struct maple_driver dc_flashmap_driver; @@ -557,6 +558,7 @@ static int dc_flashmap_connect(struct maple_driver_data *d) { + DEBGM ("Registering VMU Flash mapping and loading VMU Flash driver\n"); @@ -595,7 +597,6 @@ unsigned long basic_flash_data = be32_to_cpu(((unsigned long *) (lastmq->recvbuf))[1 + bit_cnt - controller_here]); - /* Create a permanent record * With thanks to Marcus Comstedt */ @@ -631,7 +632,6 @@ return -1; } - do { interruptible_sleep_on_timeout(&wq_mq, 1); } while (lastmq == NULL); @@ -648,7 +648,8 @@ /* Populate a mtd_info */ vmu_flash_mtd = kmalloc(512, GFP_KERNEL); - vmu_flash_mtd->name = "Dreamcast VMU Flash"; + sprintf(mtdname, "Dreamcast VMU Flash @ %c%c", ('A' + mqu->port), ('0' + mqu->unit)); + vmu_flash_mtd->name = mtdname; /* This is 'other' */ vmu_flash_mtd->type = MTD_OTHER; |
From: M. R. B. <mr...@us...> - 2002-11-03 14:23:17
|
Update of /cvsroot/linuxdc/linux-sh-dc In directory usw-pr-cvs1:/tmp/cvs-serv25520 Modified Files: Tag: linux-sh-dc-2_4-branch ChangeLog.dc Log Message: Add port/unit info to mtd_info->name Index: ChangeLog.dc =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/ChangeLog.dc,v retrieving revision 1.56.2.13 retrieving revision 1.56.2.14 diff -u -d -r1.56.2.13 -r1.56.2.14 --- ChangeLog.dc 3 Nov 2002 12:27:26 -0000 1.56.2.13 +++ ChangeLog.dc 3 Nov 2002 14:23:13 -0000 1.56.2.14 @@ -1,5 +1,8 @@ 2002-11-03 M. R. Brown <mr...@li...> + * drivers/mtd/maps/vmu-flash.c (dc_flashmap_connect): Assign name + based on the connected port and unit. + Dreamcast internal flash support (read tested only). * drivers/mtd/chips/jedec_probe.c: New file, imported from stock |
From: M. R. B. <mr...@us...> - 2002-11-03 12:27:29
|
Update of /cvsroot/linuxdc/linux-sh-dc/drivers/mtd/chips In directory usw-pr-cvs1:/tmp/cvs-serv30413/drivers/mtd/chips Added Files: Tag: linux-sh-dc-2_4-branch jedec_probe.c Log Message: Dreamcast internal flash support (read tested only) --- NEW FILE: jedec_probe.c --- /* Common Flash Interface probe code. (C) 2000 Red Hat. GPL'd. $Id: jedec_probe.c,v 1.1.2.1 2002/11/03 12:27:26 mrbrown Exp $ */ #include <linux/config.h> #include <linux/module.h> #include <linux/types.h> #include <linux/kernel.h> #include <asm/io.h> #include <asm/byteorder.h> #include <linux/errno.h> #include <linux/slab.h> #include <linux/interrupt.h> #include <linux/mtd/map.h> #include <linux/mtd/cfi.h> #include <linux/mtd/gen_probe.h> /* Manufacturers */ #define MANUFACTURER_AMD 0x0001 #define MANUFACTURER_FUJITSU 0x0004 #define MANUFACTURER_ATMEL 0x001f #define MANUFACTURER_ST 0x0020 #define MANUFACTURER_SST 0x00BF #define MANUFACTURER_TOSHIBA 0x0098 /* AMD */ #define AM29F800BB 0x2258 #define AM29F800BT 0x22D6 #define AM29LV800BB 0x225B #define AM29LV800BT 0x22DA #define AM29LV160DT 0x22C4 #define AM29LV160DB 0x2249 /* Atmel */ #define AT49BV16X4 0x00c0 #define AT49BV16X4T 0x00c2 /* Fujitsu */ #define MBM29LV002TC 0x0040 #define MBM29LV160TE 0x22C4 #define MBM29LV160BE 0x2249 /* ST - www.st.com */ #define M29W800T 0x00D7 #define M29W160DT 0x22C4 #define M29W160DB 0x2249 /* SST */ #define SST39LF800 0x2781 #define SST39LF160 0x2782 /* Toshiba */ #define TC58FVT160 0x00C2 #define TC58FVB160 0x0043 struct amd_flash_info { const __u16 mfr_id; const __u16 dev_id; const char *name; const int DevSize; const int InterfaceDesc; const int NumEraseRegions; const ulong regions[4]; }; #define ERASEINFO(size,blocks) (size<<8)|(blocks-1) #define SIZE_256KiB 18 #define SIZE_1MiB 20 #define SIZE_2MiB 21 #define SIZE_4MiB 22 static const struct amd_flash_info jedec_table[] = { { mfr_id: MANUFACTURER_AMD, dev_id: AM29LV160DT, name: "AMD AM29LV160DT", DevSize: SIZE_2MiB, NumEraseRegions: 4, regions: {ERASEINFO(0x10000,31), ERASEINFO(0x08000,1), ERASEINFO(0x02000,2), ERASEINFO(0x04000,1) } }, { mfr_id: MANUFACTURER_AMD, dev_id: AM29LV160DB, name: "AMD AM29LV160DB", DevSize: SIZE_2MiB, NumEraseRegions: 4, regions: {ERASEINFO(0x04000,1), ERASEINFO(0x02000,2), ERASEINFO(0x08000,1), ERASEINFO(0x10000,31) } }, { mfr_id: MANUFACTURER_TOSHIBA, dev_id: TC58FVT160, name: "Toshiba TC58FVT160", DevSize: SIZE_2MiB, NumEraseRegions: 4, regions: {ERASEINFO(0x10000,31), ERASEINFO(0x08000,1), ERASEINFO(0x02000,2), ERASEINFO(0x04000,1) } }, { mfr_id: MANUFACTURER_FUJITSU, dev_id: MBM29LV002TC, name: "Fujitsu MBM29LV002TC", DevSize: SIZE_256KiB, NumEraseRegions: 4, regions: {ERASEINFO(0x10000, 3), ERASEINFO(0x08000, 1), ERASEINFO(0x02000, 2), ERASEINFO(0x04000, 1) } }, { mfr_id: MANUFACTURER_FUJITSU, dev_id: MBM29LV160TE, name: "Fujitsu MBM29LV160TE", DevSize: SIZE_2MiB, NumEraseRegions: 4, regions: {ERASEINFO(0x10000,31), ERASEINFO(0x08000,1), ERASEINFO(0x02000,2), ERASEINFO(0x04000,1) } }, { mfr_id: MANUFACTURER_TOSHIBA, dev_id: TC58FVB160, name: "Toshiba TC58FVB160", DevSize: SIZE_2MiB, NumEraseRegions: 4, regions: {ERASEINFO(0x04000,1), ERASEINFO(0x02000,2), ERASEINFO(0x08000,1), ERASEINFO(0x10000,31) } }, { mfr_id: MANUFACTURER_FUJITSU, dev_id: MBM29LV160BE, name: "Fujitsu MBM29LV160BE", DevSize: SIZE_2MiB, NumEraseRegions: 4, regions: {ERASEINFO(0x04000,1), ERASEINFO(0x02000,2), ERASEINFO(0x08000,1), ERASEINFO(0x10000,31) } }, { mfr_id: MANUFACTURER_AMD, dev_id: AM29LV800BB, name: "AMD AM29LV800BB", DevSize: SIZE_1MiB, NumEraseRegions: 4, regions: {ERASEINFO(0x04000,1), ERASEINFO(0x02000,2), ERASEINFO(0x08000,1), ERASEINFO(0x10000,15), } }, { mfr_id: MANUFACTURER_AMD, dev_id: AM29F800BB, name: "AMD AM29F800BB", DevSize: SIZE_1MiB, NumEraseRegions: 4, regions: {ERASEINFO(0x04000,1), ERASEINFO(0x02000,2), ERASEINFO(0x08000,1), ERASEINFO(0x10000,15), } }, { mfr_id: MANUFACTURER_AMD, dev_id: AM29LV800BT, name: "AMD AM29LV800BT", DevSize: SIZE_1MiB, NumEraseRegions: 4, regions: {ERASEINFO(0x10000,15), ERASEINFO(0x08000,1), ERASEINFO(0x02000,2), ERASEINFO(0x04000,1) } }, { mfr_id: MANUFACTURER_AMD, dev_id: AM29F800BT, name: "AMD AM29F800BT", DevSize: SIZE_1MiB, NumEraseRegions: 4, regions: {ERASEINFO(0x10000,15), ERASEINFO(0x08000,1), ERASEINFO(0x02000,2), ERASEINFO(0x04000,1) } }, { mfr_id: MANUFACTURER_AMD, dev_id: AM29LV800BB, name: "AMD AM29LV800BB", DevSize: SIZE_1MiB, NumEraseRegions: 4, regions: {ERASEINFO(0x10000,15), ERASEINFO(0x08000,1), ERASEINFO(0x02000,2), ERASEINFO(0x04000,1) } }, { mfr_id: MANUFACTURER_ST, dev_id: M29W800T, name: "ST M29W800T", DevSize: SIZE_1MiB, NumEraseRegions: 4, regions: {ERASEINFO(0x10000,15), ERASEINFO(0x08000,1), ERASEINFO(0x02000,2), ERASEINFO(0x04000,1) } }, { mfr_id: MANUFACTURER_ST, dev_id: M29W160DT, name: "ST M29W160DT", DevSize: SIZE_2MiB, NumEraseRegions: 4, regions: {ERASEINFO(0x10000,31), ERASEINFO(0x08000,1), ERASEINFO(0x02000,2), ERASEINFO(0x04000,1) } }, { mfr_id: MANUFACTURER_ST, dev_id: M29W160DB, name: "ST M29W160DB", DevSize: SIZE_2MiB, NumEraseRegions: 4, regions: {ERASEINFO(0x04000,1), ERASEINFO(0x02000,2), ERASEINFO(0x08000,1), ERASEINFO(0x10000,31) } }, { mfr_id: MANUFACTURER_ATMEL, dev_id: AT49BV16X4, name: "Atmel AT49BV16X4", DevSize: SIZE_2MiB, NumEraseRegions: 3, regions: {ERASEINFO(0x02000,8), ERASEINFO(0x08000,2), ERASEINFO(0x10000,30) } }, { mfr_id: MANUFACTURER_ATMEL, dev_id: AT49BV16X4T, name: "Atmel AT49BV16X4T", DevSize: SIZE_2MiB, NumEraseRegions: 3, regions: {ERASEINFO(0x10000,30), ERASEINFO(0x08000,2), ERASEINFO(0x02000,8) } } }; static int cfi_jedec_setup(struct cfi_private *p_cfi, int index); static int jedec_probe_chip(struct map_info *map, __u32 base, struct flchip *chips, struct cfi_private *cfi); struct mtd_info *jedec_probe(struct map_info *map); #define jedec_read_mfr(map, base, osf) cfi_read(map, base) #define jedec_read_id(map, base, osf) cfi_read(map, (base)+(osf)) static int cfi_jedec_setup(struct cfi_private *p_cfi, int index) { int i,num_erase_regions; printk("Found: %s\n",jedec_table[index].name); num_erase_regions = jedec_table[index].NumEraseRegions; p_cfi->cfiq = kmalloc(sizeof(struct cfi_ident) + num_erase_regions * 4, GFP_KERNEL); if (!p_cfi->cfiq) { //xx printk(KERN_WARNING "%s: kmalloc failed for CFI ident structure\n", map->name); return 0; } memset(p_cfi->cfiq,0,sizeof(struct cfi_ident)); p_cfi->cfiq->P_ID = P_ID_AMD_STD; p_cfi->cfiq->NumEraseRegions = jedec_table[index].NumEraseRegions; p_cfi->cfiq->DevSize = jedec_table[index].DevSize; for (i=0; i<num_erase_regions; i++){ p_cfi->cfiq->EraseRegionInfo[i] = jedec_table[index].regions[i]; } return 1; /* ok */ } static int jedec_probe_chip(struct map_info *map, __u32 base, struct flchip *chips, struct cfi_private *cfi) { int i; int osf = cfi->interleave * cfi->device_type; int retried = 0; if (!cfi->numchips) { switch (cfi->device_type) { case CFI_DEVICETYPE_X8: cfi->addr_unlock1 = 0x555; cfi->addr_unlock2 = 0x2aa; break; case CFI_DEVICETYPE_X16: cfi->addr_unlock1 = 0xaaa; if (map->buswidth == cfi->interleave) { /* X16 chip(s) in X8 mode */ cfi->addr_unlock2 = 0x555; } else { cfi->addr_unlock2 = 0x554; } break; case CFI_DEVICETYPE_X32: cfi->addr_unlock1 = 0x1555; cfi->addr_unlock2 = 0xaaa; break; default: printk(KERN_NOTICE "Eep. Unknown jedec_probe device type %d\n", cfi->device_type); return 0; } } retry: /* Reset */ cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL); /* Autoselect Mode */ cfi_send_gen_cmd(0xaa, cfi->addr_unlock1, base, map, cfi, CFI_DEVICETYPE_X8, NULL); cfi_send_gen_cmd(0x55, cfi->addr_unlock2, base, map, cfi, CFI_DEVICETYPE_X8, NULL); cfi_send_gen_cmd(0x90, cfi->addr_unlock1, base, map, cfi, CFI_DEVICETYPE_X8, NULL); if (!cfi->numchips) { /* This is the first time we're called. Set up the CFI stuff accordingly and return */ cfi->mfr = jedec_read_mfr(map, base, osf); cfi->id = jedec_read_id(map, base, osf); for (i=0; i<sizeof(jedec_table)/sizeof(jedec_table[0]); i++) { if (cfi->mfr == jedec_table[i].mfr_id && cfi->id == jedec_table[i].dev_id) return cfi_jedec_setup(cfi, i); } if (!retried++) { /* Deal with whichever strange chips these were */ cfi->addr_unlock1 |= cfi->addr_unlock1 << 8; cfi->addr_unlock2 |= cfi->addr_unlock2 << 8; goto retry; } return 0; } /* Check each previous chip to see if it's an alias */ for (i=0; i<cfi->numchips; i++) { /* This chip should be in read mode if it's one we've already touched. */ if (jedec_read_mfr(map, base, osf) == cfi->mfr && jedec_read_id(map, base, osf) == cfi->id) { /* Eep. This chip also looks like it's in autoselect mode. Is it an alias for the new one? */ cfi_send_gen_cmd(0xF0, 0, chips[i].start, map, cfi, cfi->device_type, NULL); /* If the device IDs go away, it's an alias */ if (jedec_read_mfr(map, base, osf) != cfi->mfr || jedec_read_id(map, base, osf) != cfi->id) { printk(KERN_DEBUG "%s: Found an alias at 0x%x for the chip at 0x%lx\n", map->name, base, chips[i].start); return 0; } /* Yes, it's actually got the device IDs as data. Most * unfortunate. Stick the new chip in read mode * too and if it's the same, assume it's an alias. */ /* FIXME: Use other modes to do a proper check */ cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL); if (jedec_read_mfr(map, base, osf) == cfi->mfr && jedec_read_id(map, base, osf) == cfi->id) { printk(KERN_DEBUG "%s: Found an alias at 0x%x for the chip at 0x%lx\n", map->name, base, chips[i].start); return 0; } } } /* OK, if we got to here, then none of the previous chips appear to be aliases for the current one. */ if (cfi->numchips == MAX_CFI_CHIPS) { printk(KERN_WARNING"%s: Too many flash chips detected. Increase MAX_CFI_CHIPS from %d.\n", map->name, MAX_CFI_CHIPS); /* Doesn't matter about resetting it to Read Mode - we're not going to talk to it anyway */ return -1; } chips[cfi->numchips].start = base; chips[cfi->numchips].state = FL_READY; cfi->numchips++; /* Put it back into Read Mode */ cfi_send_gen_cmd(0xF0, 0, base, map, cfi, cfi->device_type, NULL); printk(KERN_INFO "%s: Found %d x%d devices at 0x%x in %d-bit mode\n", map->name, cfi->interleave, cfi->device_type*8, base, map->buswidth*8); return 1; } static struct chip_probe jedec_chip_probe = { name: "JEDEC", probe_chip: jedec_probe_chip }; struct mtd_info *jedec_probe(struct map_info *map) { /* * Just use the generic probe stuff to call our CFI-specific * chip_probe routine in all the possible permutations, etc. */ return mtd_do_chip_probe(map, &jedec_chip_probe); } static struct mtd_chip_driver jedec_chipdrv = { probe: jedec_probe, name: "jedec_probe", module: THIS_MODULE }; int __init jedec_probe_init(void) { register_mtd_chip_driver(&jedec_chipdrv); return 0; } static void __exit jedec_probe_exit(void) { unregister_mtd_chip_driver(&jedec_chipdrv); } module_init(jedec_probe_init); module_exit(jedec_probe_exit); MODULE_LICENSE("GPL"); MODULE_AUTHOR("Erwin Authried <ea...@so...> et al."); MODULE_DESCRIPTION("Probe code for JEDEC-compliant flash chips"); |
From: M. R. B. <mr...@us...> - 2002-11-03 12:27:29
|
Update of /cvsroot/linuxdc/linux-sh-dc/drivers/mtd/maps In directory usw-pr-cvs1:/tmp/cvs-serv30413/drivers/mtd/maps Modified Files: Tag: linux-sh-dc-2_4-branch Config.in Makefile Added Files: Tag: linux-sh-dc-2_4-branch dreamcast-flash.c Log Message: Dreamcast internal flash support (read tested only) --- NEW FILE: dreamcast-flash.c --- /* * drivers/mtd/maps/dreamcast-flash.c * * SEGA Dreamcast internal flash device support. * * Copyright (C) 2002 M. R. Brown * * Released under the terms of the GNU GPL v2. * * This code is based dbox2-flash.c, written by Kári Davíðsson <kd...@fl...> */ #include <linux/config.h> #include <linux/types.h> #include <linux/kernel.h> #include <linux/module.h> #include <linux/mtd/mtd.h> #include <linux/mtd/map.h> #include <linux/mtd/partitions.h> #include <asm/io.h> #define DREAMCAST_FLASH_ADDR 0x00200000 #define DREAMCAST_FLASH_SIZE 0x20000 static struct mtd_info *dreamcast_mtd; /* * SEGA Dreamcast "Dare to be different" * * The Dreamcast utilizes a Fujitsu MBM29LV002TC 256k x 8bit flash device. * The device is sold with a default of 7 sectors, totalling 256kb. For * whatever reason, SEGA decided to only allow the latter 5 sectors to be * physically accessible on the bus, so that only the last 128k of flash are * available. They also devised a nifty logical partition layout that isn't * contiguous to the physical layout. * Here is the mapping from device physical sectors to SEGA logical ones: * * Phys | Log | Offset | Size | * ------------------------------ * 0 | N/A | 0 | 64k | * 1 | N/A | 10000 | 64k | * 2 | 4 | 20000 | 64k | * 3 | 3 | 30000 | 32k | * 4 | 1 | 38000 | 8k | * 5 | 0 | 3a000 | 8k | * 6 | 2 | 3c000 | 16k | * * It gets better. After reaching the end of the first 128k block of flash * (remember that this is really the second half of the full 256k) the flash * repeats itself every 128k beginning with physical sector 2. Our only * saving grace is that because the first 128k are missing, using the physical * sector 2 address for logical partition 4 puts us on an erase block. * Thankfully we can use the absolute sector addresses as is within the MTD * partition layout. * * Thank you SEGA, for daring to be different. */ static struct mtd_partition dreamcast_partitions[] = { { name: "System configuration", size: 8 * 1024, offset: 0x3a000, mask_flags: MTD_WRITEABLE, /* _not_ writeable */ }, { name: "Microsoft reserved", size: 8 * 1024, offset: 0x38000, }, { name: "Network configuration", size: 16 * 1024, offset: 0x3c000, }, { name: "Game / User save area", size: 32 * 1024, offset: 0x30000, }, { name: "Backup / metainformation", size: 64 * 1024, offset: 0x20000, } }; #define NUM_PARTITIONS (sizeof(dreamcast_partitions) / \ sizeof(dreamcast_partitions[0])) /* * Access routines. */ static __u8 dreamcast_flash_read8(struct map_info *map, unsigned long ofs) { return __raw_readb(map->map_priv_1 + ofs); } static __u16 dreamcast_flash_read16(struct map_info *map, unsigned long ofs) { return __raw_readw(map->map_priv_1 + ofs); } static __u32 dreamcast_flash_read32(struct map_info *map, unsigned long ofs) { return __raw_readl(map->map_priv_1 + ofs); } static void dreamcast_flash_copy_from(struct map_info *map, void *to, unsigned long from, ssize_t len) { memcpy_fromio(to, map->map_priv_1 + from, len); } static void dreamcast_flash_write8(struct map_info *map, __u8 d, unsigned long adr) { __raw_writeb(d, map->map_priv_1 + adr); mb(); } static void dreamcast_flash_write16(struct map_info *map, __u16 d, unsigned long adr) { __raw_writew(d, map->map_priv_1 + adr); mb(); } static void dreamcast_flash_write32(struct map_info *map, __u32 d, unsigned long adr) { __raw_writel(d, map->map_priv_1 + adr); mb(); } static void dreamcast_flash_copy_to(struct map_info *map, unsigned long to, const void *from, ssize_t len) { memcpy_toio(map->map_priv_1 + to, from, len); } static struct map_info dreamcast_flash_map = { name: "Dreamcast internal flash", size: DREAMCAST_FLASH_SIZE, buswidth: 1, read8: dreamcast_flash_read8, read16: dreamcast_flash_read16, read32: dreamcast_flash_read32, copy_from: dreamcast_flash_copy_from, write8: dreamcast_flash_write8, write16: dreamcast_flash_write16, write32: dreamcast_flash_write32, copy_to: dreamcast_flash_copy_to, }; static int __init dreamcast_flash_init(void) { if (!(dreamcast_flash_map.map_priv_1 = (__u32) ioremap(DREAMCAST_FLASH_ADDR, DREAMCAST_FLASH_SIZE))) { printk("DC flash: Unable to map flash memory!\n"); return -EIO; } dreamcast_mtd = do_map_probe("jedec_probe", &dreamcast_flash_map); if (!dreamcast_mtd) { iounmap((void *)dreamcast_flash_map.map_priv_1); panic("Couldn't find the flash chip?!? Fix.\n"); } dreamcast_mtd->module = THIS_MODULE; #ifdef CONFIG_MTD_DREAMCAST_NO_PART add_mtd_device(dreamcast_mtd); #else add_mtd_partitions(dreamcast_mtd, dreamcast_partitions, NUM_PARTITIONS); #endif return 0; } static void __exit dreamcast_flash_exit(void) { if (dreamcast_mtd) { #ifdef CONFIG_MTD_DREAMCAST_NO_PART del_mtd_device(dreamcast_mtd); #else del_mtd_partitions(dreamcast_mtd); #endif map_destroy(dreamcast_mtd); } if (dreamcast_flash_map.map_priv_1) { iounmap((void *)dreamcast_flash_map.map_priv_1); dreamcast_flash_map.map_priv_1 = 0; } } module_init(dreamcast_flash_init); module_exit(dreamcast_flash_exit); MODULE_LICENSE("GPL"); MODULE_AUTHOR("M. R. Brown <mr...@li...>"); MODULE_DESCRIPTION("MTD map driver for the SEGA Dreamcast"); Index: Config.in =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/drivers/mtd/maps/Config.in,v retrieving revision 1.3.4.1 retrieving revision 1.3.4.2 diff -u -d -r1.3.4.1 -r1.3.4.2 --- Config.in 26 Oct 2002 14:14:01 -0000 1.3.4.1 +++ Config.in 3 Nov 2002 12:27:27 -0000 1.3.4.2 @@ -61,7 +61,11 @@ if [ "$CONFIG_MTD_SOLUTIONENGINE" != "n" ]; then hex ' Default reserved Flash size' CONFIG_MTD_SUPERH_RESERVE 0x00010000 fi - dep_tristate ' Flash device mapping on Sega Dreamcast VMU' CONFIG_MTD_VMU $CONFIG_SH_DREAMCAST + if [ "$CONFIG_SH_DREAMCAST" = "y" ]; then + tristate ' Flash device mapping on SEGA Dreamcast VMU' CONFIG_MTD_VMU + dep_tristate ' SEGA Dreamcast internal JEDEC-compatible flash device' CONFIG_MTD_DREAMCAST $CONFIG_MTD_JEDECPROBE + dep_bool ' Disable SEGAs logical partition mapping' CONFIG_MTD_DREAMCAST_NO_PART $CONFIG_MTD_DREAMCAST + fi fi if [ "$CONFIG_ARM" = "y" ]; then Index: Makefile =================================================================== RCS file: /cvsroot/linuxdc/linux-sh-dc/drivers/mtd/maps/Makefile,v retrieving revision 1.3.4.2 retrieving revision 1.3.4.3 diff -u -d -r1.3.4.2 -r1.3.4.3 --- Makefile 26 Oct 2002 14:14:01 -0000 1.3.4.2 +++ Makefile 3 Nov 2002 12:27:27 -0000 1.3.4.3 @@ -41,5 +41,6 @@ obj-$(CONFIG_MTD_PB1500) += pb1xxx-flash.o obj-$(CONFIG_MTD_AUTCPU12) += autcpu12-nvram.o obj-$(CONFIG_MTD_VMU) += vmu-flash.o +obj-$(CONFIG_MTD_DREAMCAST) += dreamcast-flash.o include $(TOPDIR)/Rules.make |