linux/drivers/char/nwflash.c
<<
>>
Prefs
   1/*
   2 * Flash memory interface rev.5 driver for the Intel
   3 * Flash chips used on the NetWinder.
   4 *
   5 * 20/08/2000   RMK     use __ioremap to map flash into virtual memory
   6 *                      make a few more places use "volatile"
   7 * 22/05/2001   RMK     - Lock read against write
   8 *                      - merge printk level changes (with mods) from Alan Cox.
   9 *                      - use *ppos as the file position, not file->f_pos.
  10 *                      - fix check for out of range pos and r/w size
  11 *
  12 * Please note that we are tampering with the only flash chip in the
  13 * machine, which contains the bootup code.  We therefore have the
  14 * power to convert these machines into doorstops...
  15 */
  16
  17#include <linux/module.h>
  18#include <linux/types.h>
  19#include <linux/fs.h>
  20#include <linux/errno.h>
  21#include <linux/mm.h>
  22#include <linux/delay.h>
  23#include <linux/proc_fs.h>
  24#include <linux/miscdevice.h>
  25#include <linux/spinlock.h>
  26#include <linux/rwsem.h>
  27#include <linux/init.h>
  28#include <linux/mutex.h>
  29#include <linux/jiffies.h>
  30
  31#include <asm/hardware/dec21285.h>
  32#include <asm/io.h>
  33#include <asm/mach-types.h>
  34#include <asm/uaccess.h>
  35
  36/*****************************************************************************/
  37#include <asm/nwflash.h>
  38
  39#define NWFLASH_VERSION "6.4"
  40
  41static DEFINE_MUTEX(flash_mutex);
  42static void kick_open(void);
  43static int get_flash_id(void);
  44static int erase_block(int nBlock);
  45static int write_block(unsigned long p, const char __user *buf, int count);
  46
  47#define KFLASH_SIZE     1024*1024       //1 Meg
  48#define KFLASH_SIZE4    4*1024*1024     //4 Meg
  49#define KFLASH_ID       0x89A6          //Intel flash
  50#define KFLASH_ID4      0xB0D4          //Intel flash 4Meg
  51
  52static bool flashdebug;         //if set - we will display progress msgs
  53
  54static int gbWriteEnable;
  55static int gbWriteBase64Enable;
  56static volatile unsigned char *FLASH_BASE;
  57static int gbFlashSize = KFLASH_SIZE;
  58static DEFINE_MUTEX(nwflash_mutex);
  59
  60static int get_flash_id(void)
  61{
  62        volatile unsigned int c1, c2;
  63
  64        /*
  65         * try to get flash chip ID
  66         */
  67        kick_open();
  68        c2 = inb(0x80);
  69        *(volatile unsigned char *) (FLASH_BASE + 0x8000) = 0x90;
  70        udelay(15);
  71        c1 = *(volatile unsigned char *) FLASH_BASE;
  72        c2 = inb(0x80);
  73
  74        /*
  75         * on 4 Meg flash the second byte is actually at offset 2...
  76         */
  77        if (c1 == 0xB0)
  78                c2 = *(volatile unsigned char *) (FLASH_BASE + 2);
  79        else
  80                c2 = *(volatile unsigned char *) (FLASH_BASE + 1);
  81
  82        c2 += (c1 << 8);
  83
  84        /*
  85         * set it back to read mode
  86         */
  87        *(volatile unsigned char *) (FLASH_BASE + 0x8000) = 0xFF;
  88
  89        if (c2 == KFLASH_ID4)
  90                gbFlashSize = KFLASH_SIZE4;
  91
  92        return c2;
  93}
  94
  95static long flash_ioctl(struct file *filep, unsigned int cmd, unsigned long arg)
  96{
  97        mutex_lock(&flash_mutex);
  98        switch (cmd) {
  99        case CMD_WRITE_DISABLE:
 100                gbWriteBase64Enable = 0;
 101                gbWriteEnable = 0;
 102                break;
 103
 104        case CMD_WRITE_ENABLE:
 105                gbWriteEnable = 1;
 106                break;
 107
 108        case CMD_WRITE_BASE64K_ENABLE:
 109                gbWriteBase64Enable = 1;
 110                break;
 111
 112        default:
 113                gbWriteBase64Enable = 0;
 114                gbWriteEnable = 0;
 115                mutex_unlock(&flash_mutex);
 116                return -EINVAL;
 117        }
 118        mutex_unlock(&flash_mutex);
 119        return 0;
 120}
 121
 122static ssize_t flash_read(struct file *file, char __user *buf, size_t size,
 123                          loff_t *ppos)
 124{
 125        ssize_t ret;
 126
 127        if (flashdebug)
 128                printk(KERN_DEBUG "flash_read: flash_read: offset=0x%llx, "
 129                       "buffer=%p, count=0x%zx.\n", *ppos, buf, size);
 130        /*
 131         * We now lock against reads and writes. --rmk
 132         */
 133        if (mutex_lock_interruptible(&nwflash_mutex))
 134                return -ERESTARTSYS;
 135
 136        ret = simple_read_from_buffer(buf, size, ppos, (void *)FLASH_BASE, gbFlashSize);
 137        mutex_unlock(&nwflash_mutex);
 138
 139        return ret;
 140}
 141
 142static ssize_t flash_write(struct file *file, const char __user *buf,
 143                           size_t size, loff_t * ppos)
 144{
 145        unsigned long p = *ppos;
 146        unsigned int count = size;
 147        int written;
 148        int nBlock, temp, rc;
 149        int i, j;
 150
 151        if (flashdebug)
 152                printk("flash_write: offset=0x%lX, buffer=0x%p, count=0x%X.\n",
 153                       p, buf, count);
 154
 155        if (!gbWriteEnable)
 156                return -EINVAL;
 157
 158        if (p < 64 * 1024 && (!gbWriteBase64Enable))
 159                return -EINVAL;
 160
 161        /*
 162         * check for out of range pos or count
 163         */
 164        if (p >= gbFlashSize)
 165                return count ? -ENXIO : 0;
 166
 167        if (count > gbFlashSize - p)
 168                count = gbFlashSize - p;
 169                        
 170        if (!access_ok(VERIFY_READ, buf, count))
 171                return -EFAULT;
 172
 173        /*
 174         * We now lock against reads and writes. --rmk
 175         */
 176        if (mutex_lock_interruptible(&nwflash_mutex))
 177                return -ERESTARTSYS;
 178
 179        written = 0;
 180
 181        nBlock = (int) p >> 16; //block # of 64K bytes
 182
 183        /*
 184         * # of 64K blocks to erase and write
 185         */
 186        temp = ((int) (p + count) >> 16) - nBlock + 1;
 187
 188        /*
 189         * write ends at exactly 64k boundary?
 190         */
 191        if (((int) (p + count) & 0xFFFF) == 0)
 192                temp -= 1;
 193
 194        if (flashdebug)
 195                printk(KERN_DEBUG "flash_write: writing %d block(s) "
 196                        "starting at %d.\n", temp, nBlock);
 197
 198        for (; temp; temp--, nBlock++) {
 199                if (flashdebug)
 200                        printk(KERN_DEBUG "flash_write: erasing block %d.\n", nBlock);
 201
 202                /*
 203                 * first we have to erase the block(s), where we will write...
 204                 */
 205                i = 0;
 206                j = 0;
 207          RetryBlock:
 208                do {
 209                        rc = erase_block(nBlock);
 210                        i++;
 211                } while (rc && i < 10);
 212
 213                if (rc) {
 214                        printk(KERN_ERR "flash_write: erase error %x\n", rc);
 215                        break;
 216                }
 217                if (flashdebug)
 218                        printk(KERN_DEBUG "flash_write: writing offset %lX, "
 219                               "from buf %p, bytes left %X.\n", p, buf,
 220                               count - written);
 221
 222                /*
 223                 * write_block will limit write to space left in this block
 224                 */
 225                rc = write_block(p, buf, count - written);
 226                j++;
 227
 228                /*
 229                 * if somehow write verify failed? Can't happen??
 230                 */
 231                if (!rc) {
 232                        /*
 233                         * retry up to 10 times
 234                         */
 235                        if (j < 10)
 236                                goto RetryBlock;
 237                        else
 238                                /*
 239                                 * else quit with error...
 240                                 */
 241                                rc = -1;
 242
 243                }
 244                if (rc < 0) {
 245                        printk(KERN_ERR "flash_write: write error %X\n", rc);
 246                        break;
 247                }
 248                p += rc;
 249                buf += rc;
 250                written += rc;
 251                *ppos += rc;
 252
 253                if (flashdebug)
 254                        printk(KERN_DEBUG "flash_write: written 0x%X bytes OK.\n", written);
 255        }
 256
 257        mutex_unlock(&nwflash_mutex);
 258
 259        return written;
 260}
 261
 262
 263/*
 264 * The memory devices use the full 32/64 bits of the offset, and so we cannot
 265 * check against negative addresses: they are ok. The return value is weird,
 266 * though, in that case (0).
 267 *
 268 * also note that seeking relative to the "end of file" isn't supported:
 269 * it has no meaning, so it returns -EINVAL.
 270 */
 271static loff_t flash_llseek(struct file *file, loff_t offset, int orig)
 272{
 273        loff_t ret;
 274
 275        mutex_lock(&flash_mutex);
 276        if (flashdebug)
 277                printk(KERN_DEBUG "flash_llseek: offset=0x%X, orig=0x%X.\n",
 278                       (unsigned int) offset, orig);
 279
 280        switch (orig) {
 281        case 0:
 282                if (offset < 0) {
 283                        ret = -EINVAL;
 2" cl2sref">nBlock8_3rn value is weird,dclass="sref">file
nBlock<2a> + 1;
 278                       (unsigned    if (count > offs\n"<187
 283                        ret = -ori
 2" cl2sref">nBlock8_ boundary2

-   i2" class="line"=_ame="L251"> 251 278                       (unsignedame="L184"284"> 2" cl2sref">nBlock8_ et &l> -= 1;
 136        -   i2" class="line"=_ame="L251"> 251 2" cl2sref">nBlock8_ ref">EINV193
 2" cl2sref">nBlock8_ rn value ug)
 281
-   i2" class="line"=_ame="L251"> 251count > offref">nBlo2k);
 283                        ret = -2197
 2" cl2sref">nBlock8_ sref">oria>++) {
flashde3ug)
-   i2" class="line"=_ame="L251"> 251of3ref">nBlo3k);
 283                        ret = -3201
 2" cl2sref">nBlock83omment">/3
 243
-   i2" class="line"=_ame="L251"> 251         2" cl2sref">nBlock83        *3
 136        -   i2" class="line"=_ame="L251"> 251 2" cl2sref">nBlock83"sref">i<3a> = 0;
 106    3"sref">j<3a> = 0;
 112RetryBl3ck:
 283                        ret = -++) {
 243nBlo3k);
 257        mutex_lock(&3++;
 139        return i &3t; 10);
 243/3212
