norflash: fix handling of boundaries

This was slightly off since my introduction of hidden sectors^^^^^
blocks in the norflash driver.
This commit is contained in:
Ithamar R. Adema 2013-09-18 21:50:36 +02:00
parent bd3bcbe5d6
commit 31e17f9d7b

View File

@ -63,6 +63,9 @@ nor_init_device(void *_info, void **_cookie)
if (info->id < 0)
return info->id;
info->mapped += HIDDEN_BLOCKS * info->blocksize;
*_cookie = info;
return B_OK;
}
@ -142,8 +145,6 @@ nor_read(void *_cookie, off_t position, void *data, size_t *numbytes)
nor_driver_info *info = (nor_driver_info*)_cookie;
TRACE("read(%Ld,%lu)\n", position, *numbytes);
position += HIDDEN_BLOCKS * info->blocksize;
if (position + *numbytes > info->totalsize)
*numbytes = info->totalsize - (position + *numbytes);