1*6adb739dSahoka /* $NetBSD: nand_bbt.h,v 1.2 2011/04/04 14:25:10 ahoka Exp $ */ 22b6ee221Sahoka 32b6ee221Sahoka /*- 42b6ee221Sahoka * Copyright (c) 2010 Department of Software Engineering, 52b6ee221Sahoka * University of Szeged, Hungary 62b6ee221Sahoka * Copyright (c) 2010 Adam Hoka <ahoka@NetBSD.org> 72b6ee221Sahoka * All rights reserved. 82b6ee221Sahoka * 92b6ee221Sahoka * This code is derived from software contributed to The NetBSD Foundation 102b6ee221Sahoka * by the Department of Software Engineering, University of Szeged, Hungary 112b6ee221Sahoka * 122b6ee221Sahoka * Redistribution and use in source and binary forms, with or without 132b6ee221Sahoka * modification, are permitted provided that the following conditions 142b6ee221Sahoka * are met: 152b6ee221Sahoka * 1. Redistributions of source code must retain the above copyright 162b6ee221Sahoka * notice, this list of conditions and the following disclaimer. 172b6ee221Sahoka * 2. Redistributions in binary form must reproduce the above copyright 182b6ee221Sahoka * notice, this list of conditions and the following disclaimer in the 192b6ee221Sahoka * documentation and/or other materials provided with the distribution. 202b6ee221Sahoka * 212b6ee221Sahoka * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 222b6ee221Sahoka * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 232b6ee221Sahoka * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 242b6ee221Sahoka * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 252b6ee221Sahoka * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 262b6ee221Sahoka * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 272b6ee221Sahoka * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED 282b6ee221Sahoka * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 292b6ee221Sahoka * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 302b6ee221Sahoka * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 312b6ee221Sahoka * SUCH DAMAGE. 322b6ee221Sahoka */ 332b6ee221Sahoka 342b6ee221Sahoka #ifndef _NAND_BBT_H_ 352b6ee221Sahoka #define _NAND_BBT_H_ 362b6ee221Sahoka 372b6ee221Sahoka enum { 382b6ee221Sahoka NAND_BBT_MARKER_FACTORY_BAD = 0x00, /* 00 */ 392b6ee221Sahoka NAND_BBT_MARKER_WORNOUT_BAD = 0x01, /* 01 */ 402b6ee221Sahoka NAND_BBT_MARKER_RESERVED = 0x02, /* 10 */ 412b6ee221Sahoka NAND_BBT_MARKER_GOOD = 0x03 /* 11 */ 422b6ee221Sahoka }; 432b6ee221Sahoka 442b6ee221Sahoka enum { 452b6ee221Sahoka NAND_BBT_OFFSET = 0x0e 462b6ee221Sahoka }; 472b6ee221Sahoka 482b6ee221Sahoka void nand_bbt_init(device_t); 492b6ee221Sahoka void nand_bbt_detach(device_t); 502b6ee221Sahoka void nand_bbt_scan(device_t); 512b6ee221Sahoka bool nand_bbt_update(device_t); 522b6ee221Sahoka bool nand_bbt_load(device_t); 53*6adb739dSahoka void nand_bbt_block_mark(device_t, flash_off_t, uint8_t); 54*6adb739dSahoka void nand_bbt_block_markbad(device_t, flash_off_t); 55*6adb739dSahoka void nand_bbt_block_markfactorybad(device_t, flash_off_t); 56*6adb739dSahoka bool nand_bbt_block_isbad(device_t, flash_off_t); 572b6ee221Sahoka 582b6ee221Sahoka #endif 59