r3) {
3c);
 263 26just go aheademoryERN_E    aquested!                           * else quit wi3 >RetryBl3ug)
 2703uf,
rc =  148       href="+code=flashdebug" class="sre3ef">writt3n);
of3e="L221">3221
 148c1>        return /3
file        return r3
file<"comout>        return 3
,  148.\n&1>        return );
3++;
 2633227
  263 270
r3) {
 263/3
 263r3
 2703
 148c1>     un(voa>ppos, (void *)j 3lt; 10)
RetryBl3ck;
 259kick_ope=3   else
 188        /3
ment">                         * retry up 3h error..3
 270ppos, (void *)rc = -1;
3242
 188        rc &3t; 0) {
 *  c*curre cl writ                              * else quit wi3>">j 3c);
 270file      s="line" n="+c51" cs="line" name="class="line" namppos" class="sref">ppos, (void *) 207 248    34  /3
 249    34ment">                         * retry>r3 250    35a> 251    35  p r3
 252
 253    35  3   else
 254    3              ="3omment">/3
 255    35rre cl writ                           a> &3href="drivers3char/3wflash.c#L239" id="L235" class="line" name="L256"> 256
 257    3    258
 259    3   return /3
 260}
 261
RetryBl3 break;
 262
 263 264/3
 265 * check aga/span>
 266 * though, ibreak;
 267 268 269/3
 270 */

 271stat37ef="dan class="c3 >RetryBl3 break;
 272{
3
 25jiffieref">i<3a> = 0;
jiffier07"> 20pan*=_ame="L251"> 25HZef">i<3a> = 0;
HZef="drivers3char/32flash.c#L284" id="L143" class=3line" name="L273"> 273    3   "drivers3char/3wflash.c#L242" id="L244" class=3line" name="L274"> 274

 25jiffieref">i<3a> = 0;
jiffier07">ef="+code=ret" cla cla3o="sref">3
 275    37a>                retuksleenhref=f="drivers/char/nwflash.c#L212" id="L236" class=3line" name="L276"> 276    37          /3
 277    37a>quested!                                  *s
 278    37orrect  279
ppos, (void *) 280    38          /3
 281    3   case 0:
 282    3ref="drivers/char/nwflash.c#L183" id="L133" class=3line" name="L283"> 283    3   /*
 2" cl3sref"3 class="comment">         * # of 64K bl263">" idhref=normals
(         */
nBlock<2a> + 3;
3   else
 278 3     38a>quested!                 a/   , (void *) 283    3              ppos, (void *)/3
onhref="drivers/char/nwflash.c#L219" id="L231" class=3" name="L184"284"> 2" cl3sref"38ef="drivers3char/3wflash.c#L271/a> 
<="comment">/*
RetryBl3 break;
rlue an>
-   i="comment">         */
 2" cl2sref">n3lock83 rn value ug)
printk(KERN_ERR "flash_write: writa> &3:hx\n\n",  281-   i2" class="l="comment">/*
 283    39a>quested!                                  *s
<263"x\n&qhref="drivers/char/nwflash.c#L184" id="L139" class=3" name="L184"284"> 2" cl3sref"39orrect fl3shde3ug)
rc = -1;
-   i2" class="lref="+c-2drivers3char/3wflash.c#L242" id="L2471 cs2" c4aline" n2mp; 0xFFF2) == 4>    40  case 0:
 2" cl4sref"40ef="drivers/char/nwflash.c#L183" id="L143" class=4line" name="L243"> 243/*
                 */<*     *         */
 106    40          retuksleenhref=f="drivers/char/nwflash.c#L212" id="L242" class=4line" name="L112"> 112Ret40ef="drivers/char/nwflash.c#L228" id="L24="line" n4me="L283"> 283      4     4           ppos, (void *) 20 id="L240" class="ine" name="class="line"="+c5>RetryBl3 break;
 243n4lo3k<40ef="drivers3char/3wflash.c#L271/a>  257    4    148.\n&1>        return "d&1ame="L148"> 148.\n&1>        return  148.\n&1>        return  24="drivers3char/3wflash.c#L101" id="L149" class=4line" name="L139"> 139    4           } while ( 25a3o        3n);
ppos, (void *) 243/3212<4a>
printk(KERN_ERR "flash_write: writa> &3:hed? Canx\n\n"ot;, r3)4{
);
3c4;
 263 2703ufrc42ref="drivers/char/nwflash.c#L261" id="L24et" class4"sref">of3e="L221">3221<4a>
         */a href="drivers/char/nwflash.c#L184" id="L14" id="L144="+c51" class="line" n!<4 hPta4 class="comment">            ck will limit write to spnumber3>">"#37;X bypan clasn thick
fi4 class="comment">            a href="drivers/char/nwflash.c#L186" id="L14"line" na4e;starting at %d.\n&4uot;<4span>,write_block(p, buf, count - 3+4;
/3
/3
r3
r3r3)4{

3
);
< cla3o ef="drivers3char/3wflash.c#L225"" class43" class=4line"s="line" name="L2704> 27043ef="drivers3char/31flash.c#L265" id="L245" clas=14me="L148"> 148c1>     un4voa><4le" id="L146="+c51" class="liine" name="class="line" namppos" class="sref">ppos, (void *) 20href="+code=retref">p, RetryBl3ck 259kic4_ope=43a>3227
 188    43orrect 
ment">                         * retr href="drivers/char/nwflash.c#L186" id="L140" class=4line"s="line" name="L2704> 27044  count >  25ref">p += 3242
offset < 0) {
<20href="+code=rets="sref">count -  188    4           }
count - 
p, 4*  c*4              ="3e="L227">3227
RetryBl3 break;

filequested!                          r href="drivers/char/nwflash.c#L186" id="L140" class=4line" name="L248"> 248    44          3
 25jiffieref">i<3a> = 0;
jiffier07"> 203an*=_ame="L251"> 25HZef">i<3a> = 0;
HZef="drivers3char/32flash.c#L284" id="L149" class=4line" name="L249"> 249    44ef="drivers3char/3wflash.c#L271/a>  250    45   14ass="sref">count >  14ss="sref">offset < 0) {
count -  14ss="sref">offset < 0) {
+++code=p" class="srne" name="class="line" namppos" clas++="drivers3char/3wflash.c#L101" id="L141" class=4line" name="L251"> 251    4           *r3 2" cl2sref">nBlo=ret" cla3o"sref">r3
 252
 25uAhey ar3o"sref">r3 253    4           if (/3
buf += of3ref">nBlo3k);
arivers/char/nwflash.c#L222" id="L244" class=4line" name="L254"> 254    4                   of3ref">nBEFAULTef="drivers3char/32flash.c#L284" id="L142" class=4line" name="L255"> 255    45t2 256
-   i2" clcode=offset" cln>
of3ref">nBn>
drivers3char/3wflash.c#L208" id="L247" class=4line" name="L257"> 257    45          3227
 258
 r3 259    45ment">                         * ret        r href="drivers/char/nwflash.c#L186" id="L140" class=4line" name="L260"> 260}
ppos, (void *)j 3lt; 10)
 261
 262
3227
 263/*
 264 * The memor   * ret        r href="drivers/char/nwflash.c#L186" id="L140" class=4line" name="L265"> 265        3   else
 266 2673227
 268 * also noteine" nambreak;
 263 269 * it has no   * ret        r href="drivers/char/nwflash.c#L186" id="L140" class=4line" name="L270"> 270
 2" cl2sref">nBlo=ret" cla3o"sref">r3
 271stat47ef="drivers/char/nwflash.c#L262" id="L242" class=4line" name="L272"> 272{
3227
 273    47class="comment">/*
 274
 * The memor   * ret        r href="drivers/char/nwflash.c#L186" id="L145" class=4line" name="L275"> 275    47a>        r3 276    47ef="drivers3char/3wflash.c#L137" id="L140" class=4line" name="L277"> 277    4           3227
 278    47orrect  279
 * it has no   * ret        r href="drivers/char/nwflash.c#L186" id="L140" class=4line" name="L280"> 280    48          r3/3
 281    48ef="drivers/char/nwflash.c#L262" id="L242" class=4line" name="L282"> 282    4           if (3227
 283    48class="comment">/*
 2" cl4sref"4 class="comment">         * # of 64K         r href="drivers/char/nwflash.c#L186" id="L140" class=4d="L260" class="line" na4e    4   *2
j 3lt; 10)
nBlock<2a> + 4;
 278 4     4               (unsignode=written" clne" namppos" class="sref">"drivers3char/3wflash.c#L242" id="L246" class=4line" name="L283"> 283    48ef="drivers/char/nwflash.c#L259" id="L241" class=4" name="L184"284"> 2" cl4sref"4nBlock8_ boundary23227
 */

y37href="drivers3char/32flash.c#L268" id="L2491" class4"line" n2mp; 0xFFF2) == 4)
RetryBl3 break;
<        r href="drivers/char/nwflash.c#L186" id="L149" class=4line"="+code=file" class4"sref4>-   i2" class="line"=_ame="L251"> 25" cla3o       3n);
< cla3o ef="e"=_ame="L251"> 25jiffieref">i<3a> = 0;
jiffier07"> 20pn*=_ame="L251"> 25HZef">i<3a> = 0;
HZef="drivers3char/32flash.c#L284" id="L143" class=4line"s="line" name="L1364> 13649ef="drivers3char/31flash.c#L274" id="L24ne" name=4L184"284"> 2" cl2sref">n4lock84 rn value ug)
3227
 281         */
 283    4                   
 25jiffieref">i<3a> = 0;
