projects
/
yaffs2.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'master' of ssh://www.aleph1.co.uk/home/aleph1/git/yaffs2
[yaffs2.git]
/
yaffs_mtdif1.c
diff --git
a/yaffs_mtdif1.c
b/yaffs_mtdif1.c
index ca7b0a37896d8a371f864fe1e2510f506746f8a7..638099960735b34f4db90fb944fa68b07e6669c9 100644
(file)
--- a/
yaffs_mtdif1.c
+++ b/
yaffs_mtdif1.c
@@
-1,10
+1,11
@@
/*
* YAFFS: Yet another FFS. A NAND-flash specific file system.
/*
* YAFFS: Yet another FFS. A NAND-flash specific file system.
- * yaffs_mtdif1.c NAND mtd interface functions for small-page NAND.
*
* Copyright (C) 2002-2010 Aleph One Ltd.
* for Toby Churchill Ltd and Brightstar Engineering
*
*
* Copyright (C) 2002-2010 Aleph One Ltd.
* for Toby Churchill Ltd and Brightstar Engineering
*
+ * Created by Charles Manning <charles@aleph1.co.uk>
+ *
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 2 as
* published by the Free Software Foundation.
@@
-55,7
+56,7
@@
* the 9th byte.
*
* Old-style on-NAND format: T0,T1,T2,T3,P,B,T4,T5,E0,E1,E2,T6,T7,E3,E4,E5
* the 9th byte.
*
* Old-style on-NAND format: T0,T1,T2,T3,P,B,T4,T5,E0,E1,E2,T6,T7,E3,E4,E5
- * We have/need
PackedT
ags1 plus page_status: T0,T1,T2,T3,T4,T5,T6,T7,P
+ * We have/need
packed_t
ags1 plus page_status: T0,T1,T2,T3,T4,T5,T6,T7,P
* where Tn are the tag bytes, En are MTD's ECC bytes, P is the page_status
* byte and B is the small-page bad-block indicator byte.
*/
* where Tn are the tag bytes, En are MTD's ECC bytes, P is the page_status
* byte and B is the small-page bad-block indicator byte.
*/
@@
-73,12
+74,12
@@
static struct nand_ecclayout nand_oob_16 = {
* compact (packed) form for storage in NAND. A mini-ECC runs over the
* contents of the tags meta-data; used to valid the tags when read.
*
* compact (packed) form for storage in NAND. A mini-ECC runs over the
* contents of the tags meta-data; used to valid the tags when read.
*
- * - Pack ExtendedTags to
PackedT
ags1 form
- * - Compute mini-ECC for
PackedT
ags1
+ * - Pack ExtendedTags to
packed_t
ags1 form
+ * - Compute mini-ECC for
packed_t
ags1
* - Write data and packed tags to NAND.
*
* - Write data and packed tags to NAND.
*
- * Note: Due to the use of the
PackedT
ags1 meta-data which does not include
- * a full sequence number (as found in the larger
PackedT
ags2 form) it is
+ * Note: Due to the use of the
packed_t
ags1 meta-data which does not include
+ * a full sequence number (as found in the larger
packed_t
ags2 form) it is
* necessary for Yaffs to re-write a chunk/page (just once) to mark it as
* discarded and dirty. This is not ideal: newer NAND parts are supposed
* to be written just once. When Yaffs performs this operation, this
* necessary for Yaffs to re-write a chunk/page (just once) to mark it as
* discarded and dirty. This is not ideal: newer NAND parts are supposed
* to be written just once. When Yaffs performs this operation, this
@@
-88,21
+89,21
@@
static struct nand_ecclayout nand_oob_16 = {
* Any underlying MTD error results in YAFFS_FAIL.
* Returns YAFFS_OK or YAFFS_FAIL.
*/
* Any underlying MTD error results in YAFFS_FAIL.
* Returns YAFFS_OK or YAFFS_FAIL.
*/
-int nandmtd1_
WriteChunkWithTagsToNAND
(yaffs_dev_t *dev,
+int nandmtd1_
write_chunk_tags
(yaffs_dev_t *dev,
int nand_chunk, const __u8 *data, const yaffs_ext_tags *etags)
{
struct mtd_info *mtd = yaffs_dev_to_mtd(dev);
int nand_chunk, const __u8 *data, const yaffs_ext_tags *etags)
{
struct mtd_info *mtd = yaffs_dev_to_mtd(dev);
- int chunk
B
ytes = dev->data_bytes_per_chunk;
- loff_t addr = ((loff_t)nand_chunk) * chunk
B
ytes;
+ int chunk
_b
ytes = dev->data_bytes_per_chunk;
+ loff_t addr = ((loff_t)nand_chunk) * chunk
_b
ytes;
struct mtd_oob_ops ops;
struct mtd_oob_ops ops;
- yaffs_
PackedT
ags1 pt1;
+ yaffs_
packed_t
ags1 pt1;
int retval;
int retval;
- /* we assume that
PackedT
ags1 and yaffs_tags_t are compatible */
- compile_time_assertion(sizeof(yaffs_
PackedT
ags1) == 12);
+ /* we assume that
packed_t
ags1 and yaffs_tags_t are compatible */
+ compile_time_assertion(sizeof(yaffs_
packed_t
ags1) == 12);
compile_time_assertion(sizeof(yaffs_tags_t) == 8);
compile_time_assertion(sizeof(yaffs_tags_t) == 8);
- yaffs_
PackT
ags1(&pt1, etags);
+ yaffs_
pack_t
ags1(&pt1, etags);
yaffs_calc_tags_ecc((yaffs_tags_t *)&pt1);
/* When deleting a chunk, the upper layer provides only skeletal
yaffs_calc_tags_ecc((yaffs_tags_t *)&pt1);
/* When deleting a chunk, the upper layer provides only skeletal
@@
-128,7
+129,7
@@
int nandmtd1_WriteChunkWithTagsToNAND(yaffs_dev_t *dev,
memset(&ops, 0, sizeof(ops));
ops.mode = MTD_OOB_AUTO;
memset(&ops, 0, sizeof(ops));
ops.mode = MTD_OOB_AUTO;
- ops.len = (data) ? chunk
B
ytes : 0;
+ ops.len = (data) ? chunk
_b
ytes : 0;
ops.ooblen = YTAG1_SIZE;
ops.datbuf = (__u8 *)data;
ops.oobbuf = (__u8 *)&pt1;
ops.ooblen = YTAG1_SIZE;
ops.datbuf = (__u8 *)data;
ops.oobbuf = (__u8 *)&pt1;
@@
-160,27
+161,27
@@
static int rettags(yaffs_ext_tags *etags, int ecc_result, int retval)
*
* - Check ECC results for data (if applicable)
* - Check for blank/erased block (return empty ExtendedTags if blank)
*
* - Check ECC results for data (if applicable)
* - Check for blank/erased block (return empty ExtendedTags if blank)
- * - Check the
PackedT
ags1 mini-ECC (correct if necessary/possible)
- * - Convert
PackedT
ags1 to ExtendedTags
+ * - Check the
packed_t
ags1 mini-ECC (correct if necessary/possible)
+ * - Convert
packed_t
ags1 to ExtendedTags
* - Update ecc_result and block_bad members to refect state.
*
* Returns YAFFS_OK or YAFFS_FAIL.
*/
* - Update ecc_result and block_bad members to refect state.
*
* Returns YAFFS_OK or YAFFS_FAIL.
*/
-int nandmtd1_
ReadChunkWithTagsFromNAND
(yaffs_dev_t *dev,
+int nandmtd1_
read_chunk_tags
(yaffs_dev_t *dev,
int nand_chunk, __u8 *data, yaffs_ext_tags *etags)
{
struct mtd_info *mtd = yaffs_dev_to_mtd(dev);
int nand_chunk, __u8 *data, yaffs_ext_tags *etags)
{
struct mtd_info *mtd = yaffs_dev_to_mtd(dev);
- int chunk
B
ytes = dev->data_bytes_per_chunk;
- loff_t addr = ((loff_t)nand_chunk) * chunk
B
ytes;
+ int chunk
_b
ytes = dev->data_bytes_per_chunk;
+ loff_t addr = ((loff_t)nand_chunk) * chunk
_b
ytes;
int eccres = YAFFS_ECC_RESULT_NO_ERROR;
struct mtd_oob_ops ops;
int eccres = YAFFS_ECC_RESULT_NO_ERROR;
struct mtd_oob_ops ops;
- yaffs_
PackedT
ags1 pt1;
+ yaffs_
packed_t
ags1 pt1;
int retval;
int deleted;
memset(&ops, 0, sizeof(ops));
ops.mode = MTD_OOB_AUTO;
int retval;
int deleted;
memset(&ops, 0, sizeof(ops));
ops.mode = MTD_OOB_AUTO;
- ops.len = (data) ? chunk
B
ytes : 0;
+ ops.len = (data) ? chunk
_b
ytes : 0;
ops.ooblen = YTAG1_SIZE;
ops.datbuf = data;
ops.oobbuf = (__u8 *)&pt1;
ops.ooblen = YTAG1_SIZE;
ops.datbuf = data;
ops.oobbuf = (__u8 *)&pt1;
@@
-260,9
+261,9
@@
int nandmtd1_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev,
}
/* Unpack the tags to extended form and set ECC result.
}
/* Unpack the tags to extended form and set ECC result.
- * [set should
BeFF
just to keep yaffs_unpack_tags1 happy]
+ * [set should
_be_ff
just to keep yaffs_unpack_tags1 happy]
*/
*/
- pt1.should
BeFF
= 0xFFFFFFFF;
+ pt1.should
_be_ff
= 0xFFFFFFFF;
yaffs_unpack_tags1(etags, &pt1);
etags->ecc_result = eccres;
yaffs_unpack_tags1(etags, &pt1);
etags->ecc_result = eccres;
@@
-278,7
+279,7
@@
int nandmtd1_ReadChunkWithTagsFromNAND(yaffs_dev_t *dev,
*
* Returns YAFFS_OK or YAFFS_FAIL.
*/
*
* Returns YAFFS_OK or YAFFS_FAIL.
*/
-int nandmtd1_
MarkNANDBlockB
ad(struct yaffs_dev_s *dev, int block_no)
+int nandmtd1_
mark_block_b
ad(struct yaffs_dev_s *dev, int block_no)
{
struct mtd_info *mtd = yaffs_dev_to_mtd(dev);
int blocksize = dev->param.chunks_per_block * dev->data_bytes_per_chunk;
{
struct mtd_info *mtd = yaffs_dev_to_mtd(dev);
int blocksize = dev->param.chunks_per_block * dev->data_bytes_per_chunk;
@@
-294,7
+295,7
@@
int nandmtd1_MarkNANDBlockBad(struct yaffs_dev_s *dev, int block_no)
*
* Returns YAFFS_OK or YAFFS_FAIL.
*/
*
* Returns YAFFS_OK or YAFFS_FAIL.
*/
-static int nandmtd1_
TestP
rerequists(struct mtd_info *mtd)
+static int nandmtd1_
test_p
rerequists(struct mtd_info *mtd)
{
/* 2.6.18 has mtd->ecclayout->oobavail */
/* 2.6.21 has mtd->ecclayout->oobavail and mtd->oobavail */
{
/* 2.6.18 has mtd->ecclayout->oobavail */
/* 2.6.21 has mtd->ecclayout->oobavail and mtd->oobavail */
@@
-318,12
+319,12
@@
static int nandmtd1_TestPrerequists(struct mtd_info *mtd)
*
* Always returns YAFFS_OK.
*/
*
* Always returns YAFFS_OK.
*/
-int nandmtd1_
QueryNANDB
lock(struct yaffs_dev_s *dev, int block_no,
- yaffs_block_state_t *
pState, __u32 *pSequenceNumbe
r)
+int nandmtd1_
query_b
lock(struct yaffs_dev_s *dev, int block_no,
+ yaffs_block_state_t *
state_ptr, __u32 *seq_pt
r)
{
struct mtd_info *mtd = yaffs_dev_to_mtd(dev);
{
struct mtd_info *mtd = yaffs_dev_to_mtd(dev);
- int chunk
No
= block_no * dev->param.chunks_per_block;
- loff_t addr = (loff_t)chunk
No
* dev->data_bytes_per_chunk;
+ int chunk
_num
= block_no * dev->param.chunks_per_block;
+ loff_t addr = (loff_t)chunk
_num
* dev->data_bytes_per_chunk;
yaffs_ext_tags etags;
int state = YAFFS_BLOCK_STATE_DEAD;
int seqnum = 0;
yaffs_ext_tags etags;
int state = YAFFS_BLOCK_STATE_DEAD;
int seqnum = 0;
@@
-332,10
+333,10
@@
int nandmtd1_QueryNANDBlock(struct yaffs_dev_s *dev, int block_no,
/* We don't yet have a good place to test for MTD config prerequists.
* Do it here as we are called during the initial scan.
*/
/* We don't yet have a good place to test for MTD config prerequists.
* Do it here as we are called during the initial scan.
*/
- if (nandmtd1_
TestP
rerequists(mtd) != YAFFS_OK)
+ if (nandmtd1_
test_p
rerequists(mtd) != YAFFS_OK)
return YAFFS_FAIL;
return YAFFS_FAIL;
- retval = nandmtd1_
ReadChunkWithTagsFromNAND(dev, chunkNo
, NULL, &etags);
+ retval = nandmtd1_
read_chunk_tags(dev, chunk_num
, NULL, &etags);
etags.block_bad = (mtd->block_isbad)(mtd, addr);
if (etags.block_bad) {
T(YAFFS_TRACE_BAD_BLOCKS,
etags.block_bad = (mtd->block_isbad)(mtd, addr);
if (etags.block_bad) {
T(YAFFS_TRACE_BAD_BLOCKS,
@@
-351,8
+352,8
@@
int nandmtd1_QueryNANDBlock(struct yaffs_dev_s *dev, int block_no,
state = YAFFS_BLOCK_STATE_EMPTY;
}
state = YAFFS_BLOCK_STATE_EMPTY;
}
- *
pState
= state;
- *
pSequenceNumbe
r = seqnum;
+ *
state_ptr
= state;
+ *
seq_pt
r = seqnum;
/* query always succeeds */
return YAFFS_OK;
/* query always succeeds */
return YAFFS_OK;