jiffier07">ef="+code=ret" cla cla3o       3n);
< cla3o ef="
arivers/char/nwflash.c#L222" id="L249" class=4" name="L184"284"> 2" cl4sref"4nBlock8_ sref">oria>++) {
ppos, (void *)j 3lt; 10)
fl49ef="drivers3char/3wflash.c#L271/a>  2" cl2sref">n3lock8 "3e="L227">3227
    50ef="dan class="c3 >RetryBl3 break;
<        rf="+< cla3oyg 3t#37; errorhref="drivers3char/32flash.c#L268" id="L258" classn5" name="L184"284"> 2" cl5sref"50-   i="comment">         */
<        r href="drivers/char/nwflash.c#L186" id="L153" class=5line" name="L243"> 243

 25jiffieref">i<3a> = 0;
jiffier07">ef="+code=ret" cla cla3o       3n);
< cla3o ef="
a"drivers3char/3wflash.c#L101" id="L152" class=5line"="+code=file" class5"sref5>-   i2" class="line"=) {
3   else
n3lock8 "3e="L227">3227
    50a> 283Ret50a>quested!                                          r href="drivers/char/nwflash.c#L186" id="L1538 class=5l name="L184"284"> 2" cl5     5           rc = -1;
 243n5lo3k<50ef="drivers3char/3wflash.c#L271/a>  257    51> 2" cl2sref">n3lock888888888go
of3ref">nBn>
drivers3char/3wflash.c#L242" id="L259" class=5line" name="L139"> 139    5           } while ( 243/3212<5a>
3227
r3)5{
/*
(" idh
on m" chref="drivers3char/32flash.c#L268" id="L259" class=5line" na3s="sref">3c5;
         * # of 64K         r href="drivers/char/nwflash.c#L186" id="L155" class=5line" name="L263"> 2633   else
-   i2" class="l="comment">/*
quested!                  ine" nambreak;
( 2703uf)
rc = -1;
rc52ref="of3e="L221">3221<5a>
/*
         */ ine" nambreak;

s an"x\n&qn #37, and+nots< cla3oy- href="drivers/char/nwflash.c#L184" id="L15"" class=5="+c51" class="line" n!<5 hPta5 class="comment">            ine" nambreak;
fi5 class="comment">             of 64K         r href="drivers/char/nwflash.c#L186" id="L15"line" na5e;starting at %d.\n&5uot;<52                  bre="+code=offset" clase" namppos" class="srefF) == 0)1f="drivers3char/3wflash.c#L101" id="L156" class=5line" na3s="sref">3+5;
-   i2" class="l href="+ede=written" cl class="sre3f="L227">3   else
/*
 
< of 64K         r href="drivers/char/nwflash.c#L186" id="L15="line" C5R_ROMWRITEREtk" class="s5ef"CS53> 2" cl2sref">n3lock888888888rpos, (void *)rc = -1;
r3)5{
/*
 2633
< of 64K         r href="drivers/char/nwflash.c#L186" id="L15=line" na5me="L148"> 148c1>     un5voa><53a>        
 25jiffieref">i<3a> = 0;
jiffier07">ef="+code=ret" cla cla3o      3n);
< cla3oef="
a"drivers3char/3wflash.c#L101" id="L156" class=5line" na3">RetryBl3ck-   i2" class="l href="+>n3lock8="+code=flashdebug"1" iddebug      3n);
1" iddebugef="
rivers3char/3wflash.c#L101" id="L156id="L2655k_ope="L259"> 259kic5_ope=53                  nBlo=s="sref">printk("flash_write(,  188    53          nBlo=ret" cla3o"sref">r3
rc n3lock888888888++++++++""comment">/*
RetryBl3 break;
<                        aywaitscoup, (m href="drivers3char/3wflash.c#L240" id="L252" class=5line" na3e="L242">3242
         */ ine" nambreak;
<                a href="drivers/char/nwflash.c#L186" id="L152" class=5line" name="L188"> 188    5           }
nBloksleen&1>        retuksleenhref=f="drivers/char/nwflash.c#L212" id="L254" class=54flash.c#L184" id="L184"5     53tref">p, 5*  c*54a>        
of3ref">nBn>
drivers3char/3wflash.c#L242" id="L256" class=5line"s="line" name="L2705> 27054ref">-   i2" class="l href="+} else"drivers3char/3wflash.c#L101" id="L157" clasn!5a hPtass="sref">filenBlo=s="sref">printk(KERN_ERR "flash_write(,  248    54          nBlo=ret" cla3o"sref">r3
rc 249    54hde3ug)
/*
 250    55a> 251    55ef="dan class="c3 >RetryBl3 break;
<                        a href="drivers/char/nwflash.c#L186" id="L152" class=5line" name="L252"> 252
 253    55ef="drivers3char/31flash.c#L274" id="L254" class=5line" name="L254"> 254    5                    255    55                  bredrivers3char/31flash.c#L193" id="L155" class=5line" name="L256"> 256
 257    55ef="drivers/char/nwflash.c#L228" id="L258" class=5line" name="L258"> 258
 259    55ef="drivers3char/3wflash.c#L271/a>  260}
ppos, (void *) 20href="+code=retref">p,  261
 262
 14ass="sref">count >  14ss="sref">offset < 0) {
count -  14ss="sref">offset < 0) {
++a"drivers3char/3wflash.c#L101" id="L153" class=5line" name="L263"> 263count - 07">ef="+code=ret" clnt">/3
 264count - 07">ef="+code=ret" cl"sref">buf +=  265        of3ref">nBEFAULTef="drivers3char/32flash.c#L284" id="L156" class=5line" name="L266"> 266-   i2" class="l="+code=ret" cl"sref">buf +=  267 25ne" namppos" class="sref">p r3
count - 07">a"drivers3char/3wflash.c#L101" id="L153" class=5line" name="L268"> 268oria>++) {
printk(KERN_ERR "flash_write(,  269)
nBlo=ret" cla3o"sref">r3
rc/3
count - 07">adrivers3char/32flash.c#L284" id="L150" class=5line" name="L270"> 270 271stat57          } while ( 272{
 273    57ef="drivers3char/31flash.c#L274" id="L254" class=5line" name="L274"> 274
count -  275    57a>   drivers/char/nwflash.c#L261" id="L252" class=5line" name="L276"> 276    57ef="drivers3char/3wflash.c#L137" id="L150" class=5line" name="L277"> 277    57ef="drivers/char/nwflash.c#L228" id="L253" class=5line" name="L278"> 278    57orrec3   else
 279
 280    58ROMWRITEREt  i<3a> = 0;
1" grref=drivers3char/31flash.c#L274" id="L251" class=5line" name="L281"> 281    58ef="drivers/char/nwflash.c#L262" id="L252" class=5line" name="L282"> 282    5           if ""comment">/*
 283    58class="comment">/*
 2" cl5sref"5 class="comment">         * # of 64K bl cla %gat3, refch;writebes
         */
nBlock<2a> + 5;
i<3a> = 0;
1" grref=adrivers3char/32flash.c#L284" id="L157" cs="li5e" name="L278"> 278 5     5              ode=temp" classnw_cpld_mod Ca name="class="liw_cpld_mod Caf="+code=KERN_ERR" cCPLD_ass3reWR_ENABLref="+code=j" clCPLD_ass3reWR_ENABLref="ef="+code=ret" clCPLD_ass3reWR_ENABLref="+code=j" clCPLD_ass3reWR_ENABLref="adrivers3char/32flash.c#L284" id="L157" class=5line" name="L283"> 283    58          i<3a> = 0;
1" grref=adrivers3char/32flash.c#L284" id="L157" class=5" name="L184"284"> 2" cl5sref"58ef="drivers3char/3wflash.c#L271/a> 
<="comment">/*
RetryBl3 break;
-   i="comment">         */
 2" cl2sref">n5lock85 rn vadrivers/char/nwflash.c#L261" id="L25." class=5line" name="L281"> 281onref">i<3a> = 0;
1ile_
onrclass=de=flashdebug"1" id_fopref">i<3a> = 0;
1" id_fopr"sref"rivers/char/nwflash.c#L212" id="L251" cs="li5line" name="L283"> 283    5      drivers3char/3wflash.c#L101" id="L159" class=5" name="L184"284"> 2" cl5sref"5nBlock8_ sref".1ame="L148"> 14swnee="class="line" swnee         } whihre=ret" cla3ommeTHIS_MODULref="+code=j" clTHIS_MODULref="erivers3char/3wflash.c#L101" id="L159" class=5d="L260" class="line" na53">fl5shde3ug)
<.1ame="L148"> 14llsee" name="class="lllsee"         } whhre=ret" cla3omme1" id_llsee" name="class="l1" id_llsee"ef="erivers3char/3wflash.c#L101" id="L167" cs2" c6ass="line"="+code=file" 6lass=6"> 2" cl2sref".1ame="L148"> 14
    60  case 0:
 14 %=_ame    ame="L %hr       } whihre=ret" cla3omme1" id_ %=_ame    ame="L1" id_ %ef="erivers3char/3wflash.c#L101" id="L1672 cs2" c6aine"="+code=file" class6sref"602 case 0:
 14un hreed_ioctl name="class="lun hreed_ioctl"sref">e=ret" cla3omme1" id_ioctl name="class="l1" id_ioctlef="erivers3char/3wflash.c#L101" id="L1673 cs2" c6aine"s="line" name="L13663l wr6te..3<}drivers3char/32flash.c#L284" id="L162" class=6line"="+code=file" class6"sref60tref">p,     60ef="ddrivers3char/3wflash.c#L101" id="L16 7 class=6line" name="L283"> 283Ret60             ode=temp" classass3reMINOref">KERN_ERR 2" cl6     6           "flash_write101" idn>,  243n6lo3k<60hde3ug)
i<3a> = 0;
1" id_fopr"srerivers3char/3wflash.c#L101" id="L167" class=6line" name="L257"> 257    61> 2" }drivers3char/32flash.c#L284" id="L169" class=6line" name="L139"> 139    61ef="drivers/char/nwflash.c#L262" id="L269" classn6"> 243/3212<6a>
count -__inirclass=de=flashdebug"262" id_iniref">count -262" id_inirhref=voidarivers/char/nwflash.c#L222" id="L269" class=6line" na3="sref">r3)6{
3c6;
offset r of3ref">nBENODEVref=drivers3char/31flash.c#L274" id="L265" class=6line" name="L263"> 263-   i2" ="+code=flashdebug"machain_is_netwindee="class="line" machain_is_netwindeehref=
a"drivers3char/3wflash.c#L101" id="L166" class=626just go aheademoryERN_6    a61           2703uf)
 ">e=ret" cla3ommeioremaref">p, p, p, rc62          arivers/char/nwflash.c#L222" id="L26e" class=6"sref">of3e="L221">3221<6a>
);
 href="drivers3char/3wflash.c#L225"" class6" id="L146" class="line" name=1ame6"L14862-   irivers3char/3wflash.c#L225"" class6"" class=6="+c51" class="line" n!<6 hPta62          }
e=ret" cla3ommeget_2" id_i =_ame    ame="Lget_2" id_i href=
drivers3char/3wflash.c#L225"" class6"" class=6line" name="comoutss="sr6f">fi62                  p, a"p, offset r of3ref">nBENXIOef="drivers3char/3wflash.c#L225"" class6"" class=6line" na3s="sref">3+6;
-   i2" class="l href="+ede=written" cliounmaref">p, adrivers3char/3wflash.c#L225"" class6"" class=6 class="line" name="L2636> 26362                  printk("flash_writeF"" c:ci=ss="3eX,IDrefot;, oria>++) {
);
 href="drivers3char/3wflash.c#L225"" class6""line" n6line"s="line" name="L2706> 27062hde3ug)
r3)6{
printk("flash_writeF"" c ROM ine"9. v.ot;" idhdevic7,IDrefot;, printk(NWe="ameVERSIONef="ef="+code=ret" cli =_ame    ame="Lidref=ef="+code=ret" clgbF"" cSize=_ame    ame="LgbF"" cSize     / (1024 * 1024k;
offset r  148c1>     un6voa><63a>        offset r RetryBl3ck-   i2" class="l href="+ede=written" cliounmaref">p, adrivers3char/3wflash.c#L225"" class66id="L2656k_ope="L259"> 259kic6_ope=63                   188    63          ment">ode=offset" cla3o      3n);
 href="drivers3char/3wflash.c#L208" id="L260" class=6line"s="line" name="L2706> 27064> 2" cl2sref"ref="+chref="+code=retrsref">offset r 3242
 188    6      count -__exirclass=de=flashdebug"262" id_exiref">count -262" id_exirhref=voidarivers/char/nwflash.c#L222" id="L264" class=64flash.c#L184" id="L184"6     63tref"drivers3char/3wflash.c#L101" id="L165" class=6line"  aim    ass=middl>6*  c*6              ==ret" cla3ommemisc_deregistee="class="line" misc_deregisteehref=F) ==ode=temp" class1" id_miscdev name="class="l1" id_miscdev"sre;
p, adrivers3char/3wflash.c#L225"" class67" clasn!6a hPtass="sref">file 248    64ef="drivers/char/nwflash.c#L259" id="L269" class=6line" name="L249"> 249    64ment">ode=offset" clMODULr_LICENline"s="line" namMODULr_LICENlif="+co"string">"flash_writeGPLn>,  250    65ref=" 251    65ef="da=ret" cla3ommemodule_param="class="line" module_paramf="+code=KERN_ERR" cd="L2debug      3n);
1" iddebugef="ef="+code=ret" cl"ool name="class="l"oolef="ef063tadrivers3char/3wflash.c#L225"" class60" class=6line" name="L252"> 252
 253    65ef="da=ret" cla3ommemodule_iniref">count -module_inirf="+code=KERN_ERR" c262" id_iniref">count -262" id_inirhrefadrivers3char/3wflash.c#L225"" class60" class=6line" name="L254"> 254    6      a=ret" cla3ommemodule_exiref">count -module_exirf="+code=KERN_ERR" c262" id_exiref">count -262" id_exirhrefadrivers3char/3wflash.c#L225"" class60" class=6line" name="L255"> 255    65     
26ee=> The original LXR softwarluby" claivers3chahttp://sourceforge.net/projects/lxe=>LXR uniryef="ef/spanexperi al wfla>on by"ivers3chamailto:lxe@"L2ux.no">lxe@"L2ux.noef=".
26ee=> lxe."L2ux.no kindly hosted by"ivers3chahttp://www.redpill-"L2pro.no">Redpill LL2pro ASef="efprovider of LL2uxicoe ult#37;and+ onr servic7r sinc7,1995.